def publish_report(report, args, old_commit, new_commit):
<EOL>output = "<STR_LIT>"<EOL>if not args.quiet and not args.gist and not args.file:<EOL><INDENT>return report<EOL><DEDENT>if args.gist:<EOL><INDENT>gist_url = post_gist(report, old_commit, new_commit)<EOL>output += "<STR_LIT>".format(gist_url)<EOL><DEDENT>if args.file is not None:<EOL><INDENT>with open(args.file, '<STR_LIT:w>') as f:<EOL><INDENT>f.write(report.encode('<STR_LIT:utf-8>'))<EOL><DEDENT>output += "<STR_LIT>".format(args.file)<EOL><DEDENT>return output<EOL>
Publish the RST report based on the user request.