<commit_before>from collections import namedtuple


class CommandNotFoundError(Exception):
    pass


class AmbiguousCommandError(Exception):
    pass


cmd_data = namedtuple('cmd_data','invocations prompt enabled syntax_file help flags')

# Flags
RUN_IN_OWN_CONSOLE = 0x01

HG_COMMANDS = {}


HG_COMMANDS['default'] = {
    'commit': cmd_data(
                    invocations={
                        'commit...': 'commit -m "%(input)s"',
                        'commit... (this file)': 'commit "%(file_name)s" -m "%(input)s"',
                    },
                    prompt='Commit message:',
                    enabled=True,
                    syntax_file='',
                    help='commit the specified files or all outstanding changes',
                    flags=0,
                    ),
    'init': cmd_data(
                    invocations={
                        'init': 'init',
                    },
                    prompt='',
                    enabled=True,
                    syntax_file='',
                    help='create a new repository in the given directory',
                    flags=RUN_IN_OWN_CONSOLE,
                    ),
    'add': cmd_data(
                    invocations={
                        'add (this file)': 'add "%(file_name)s"',
                        'add': 'add',
                   },
                    prompt='',
                    enabled=True,
                    syntax_file='',
                    help='add the specified files on the next commit',
                    flags=0,
                    ),
    'addremove': cmd_data(
                    invocations={},
                    prompt='',
                    enabled=True,
                    syntax_file='',
                    help='add all new files, delete all missing files',
                    flags=0,
                    ),
    'annotate': cmd_data(
                    invocations={
                        'annotate | blame (this file)': 'annotate "%(file_name)s"',
                        'annotate | blame [full] (this file)': 'annotate -nudq "%(file_name)s"',
                   },
                    prompt='',
                    enabled=True,
                    syntax_file='Packages/Mercurial/Support/Mercurial Annotate.hidden-tmLanguage',
                    help='show changeset information by line for each file',
                    flags=0,
                    ),
    'bookmark': cmd_data(
                    invocations={
                        'bookmark... (parent revision)': 'bookmark "%(input)s"',
                    },
                    prompt='Bookmark name:',
                    enabled=True,
                    syntax_file='',
                    help='track a line of development with movable markers',
                    flags=0,
                    ),
    'bookmarks': cmd_data(
                    invocations={},
                    prompt='',
                    enabled=True,
                    syntax_file='',
                    help='track a line of development with movable markers',
                    flags=0,
                    ),
    'branch': cmd_data(
                    invocations={},
                    prompt='',
                    enabled=True,
                    syntax_file='',
                    help='set or show the current branch name',
                    flags=0,
                    ),
    'branches': cmd_data(
                    invocations={},
                    prompt='',
                    enabled=True,
                    syntax_file='',
                    help='list repository named branches',
                    flags=0,
                    ),
    'diff': cmd_data(
                    invocations={
                        'diff': 'diff',
                        'diff (this file)': 'diff "%(file_name)s"',
                        'diff [stat]': 'diff --stat',
                        'diff [stat] (this file)': 'diff "%(file_name)s" --stat',
                    },
                    prompt='',
                    enabled=True,
                    syntax_file='Packages/Diff/Diff.tmLanguage',
                    help='diff repository (or selected files)',
                    flags=0,
                    ),
    'forget': cmd_data(
                    invocations={
                        'forget (this file)': 'forget "%(file_name)s"',
                    },
                    prompt='',
                    enabled=True,
                    syntax_file='',
                    help='forget the specified files on the next commit',
                    flags=0,
                    ),
    'grep': cmd_data(
                    invocations={
                        'grep (tip)...': 'grep "%(input)s" -ur tip',
                        'grep (latest 5)...': 'grep "%(input)s" -ur "-5:tip"',
                        'grep (latest 10)...': 'grep "%(input)s" -ur "-10:tip"',
                        'grep (all)...': 'grep "%(input)s" -u',
                    },
                    prompt='Pattern (grep):',
                    enabled=True,
                    syntax_file='',
                    help='search for a pattern in specified files and revisions',
                    flags=0,
                    ),
    'heads': cmd_data(
                    invocations={},
                    prompt='',
                    enabled=True,
                    syntax_file='',
                    help='show current repository heads or show branch heads',
                    flags=0,
                    ),
    'help': cmd_data(
                    invocations={
                        'help...': 'help "%(input)s"',
                        'help': 'help',
                        },
                    prompt='Help topic:',
                    enabled=True,
                    syntax_file='',
                    help='show help for a given topic or a help overview',
                    flags=0,
                    ),
    'identify': cmd_data(
                    invocations={
                        'identify': 'identify -nibtB'
                    },
                    prompt='',
                    enabled=True,
                    syntax_file='',
                    help='identify the working copy or specified revision',
                    flags=0,
                    ),
    'incoming': cmd_data(
                    invocations={
                        'incoming...': 'incoming %(input)s',
                        'incoming': 'incoming',
                    },
                    prompt='Incoming source:',
                    enabled=True,
                    syntax_file='',
                    help='show new changesets found in source',
                    flags=RUN_IN_OWN_CONSOLE,
                    ),
    'locate': cmd_data(
                    invocations={
                        'locate...': 'locate "%(input)s"'
                    },
                    prompt='Pattern:',
                    enabled=True,
                    syntax_file='',
                    help='locate files matching specific patterns',
                    flags=0,
                    ),
    'log': cmd_data(
                    invocations={
                        'log (this file)': 'log "%(file_name)s"',
                        'log': 'log',
                    },
                    prompt='',
                    enabled=True,
                    syntax_file='Packages/Mercurial/Support/Mercurial Log.hidden-tmLanguage',
                    help='show revision history of entire repository or files',
                    flags=0,
                    ),
    'manifest': cmd_data(
                    invocations={},
                    prompt='',
                    enabled=True,
                    syntax_file='',
                    help='output the current or given revision of the project manifest',
                    flags=0,
                    ),
    'merge': cmd_data(
                    invocations={
                        'merge...': 'merge "%(input)s"',
                        'merge': 'merge',
                    },
                    prompt='',
                    enabled=True,
                    syntax_file='',
                    help='merge working directory with another revision',
                    flags=0,
                    ),
    'outgoing': cmd_data(
                    invocations={
                        'outgoing...': 'outgoing %(input)s',
                        'outgoing': 'outgoing',
                    },
                    prompt='Outgoing target:',
                    enabled=True,
                    syntax_file='Packages/Mercurial/Support/Mercurial Log.hidden-tmLanguage',
                    help='show changesets not found in the destination',
                    flags=RUN_IN_OWN_CONSOLE,
                    ),
    'parents': cmd_data(
                    invocations={},
                    prompt='',
                    enabled=True,
                    syntax_file='',
                    help='show the parents of the working directory or revision',
                    flags=0,
                    ),
    'paths': cmd_data(
                    invocations={},
                    prompt='',
                    enabled=True,
                    syntax_file='',
                    help='show aliases for remote repositories',
                    flags=0,
                    ),
    'pull': cmd_data(
                    invocations={
                        'pull...': 'pull %(input)s',
                        'pull': 'pull',
                    },
                    prompt='Pull source:',
                    enabled=True,
                    syntax_file='',
                    help='pull changes from the specified source',
                    flags=RUN_IN_OWN_CONSOLE,
                    ),
    "push": cmd_data(
                    invocations={
                        'push...': 'push %(input)s',
                        'push': 'push',
                    },
                    prompt="Push target:",
                    enabled=True,
                    syntax_file='',
                    help='push changes to the specified destination',
                    flags=RUN_IN_OWN_CONSOLE,
                    ),
    "recover": cmd_data(
                    invocations={},
                    prompt='',
                    enabled=True,
                    syntax_file='',
                    help='roll back an interrupted transaction',
                    flags=0,
                    ),
    "remove": cmd_data(
                    invocations={
                        'remove (this file)': 'remove "%(file_name)s"',
                    },
                    prompt='',
                    enabled=True,
                    syntax_file='',
                    help='remove the specified files on the next commit',
                    flags=0,
                    ),
    "rename": cmd_data(
                    invocations={
                        'rename... (this file)': 'rename "%(file_name)s" "%(input)s"',
                    },
                    prompt="New name:",
                    enabled=True,
                    syntax_file='',
                    help='rename files; equivalent of copy + remove',
                    flags=0,
                    ),
    "resolve": cmd_data(
                    invocations={
                        'resolve (this file)': 'resolve "%(file_name)s"',
                    },
                    prompt='',
                    enabled=True,
                    syntax_file='',
                    help='redo merges or set/view the merge status of files',
                    flags=0,
                    ),
    "revert": cmd_data(
                    invocations={
                        'revert (this file)': 'revert "%(file_name)s"',
                    },
                    prompt='',
                    enabled=True,
                    syntax_file='',
                    help='restore files to their checkout state',
                    flags=0,
                    ),
    "rollback": cmd_data(
                    invocations={},
                    prompt='',
                    enabled=True,
                    syntax_file='',
                    help='roll back the last transaction (dangerous)',
                    flags=0,
                    ),
    "root": cmd_data(
                    invocations={},
                    prompt='',
                    enabled=True,
                    syntax_file='',
                    help='print the root (top) of the current working directory',
                    flags=0,
                    ),
    "showconfig": cmd_data(
                    invocations={},
                    prompt='',
                    enabled=True,
                    syntax_file='',
                    help='show combined config settings from all hgrc files',
                    flags=0,
                    ),
    "status": cmd_data(
                    invocations={
                        'status (this file)': 'status "%(file_name)s"',
                        'status': 'status',
                    },
                    prompt='',
                    enabled=True,
                    syntax_file='Packages/Mercurial/Support/Mercurial Status Report.hidden-tmLanguage',
                    help='show changed files in the working directory',
                    flags=0,
                    ),
    "summary": cmd_data(
                    invocations={},
                    prompt='',
                    enabled=True,
                    syntax_file='',
                    help='summarize working directory state',
                    flags=0,
                    ),
    "tag": cmd_data(
                    invocations={
                        'tag...': 'tag "%(input)s"',
                    },
                    prompt="Tag name:",
                    enabled=True,
                    syntax_file='',
                    help='add one or more tags for the current or given revision',
                    flags=0,
                    ),
    "tags": cmd_data(
                    invocations={},
                    prompt='',
                    enabled=True,
                    syntax_file='',
                    help='list repository tags',
                    flags=0,
                    ),
    "tip": cmd_data(
                    invocations={},
                    prompt='',
                    enabled=True,
                    syntax_file='',
                    help='show the tip revision',
                    flags=0,
                    ),
    "update": cmd_data(
                    invocations={
                        'update...': 'update "%(input)s"',
                        'update': 'update',
                    },
                    prompt="Branch:",
                    enabled=True,
                    syntax_file='',
                    help='update working directory (or switch revisions)',
                    flags=0,
                    ),
    "verify": cmd_data(
                    invocations={},
                    prompt='',
                    enabled=True,
                    syntax_file='',
                    help='verify the integrity of the repository',
                    flags=0,
                    ),
    "version": cmd_data(
                    invocations={},
                    prompt='',
                    enabled=True,
                    syntax_file='',
                    help='output version and copyright information',
                    flags=0,
                    ),
    "serve": cmd_data(
                    invocations={
                        "serve": "serve"
                    },
                    prompt='',
                    enabled=True,
                    syntax_file='',
                    help='start stand-alone webserver',
                    flags=RUN_IN_OWN_CONSOLE,
                    ),
    "init": cmd_data(
                    invocations={
                        "init (this file's directory)": "init"
                    },
                    prompt='',<commit_msg>add graph command<commit_after>from collections import namedtuple


class CommandNotFoundError(Exception):
    pass


class AmbiguousCommandError(Exception):
    pass


cmd_data = namedtuple('cmd_data','invocations prompt enabled syntax_file help flags')

# Flags
RUN_IN_OWN_CONSOLE = 0x01

HG_COMMANDS = {}


HG_COMMANDS['default'] = {
    'commit': cmd_data(
                    invocations={
                        'commit...': 'commit -m "%(input)s"',
                        'commit... (this file)': 'commit "%(file_name)s" -m "%(input)s"',
                    },
                    prompt='Commit message:',
                    enabled=True,
                    syntax_file='',
                    help='commit the specified files or all outstanding changes',
                    flags=0,
                    ),
    'init': cmd_data(
                    invocations={
                        'init': 'init',
                    },
                    prompt='',
                    enabled=True,
                    syntax_file='',
                    help='create a new repository in the given directory',
                    flags=RUN_IN_OWN_CONSOLE,
                    ),
    'add': cmd_data(
                    invocations={
                        'add (this file)': 'add "%(file_name)s"',
                        'add': 'add',
                   },
                    prompt='',
                    enabled=True,
                    syntax_file='',
                    help='add the specified files on the next commit',
                    flags=0,
                    ),
    'addremove': cmd_data(
                    invocations={},
                    prompt='',
                    enabled=True,
                    syntax_file='',
                    help='add all new files, delete all missing files',
                    flags=0,
                    ),
    'annotate': cmd_data(
                    invocations={
                        'annotate | blame (this file)': 'annotate "%(file_name)s"',
                        'annotate | blame [full] (this file)': 'annotate -nudq "%(file_name)s"',
                   },
                    prompt='',
                    enabled=True,
                    syntax_file='Packages/Mercurial/Support/Mercurial Annotate.hidden-tmLanguage',
                    help='show changeset information by line for each file',
                    flags=0,
                    ),
    'bookmark': cmd_data(
                    invocations={
                        'bookmark... (parent revision)': 'bookmark "%(input)s"',
                    },
                    prompt='Bookmark name:',
                    enabled=True,
                    syntax_file='',
                    help='track a line of development with movable markers',
                    flags=0,
                    ),
    'bookmarks': cmd_data(
                    invocations={},
                    prompt='',
                    enabled=True,
                    syntax_file='',
                    help='track a line of development with movable markers',
                    flags=0,
                    ),
    'branch': cmd_data(
                    invocations={},
                    prompt='',
                    enabled=True,
                    syntax_file='',
                    help='set or show the current branch name',
                    flags=0,
                    ),
    'branches': cmd_data(
                    invocations={},
                    prompt='',
                    enabled=True,
                    syntax_file='',
                    help='list repository named branches',
                    flags=0,
                    ),
    'diff': cmd_data(
                    invocations={
                        'diff': 'diff',
                        'diff (this file)': 'diff "%(file_name)s"',
                        'diff [stat]': 'diff --stat',
                        'diff [stat] (this file)': 'diff "%(file_name)s" --stat',
                    },
                    prompt='',
                    enabled=True,
                    syntax_file='Packages/Diff/Diff.tmLanguage',
                    help='diff repository (or selected files)',
                    flags=0,
                    ),
    'forget': cmd_data(
                    invocations={
                        'forget (this file)': 'forget "%(file_name)s"',
                    },
                    prompt='',
                    enabled=True,
                    syntax_file='',
                    help='forget the specified files on the next commit',
                    flags=0,
                    ),
    'grep': cmd_data(
                    invocations={
                        'grep (tip)...': 'grep "%(input)s" -ur tip',
                        'grep (latest 5)...': 'grep "%(input)s" -ur "-5:tip"',
                        'grep (latest 10)...': 'grep "%(input)s" -ur "-10:tip"',
                        'grep (all)...': 'grep "%(input)s" -u',
                    },
                    prompt='Pattern (grep):',
                    enabled=True,
                    syntax_file='',
                    help='search for a pattern in specified files and revisions',
                    flags=0,
                    ),
    'heads': cmd_data(
                    invocations={},
                    prompt='',
                    enabled=True,
                    syntax_file='',
                    help='show current repository heads or show branch heads',
                    flags=0,
                    ),
    'help': cmd_data(
                    invocations={
                        'help...': 'help "%(input)s"',
                        'help': 'help',
                        },
                    prompt='Help topic:',
                    enabled=True,
                    syntax_file='',
                    help='show help for a given topic or a help overview',
                    flags=0,
                    ),
    'identify': cmd_data(
                    invocations={
                        'identify': 'identify -nibtB'
                    },
                    prompt='',
                    enabled=True,
                    syntax_file='',
                    help='identify the working copy or specified revision',
                    flags=0,
                    ),
    'incoming': cmd_data(
                    invocations={
                        'incoming...': 'incoming %(input)s',
                        'incoming': 'incoming',
                    },
                    prompt='Incoming source:',
                    enabled=True,
                    syntax_file='',
                    help='show new changesets found in source',
                    flags=RUN_IN_OWN_CONSOLE,
                    ),
    'locate': cmd_data(
                    invocations={
                        'locate...': 'locate "%(input)s"'
                    },
                    prompt='Pattern:',
                    enabled=True,
                    syntax_file='',
                    help='locate files matching specific patterns',
                    flags=0,
                    ),
    'log': cmd_data(
                    invocations={
                        'log (this file)': 'log "%(file_name)s"',
                        'log': 'log',
                    },
                    prompt='',
                    enabled=True,
                    syntax_file='Packages/Mercurial/Support/Mercurial Log.hidden-tmLanguage',
                    help='show revision history of entire repository or files',
                    flags=0,
                    ),
    'manifest': cmd_data(
                    invocations={},
                    prompt='',
                    enabled=True,
                    syntax_file='',
                    help='output the current or given revision of the project manifest',
                    flags=0,
                    ),
    'merge': cmd_data(
                    invocations={
                        'merge...': 'merge "%(input)s"',
                        'merge': 'merge',
                    },
                    prompt='',
                    enabled=True,
                    syntax_file='',
                    help='merge working directory with another revision',
                    flags=0,
                    ),
    'outgoing': cmd_data(
                    invocations={
                        'outgoing...': 'outgoing %(input)s',
                        'outgoing': 'outgoing',
                    },
                    prompt='Outgoing target:',
                    enabled=True,
                    syntax_file='Packages/Mercurial/Support/Mercurial Log.hidden-tmLanguage',
                    help='show changesets not found in the destination',
                    flags=RUN_IN_OWN_CONSOLE,
                    ),
    'parents': cmd_data(
                    invocations={},
                    prompt='',
                    enabled=True,
                    syntax_file='',
                    help='show the parents of the working directory or revision',
                    flags=0,
                    ),
    'paths': cmd_data(
                    invocations={},
                    prompt='',
                    enabled=True,
                    syntax_file='',
                    help='show aliases for remote repositories',
                    flags=0,
                    ),
    'pull': cmd_data(
                    invocations={
                        'pull...': 'pull %(input)s',
                        'pull': 'pull',
                    },
                    prompt='Pull source:',
                    enabled=True,
                    syntax_file='',
                    help='pull changes from the specified source',
                    flags=RUN_IN_OWN_CONSOLE,
                    ),
    "push": cmd_data(
                    invocations={
                        'push...': 'push %(input)s',
                        'push': 'push',
                    },
                    prompt="Push target:",
                    enabled=True,
                    syntax_file='',
                    help='push changes to the specified destination',
                    flags=RUN_IN_OWN_CONSOLE,
                    ),
    "recover": cmd_data(
                    invocations={},
                    prompt='',
                    enabled=True,
                    syntax_file='',
                    help='roll back an interrupted transaction',
                    flags=0,
                    ),
    "remove": cmd_data(
                    invocations={
                        'remove (this file)': 'remove "%(file_name)s"',
                    },
                    prompt='',
                    enabled=True,
                    syntax_file='',
                    help='remove the specified files on the next commit',
                    flags=0,
                    ),
    "rename": cmd_data(
                    invocations={
                        'rename... (this file)': 'rename "%(file_name)s" "%(input)s"',
                    },
                    prompt="New name:",
                    enabled=True,
                    syntax_file='',
                    help='rename files; equivalent of copy + remove',
                    flags=0,
                    ),
    "resolve": cmd_data(
                    invocations={
                        'resolve (this file)': 'resolve "%(file_name)s"',
                    },
                    prompt='',
                    enabled=True,
                    syntax_file='',
                    help='redo merges or set/view the merge status of files',
                    flags=0,
                    ),
    "revert": cmd_data(
                    invocations={
                        'revert (this file)': 'revert "%(file_name)s"',
                    },
                    prompt='',
                    enabled=True,
                    syntax_file='',
                    help='restore files to their checkout state',
                    flags=0,
                    ),
    "rollback": cmd_data(
                    invocations={},
                    prompt='',
                    enabled=True,
                    syntax_file='',
                    help='roll back the last transaction (dangerous)',
                    flags=0,
                    ),
    "root": cmd_data(
                    invocations={},
                    prompt='',
                    enabled=True,
                    syntax_file='',
                    help='print the root (top) of the current working directory',
                    flags=0,
                    ),
    "showconfig": cmd_data(
                    invocations={},
                    prompt='',
                    enabled=True,
                    syntax_file='',
                    help='show combined config settings from all hgrc files',
                    flags=0,
                    ),
    "status": cmd_data(
                    invocations={
                        'status (this file)': 'status "%(file_name)s"',
                        'status': 'status',
                    },
                    prompt='',
                    enabled=True,
                    syntax_file='Packages/Mercurial/Support/Mercurial Status Report.hidden-tmLanguage',
                    help='show changed files in the working directory',
                    flags=0,
                    ),
    "summary": cmd_data(
                    invocations={},
                    prompt='',
                    enabled=True,
                    syntax_file='',
                    help='summarize working directory state',
                    flags=0,
                    ),
    "tag": cmd_data(
                    invocations={
                        'tag...': 'tag "%(input)s"',
                    },
                    prompt="Tag name:",
                    enabled=True,
                    syntax_file='',
                    help='add one or more tags for the current or given revision',
                    flags=0,
                    ),
    "tags": cmd_data(
                    invocations={},
                    prompt='',
                    enabled=True,
                    syntax_file='',
                    help='list repository tags',
                    flags=0,
                    ),
    "tip": cmd_data(
                    invocations={},
                    prompt='',
                    enabled=True,
                    syntax_file='',
                    help='show the tip revision',
                    flags=0,
                    ),
    "update": cmd_data(
                    invocations={
                        'update...': 'update "%(input)s"',
                        'update': 'update',
                    },
                    prompt="Branch:",
                    enabled=True,
                    syntax_file='',
                    help='update working directory (or switch revisions)',
                    flags=0,
                    ),
    "verify": cmd_data(
                    invocations={},
                    prompt='',
                    enabled=True,
                    syntax_file='',
                    help='verify the integrity of the repository',
                    flags=0,
                    ),
    "version": cmd_data(
                    invocations={},
                    prompt='',
                    enabled=True,
                    syntax_file='',
                    help='output version and copyright information',
                    flags=0,
                    ),
    "serve": cmd_data(
                    invocations={
                        "serve": "serve"
                    },
                    prompt='',
                    enabled=True,
                    syntax_file='',
                    help='start stand-alone webserver',
                    flags=RUN_IN_OWN_CONSOLE,
                    ),
    "graph": cmd_data(
                    invocations={
                        "glog (5 revs)": "log -G -l5",
                        "glog (10 revs)": "log -G -l10",
                        "glog (15 revs)": "log -G -l15",
                        "glog (30 revs)": "log -G -l30",
                    },
                    prompt='',
                    enabled=True,
                    syntax_file='',
                    help='start stand-alone webserver',
                    flags=RUN_IN_OWN_CONSOLE,
                    ),
    "init": cmd_data(
                    invocations={
                        "init (this file's directory)": "init"
                    },
                    prompt='',
{'fraction_non_alphanumeric': 0.10602358115950883, 'fraction_numerical': 0.0031767365141425865, 'mean_word_length': 0.859114139693356, 'pattern_counts': {'":': 47, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5678764', 'n_tokens_mistral': 7786, 'n_tokens_neox': 6899, 'n_words': 1627}