def commit_file(self, repository, filename=None, contents=None, message=None):
filename = filename or random_string(<NUM_LIT:15>)<EOL>contents = contents or random_string(<NUM_LIT>)<EOL>exists = repository.context.exists(filename)<EOL>repository.context.write_file(filename, contents)<EOL>repository.add_files(filename)<EOL>repository.commit(message=message or ("<STR_LIT>" % (<EOL>"<STR_LIT>" if exists else "<STR_LIT>", filename,<EOL>)))<EOL>
Commit a file to the given repository.