def main():
<EOL>coloredlogs.install()<EOL>repository = None<EOL>revision = None<EOL>actions = []<EOL>try:<EOL><INDENT>options, arguments = getopt.gnu_getopt(sys.argv[<NUM_LIT:1>:], '<STR_LIT>', [<EOL>'<STR_LIT>', '<STR_LIT>', '<STR_LIT>', '<STR_LIT>', '<STR_LIT>',<EOL>'<STR_LIT>', '<STR_LIT>', '<STR_LIT>',<EOL>'<STR_LIT>', '<STR_LIT>', '<STR_LIT>', '<STR_LIT>',<EOL>'<STR_LIT>', '<STR_LIT>', '<STR_LIT>', '<STR_LIT>', '<STR_LIT>',<EOL>])<EOL>for option, value in options:<EOL><INDENT>if option in ('<STR_LIT>', '<STR_LIT>'):<EOL><INDENT>value = value.strip()<EOL>assert value, "<STR_LIT>"<EOL>repository = coerce_repository(value)<EOL><DEDENT>elif option in ('<STR_LIT>', '<STR_LIT>'):<EOL><INDENT>revision = value.strip()<EOL>assert revision, "<STR_LIT>"<EOL><DEDENT>elif option == '<STR_LIT>':<EOL><INDENT>assert repository, "<STR_LIT>"<EOL>release_id = value.strip()<EOL>assert release_id in repository.releases, "<STR_LIT>"<EOL>revision = repository.releases[release_id].revision.revision_id<EOL><DEDENT>elif option in ('<STR_LIT>', '<STR_LIT>'):<EOL><INDENT>assert repository, "<STR_LIT>"<EOL>actions.append(functools.partial(print_directory, repository))<EOL><DEDENT>elif option in ('<STR_LIT>', '<STR_LIT>'):<EOL><INDENT>assert repository, "<STR_LIT>"<EOL>actions.append(functools.partial(print_revision_number, repository, revision))<EOL><DEDENT>elif option in ('<STR_LIT>', '<STR_LIT>'):<EOL><INDENT>assert repository, "<STR_LIT>"<EOL>actions.append(functools.partial(print_revision_id, repository, revision))<EOL><DEDENT>elif option == '<STR_LIT>':<EOL><INDENT>assert repository, "<STR_LIT>"<EOL>actions.append(functools.partial(print_releases, repository))<EOL><DEDENT>elif option == '<STR_LIT>':<EOL><INDENT>assert repository, "<STR_LIT>"<EOL>release_id = value.strip()<EOL>assert release_id, "<STR_LIT>"<EOL>actions.append(functools.partial(print_selected_release, repository, release_id))<EOL><DEDENT>elif option in ('<STR_LIT>', '<STR_LIT>'):<EOL><INDENT>assert len(arguments) >= <NUM_LIT:2>, "<STR_LIT>"<EOL>actions.append(functools.partial(print_summed_revisions, arguments))<EOL>arguments = []<EOL><DEDENT>elif option == '<STR_LIT>':<EOL><INDENT>assert repository, "<STR_LIT>"<EOL>actions.append(functools.partial(print_vcs_control_field, repository, revision))<EOL><DEDENT>elif option in ('<STR_LIT>', '<STR_LIT>'):<EOL><INDENT>assert repository, "<STR_LIT>"<EOL>actions.append(functools.partial(repository.update))<EOL><DEDENT>elif option in ('<STR_LIT>', '<STR_LIT>'):<EOL><INDENT>assert repository, "<STR_LIT>"<EOL>actions.append(functools.partial(<EOL>repository.merge_up,<EOL>target_branch=revision,<EOL>feature_branch=arguments[<NUM_LIT:0>] if arguments else None,<EOL>))<EOL><DEDENT>elif option in ('<STR_LIT>', '<STR_LIT>'):<EOL><INDENT>directory = value.strip()<EOL>assert repository, "<STR_LIT>"<EOL>assert directory, "<STR_LIT>"<EOL>actions.append(functools.partial(repository.export, directory, revision))<EOL><DEDENT>elif option in ('<STR_LIT>', '<STR_LIT>'):<EOL><INDENT>coloredlogs.increase_verbosity()<EOL><DEDENT>elif option in ('<STR_LIT>', '<STR_LIT>'):<EOL><INDENT>coloredlogs.decrease_verbosity()<EOL><DEDENT>elif option in ('<STR_LIT>', '<STR_LIT>'):<EOL><INDENT>usage(__doc__)<EOL>return<EOL><DEDENT><DEDENT>if not actions:<EOL><INDENT>usage(__doc__)<EOL>return<EOL><DEDENT><DEDENT>except Exception as e:<EOL><INDENT>warning("<STR_LIT>", e)<EOL>sys.exit(<NUM_LIT:1>)<EOL><DEDENT>try:<EOL><INDENT>for action in actions:<EOL><INDENT>action()<EOL><DEDENT><DEDENT>except Exception:<EOL><INDENT>logger.exception("<STR_LIT>")<EOL>sys.exit(<NUM_LIT:1>)<EOL><DEDENT>
The command line interface of the ``vcs-tool`` program.