mercurial/commands.py
changeset 14297 2daa5179e73f
parent 14291 1a791993ce59
child 14302 b0f97b2589cc
equal deleted inserted replaced
14296:62e25c63fb3a 14297:2daa5179e73f
    15 import merge as mergemod
    15 import merge as mergemod
    16 import minirst, revset, templatefilters
    16 import minirst, revset, templatefilters
    17 import dagparser, context, simplemerge
    17 import dagparser, context, simplemerge
    18 import random, setdiscovery, treediscovery, dagutil
    18 import random, setdiscovery, treediscovery, dagutil
    19 
    19 
       
    20 table = {}
       
    21 
       
    22 command = cmdutil.command(table)
       
    23 
       
    24 # common command options
       
    25 
       
    26 globalopts = [
       
    27     ('R', 'repository', '',
       
    28      _('repository root directory or name of overlay bundle file'),
       
    29      _('REPO')),
       
    30     ('', 'cwd', '',
       
    31      _('change working directory'), _('DIR')),
       
    32     ('y', 'noninteractive', None,
       
    33      _('do not prompt, assume \'yes\' for any required answers')),
       
    34     ('q', 'quiet', None, _('suppress output')),
       
    35     ('v', 'verbose', None, _('enable additional output')),
       
    36     ('', 'config', [],
       
    37      _('set/override config option (use \'section.name=value\')'),
       
    38      _('CONFIG')),
       
    39     ('', 'debug', None, _('enable debugging output')),
       
    40     ('', 'debugger', None, _('start debugger')),
       
    41     ('', 'encoding', encoding.encoding, _('set the charset encoding'),
       
    42      _('ENCODE')),
       
    43     ('', 'encodingmode', encoding.encodingmode,
       
    44      _('set the charset encoding mode'), _('MODE')),
       
    45     ('', 'traceback', None, _('always print a traceback on exception')),
       
    46     ('', 'time', None, _('time how long the command takes')),
       
    47     ('', 'profile', None, _('print command execution profile')),
       
    48     ('', 'version', None, _('output version information and exit')),
       
    49     ('h', 'help', None, _('display help and exit')),
       
    50 ]
       
    51 
       
    52 dryrunopts = [('n', 'dry-run', None,
       
    53                _('do not perform actions, just print output'))]
       
    54 
       
    55 remoteopts = [
       
    56     ('e', 'ssh', '',
       
    57      _('specify ssh command to use'), _('CMD')),
       
    58     ('', 'remotecmd', '',
       
    59      _('specify hg command to run on the remote side'), _('CMD')),
       
    60     ('', 'insecure', None,
       
    61      _('do not verify server certificate (ignoring web.cacerts config)')),
       
    62 ]
       
    63 
       
    64 walkopts = [
       
    65     ('I', 'include', [],
       
    66      _('include names matching the given patterns'), _('PATTERN')),
       
    67     ('X', 'exclude', [],
       
    68      _('exclude names matching the given patterns'), _('PATTERN')),
       
    69 ]
       
    70 
       
    71 commitopts = [
       
    72     ('m', 'message', '',
       
    73      _('use text as commit message'), _('TEXT')),
       
    74     ('l', 'logfile', '',
       
    75      _('read commit message from file'), _('FILE')),
       
    76 ]
       
    77 
       
    78 commitopts2 = [
       
    79     ('d', 'date', '',
       
    80      _('record the specified date as commit date'), _('DATE')),
       
    81     ('u', 'user', '',
       
    82      _('record the specified user as committer'), _('USER')),
       
    83 ]
       
    84 
       
    85 templateopts = [
       
    86     ('', 'style', '',
       
    87      _('display using template map file'), _('STYLE')),
       
    88     ('', 'template', '',
       
    89      _('display with template'), _('TEMPLATE')),
       
    90 ]
       
    91 
       
    92 logopts = [
       
    93     ('p', 'patch', None, _('show patch')),
       
    94     ('g', 'git', None, _('use git extended diff format')),
       
    95     ('l', 'limit', '',
       
    96      _('limit number of changes displayed'), _('NUM')),
       
    97     ('M', 'no-merges', None, _('do not show merges')),
       
    98     ('', 'stat', None, _('output diffstat-style summary of changes')),
       
    99 ] + templateopts
       
   100 
       
   101 diffopts = [
       
   102     ('a', 'text', None, _('treat all files as text')),
       
   103     ('g', 'git', None, _('use git extended diff format')),
       
   104     ('', 'nodates', None, _('omit dates from diff headers'))
       
   105 ]
       
   106 
       
   107 diffopts2 = [
       
   108     ('p', 'show-function', None, _('show which function each change is in')),
       
   109     ('', 'reverse', None, _('produce a diff that undoes the changes')),
       
   110     ('w', 'ignore-all-space', None,
       
   111      _('ignore white space when comparing lines')),
       
   112     ('b', 'ignore-space-change', None,
       
   113      _('ignore changes in the amount of white space')),
       
   114     ('B', 'ignore-blank-lines', None,
       
   115      _('ignore changes whose lines are all blank')),
       
   116     ('U', 'unified', '',
       
   117      _('number of lines of context to show'), _('NUM')),
       
   118     ('', 'stat', None, _('output diffstat-style summary of changes')),
       
   119 ]
       
   120 
       
   121 similarityopts = [
       
   122     ('s', 'similarity', '',
       
   123      _('guess renamed files by similarity (0<=s<=100)'), _('SIMILARITY'))
       
   124 ]
       
   125 
       
   126 subrepoopts = [
       
   127     ('S', 'subrepos', None,
       
   128      _('recurse into subrepositories'))
       
   129 ]
       
   130 
    20 # Commands start here, listed alphabetically
   131 # Commands start here, listed alphabetically
    21 
   132 
       
   133 @command('^add',
       
   134     walkopts + subrepoopts + dryrunopts,
       
   135     _('[OPTION]... [FILE]...'))
    22 def add(ui, repo, *pats, **opts):
   136 def add(ui, repo, *pats, **opts):
    23     """add the specified files on the next commit
   137     """add the specified files on the next commit
    24 
   138 
    25     Schedule files to be version controlled and added to the
   139     Schedule files to be version controlled and added to the
    26     repository.
   140     repository.
    50     m = cmdutil.match(repo, pats, opts)
   164     m = cmdutil.match(repo, pats, opts)
    51     rejected = cmdutil.add(ui, repo, m, opts.get('dry_run'),
   165     rejected = cmdutil.add(ui, repo, m, opts.get('dry_run'),
    52                            opts.get('subrepos'), prefix="")
   166                            opts.get('subrepos'), prefix="")
    53     return rejected and 1 or 0
   167     return rejected and 1 or 0
    54 
   168 
       
   169 @command('addremove',
       
   170     similarityopts + walkopts + dryrunopts,
       
   171     _('[OPTION]... [FILE]...'))
    55 def addremove(ui, repo, *pats, **opts):
   172 def addremove(ui, repo, *pats, **opts):
    56     """add all new files, delete all missing files
   173     """add all new files, delete all missing files
    57 
   174 
    58     Add all new files and remove all missing files from the
   175     Add all new files and remove all missing files from the
    59     repository.
   176     repository.
    78         raise util.Abort(_('similarity must be a number'))
   195         raise util.Abort(_('similarity must be a number'))
    79     if sim < 0 or sim > 100:
   196     if sim < 0 or sim > 100:
    80         raise util.Abort(_('similarity must be between 0 and 100'))
   197         raise util.Abort(_('similarity must be between 0 and 100'))
    81     return cmdutil.addremove(repo, pats, opts, similarity=sim / 100.0)
   198     return cmdutil.addremove(repo, pats, opts, similarity=sim / 100.0)
    82 
   199 
       
   200 @command('^annotate|blame',
       
   201     [('r', 'rev', '', _('annotate the specified revision'), _('REV')),
       
   202     ('', 'follow', None,
       
   203      _('follow copies/renames and list the filename (DEPRECATED)')),
       
   204     ('', 'no-follow', None, _("don't follow copies and renames")),
       
   205     ('a', 'text', None, _('treat all files as text')),
       
   206     ('u', 'user', None, _('list the author (long with -v)')),
       
   207     ('f', 'file', None, _('list the filename')),
       
   208     ('d', 'date', None, _('list the date (short with -q)')),
       
   209     ('n', 'number', None, _('list the revision number (default)')),
       
   210     ('c', 'changeset', None, _('list the changeset')),
       
   211     ('l', 'line-number', None, _('show line number at the first appearance'))
       
   212     ] + walkopts,
       
   213     _('[-r REV] [-f] [-a] [-u] [-d] [-n] [-c] [-l] FILE...'))
    83 def annotate(ui, repo, *pats, **opts):
   214 def annotate(ui, repo, *pats, **opts):
    84     """show changeset information by line for each file
   215     """show changeset information by line for each file
    85 
   216 
    86     List changes in files, showing the revision id responsible for
   217     List changes in files, showing the revision id responsible for
    87     each line
   218     each line
   152 
   283 
   153         if pieces:
   284         if pieces:
   154             for p, l in zip(zip(*pieces), lines):
   285             for p, l in zip(zip(*pieces), lines):
   155                 ui.write("%s: %s" % (" ".join(p), l[1]))
   286                 ui.write("%s: %s" % (" ".join(p), l[1]))
   156 
   287 
       
   288 @command('archive',
       
   289     [('', 'no-decode', None, _('do not pass files through decoders')),
       
   290     ('p', 'prefix', '', _('directory prefix for files in archive'),
       
   291      _('PREFIX')),
       
   292     ('r', 'rev', '', _('revision to distribute'), _('REV')),
       
   293     ('t', 'type', '', _('type of distribution to create'), _('TYPE')),
       
   294     ] + subrepoopts + walkopts,
       
   295     _('[OPTION]... DEST'))
   157 def archive(ui, repo, dest, **opts):
   296 def archive(ui, repo, dest, **opts):
   158     '''create an unversioned archive of a repository revision
   297     '''create an unversioned archive of a repository revision
   159 
   298 
   160     By default, the revision used is the parent of the working
   299     By default, the revision used is the parent of the working
   161     directory; use -r/--rev to specify a different revision.
   300     directory; use -r/--rev to specify a different revision.
   204     prefix = cmdutil.makefilename(repo, prefix, node)
   343     prefix = cmdutil.makefilename(repo, prefix, node)
   205     matchfn = cmdutil.match(repo, [], opts)
   344     matchfn = cmdutil.match(repo, [], opts)
   206     archival.archive(repo, dest, node, kind, not opts.get('no_decode'),
   345     archival.archive(repo, dest, node, kind, not opts.get('no_decode'),
   207                      matchfn, prefix, subrepos=opts.get('subrepos'))
   346                      matchfn, prefix, subrepos=opts.get('subrepos'))
   208 
   347 
       
   348 @command('backout',
       
   349     [('', 'merge', None, _('merge with old dirstate parent after backout')),
       
   350     ('', 'parent', '', _('parent to choose when backing out merge'), _('REV')),
       
   351     ('t', 'tool', '', _('specify merge tool')),
       
   352     ('r', 'rev', '', _('revision to backout'), _('REV')),
       
   353     ] + walkopts + commitopts + commitopts2,
       
   354     _('[OPTION]... [-r] REV'))
   209 def backout(ui, repo, node=None, rev=None, **opts):
   355 def backout(ui, repo, node=None, rev=None, **opts):
   210     '''reverse effect of earlier changeset
   356     '''reverse effect of earlier changeset
   211 
   357 
   212     Prepare a new changeset with the effect of REV undone in the
   358     Prepare a new changeset with the effect of REV undone in the
   213     current working directory.
   359     current working directory.
   305             return hg.merge(repo, hex(repo.changelog.tip()))
   451             return hg.merge(repo, hex(repo.changelog.tip()))
   306         finally:
   452         finally:
   307             ui.setconfig('ui', 'forcemerge', '')
   453             ui.setconfig('ui', 'forcemerge', '')
   308     return 0
   454     return 0
   309 
   455 
       
   456 @command('bisect',
       
   457     [('r', 'reset', False, _('reset bisect state')),
       
   458     ('g', 'good', False, _('mark changeset good')),
       
   459     ('b', 'bad', False, _('mark changeset bad')),
       
   460     ('s', 'skip', False, _('skip testing changeset')),
       
   461     ('e', 'extend', False, _('extend the bisect range')),
       
   462     ('c', 'command', '', _('use command to check changeset state'), _('CMD')),
       
   463     ('U', 'noupdate', False, _('do not update to target'))],
       
   464     _("[-gbsr] [-U] [-c CMD] [REV]"))
   310 def bisect(ui, repo, rev=None, extra=None, command=None,
   465 def bisect(ui, repo, rev=None, extra=None, command=None,
   311                reset=None, good=None, bad=None, skip=None, extend=None,
   466                reset=None, good=None, bad=None, skip=None, extend=None,
   312                noupdate=None):
   467                noupdate=None):
   313     """subdivision search of changesets
   468     """subdivision search of changesets
   314 
   469 
   481                  % (rev, short(node), changesets, tests))
   636                  % (rev, short(node), changesets, tests))
   482         if not noupdate:
   637         if not noupdate:
   483             cmdutil.bailifchanged(repo)
   638             cmdutil.bailifchanged(repo)
   484             return hg.clean(repo, node)
   639             return hg.clean(repo, node)
   485 
   640 
       
   641 @command('bookmarks',
       
   642     [('f', 'force', False, _('force')),
       
   643     ('r', 'rev', '', _('revision'), _('REV')),
       
   644     ('d', 'delete', False, _('delete a given bookmark')),
       
   645     ('m', 'rename', '', _('rename a given bookmark'), _('NAME')),
       
   646     ('i', 'inactive', False, _('do not mark a new bookmark active'))],
       
   647     _('hg bookmarks [-f] [-d] [-i] [-m NAME] [-r REV] [NAME]'))
   486 def bookmark(ui, repo, mark=None, rev=None, force=False, delete=False,
   648 def bookmark(ui, repo, mark=None, rev=None, force=False, delete=False,
   487              rename=None, inactive=False):
   649              rename=None, inactive=False):
   488     '''track a line of development with movable markers
   650     '''track a line of development with movable markers
   489 
   651 
   490     Bookmarks are pointers to certain commits that move when
   652     Bookmarks are pointers to certain commits that move when
   577                     ui.write(" %s %-25s %d:%s\n" % (
   739                     ui.write(" %s %-25s %d:%s\n" % (
   578                         prefix, bmark, repo.changelog.rev(n), hexfn(n)),
   740                         prefix, bmark, repo.changelog.rev(n), hexfn(n)),
   579                         label=label)
   741                         label=label)
   580         return
   742         return
   581 
   743 
       
   744 @command('branch',
       
   745     [('f', 'force', None,
       
   746      _('set branch name even if it shadows an existing branch')),
       
   747     ('C', 'clean', None, _('reset branch name to parent branch name'))],
       
   748     _('[-fC] [NAME]'))
   582 def branch(ui, repo, label=None, **opts):
   749 def branch(ui, repo, label=None, **opts):
   583     """set or show the current branch name
   750     """set or show the current branch name
   584 
   751 
   585     With no argument, show the current branch name. With one argument,
   752     With no argument, show the current branch name. With one argument,
   586     set the working directory branch name (the branch will not exist
   753     set the working directory branch name (the branch will not exist
   614         repo.dirstate.setbranch(label)
   781         repo.dirstate.setbranch(label)
   615         ui.status(_('marked working directory as branch %s\n') % label)
   782         ui.status(_('marked working directory as branch %s\n') % label)
   616     else:
   783     else:
   617         ui.write("%s\n" % repo.dirstate.branch())
   784         ui.write("%s\n" % repo.dirstate.branch())
   618 
   785 
       
   786 @command('branches',
       
   787     [('a', 'active', False, _('show only branches that have unmerged heads')),
       
   788     ('c', 'closed', False, _('show normal and closed branches'))],
       
   789     _('[-ac]'))
   619 def branches(ui, repo, active=False, closed=False):
   790 def branches(ui, repo, active=False, closed=False):
   620     """list repository named branches
   791     """list repository named branches
   621 
   792 
   622     List the repository's named branches, indicating which ones are
   793     List the repository's named branches, indicating which ones are
   623     inactive. If -c/--closed is specified, also list branches which have
   794     inactive. If -c/--closed is specified, also list branches which have
   663                 rev = str(node).rjust(31 - encoding.colwidth(tag))
   834                 rev = str(node).rjust(31 - encoding.colwidth(tag))
   664                 rev = ui.label('%s:%s' % (rev, hexfunc(hn)), 'log.changeset')
   835                 rev = ui.label('%s:%s' % (rev, hexfunc(hn)), 'log.changeset')
   665                 tag = ui.label(tag, label)
   836                 tag = ui.label(tag, label)
   666                 ui.write("%s %s%s\n" % (tag, rev, notice))
   837                 ui.write("%s %s%s\n" % (tag, rev, notice))
   667 
   838 
       
   839 @command('bundle',
       
   840     [('f', 'force', None, _('run even when the destination is unrelated')),
       
   841     ('r', 'rev', [], _('a changeset intended to be added to the destination'),
       
   842      _('REV')),
       
   843     ('b', 'branch', [], _('a specific branch you would like to bundle'),
       
   844      _('BRANCH')),
       
   845     ('', 'base', [],
       
   846      _('a base changeset assumed to be available at the destination'),
       
   847      _('REV')),
       
   848     ('a', 'all', None, _('bundle all changesets in the repository')),
       
   849     ('t', 'type', 'bzip2', _('bundle compression type to use'), _('TYPE')),
       
   850     ] + remoteopts,
       
   851     _('[-f] [-t TYPE] [-a] [-r REV]... [--base REV]... FILE [DEST]'))
   668 def bundle(ui, repo, fname, dest=None, **opts):
   852 def bundle(ui, repo, fname, dest=None, **opts):
   669     """create a changegroup file
   853     """create a changegroup file
   670 
   854 
   671     Generate a compressed changegroup file collecting changesets not
   855     Generate a compressed changegroup file collecting changesets not
   672     known to be in another repository.
   856     known to be in another repository.
   725     if bundletype not in changegroup.bundletypes:
   909     if bundletype not in changegroup.bundletypes:
   726         raise util.Abort(_('unknown bundle type specified with --type'))
   910         raise util.Abort(_('unknown bundle type specified with --type'))
   727 
   911 
   728     changegroup.writebundle(cg, fname, bundletype)
   912     changegroup.writebundle(cg, fname, bundletype)
   729 
   913 
       
   914 @command('cat',
       
   915     [('o', 'output', '',
       
   916      _('print output to file with formatted name'), _('FORMAT')),
       
   917     ('r', 'rev', '', _('print the given revision'), _('REV')),
       
   918     ('', 'decode', None, _('apply any matching decode filter')),
       
   919     ] + walkopts,
       
   920     _('[OPTION]... FILE...'))
   730 def cat(ui, repo, file1, *pats, **opts):
   921 def cat(ui, repo, file1, *pats, **opts):
   731     """output the current or given revision of files
   922     """output the current or given revision of files
   732 
   923 
   733     Print the specified files as they were at the given revision. If
   924     Print the specified files as they were at the given revision. If
   734     no revision is given, the parent of the working directory is used,
   925     no revision is given, the parent of the working directory is used,
   756         fp.write(data)
   947         fp.write(data)
   757         fp.close()
   948         fp.close()
   758         err = 0
   949         err = 0
   759     return err
   950     return err
   760 
   951 
       
   952 @command('^clone',
       
   953     [('U', 'noupdate', None,
       
   954      _('the clone will include an empty working copy (only a repository)')),
       
   955     ('u', 'updaterev', '', _('revision, tag or branch to check out'), _('REV')),
       
   956     ('r', 'rev', [], _('include the specified changeset'), _('REV')),
       
   957     ('b', 'branch', [], _('clone only the specified branch'), _('BRANCH')),
       
   958     ('', 'pull', None, _('use pull protocol to copy metadata')),
       
   959     ('', 'uncompressed', None, _('use uncompressed transfer (fast over LAN)')),
       
   960     ] + remoteopts,
       
   961     _('[OPTION]... SOURCE [DEST]'))
   761 def clone(ui, source, dest=None, **opts):
   962 def clone(ui, source, dest=None, **opts):
   762     """make a copy of an existing repository
   963     """make a copy of an existing repository
   763 
   964 
   764     Create a copy of an existing repository in a new directory.
   965     Create a copy of an existing repository in a new directory.
   765 
   966 
   832                  update=opts.get('updaterev') or not opts.get('noupdate'),
  1033                  update=opts.get('updaterev') or not opts.get('noupdate'),
   833                  branch=opts.get('branch'))
  1034                  branch=opts.get('branch'))
   834 
  1035 
   835     return r is None
  1036     return r is None
   836 
  1037 
       
  1038 @command('^commit|ci',
       
  1039     [('A', 'addremove', None,
       
  1040      _('mark new/missing files as added/removed before committing')),
       
  1041     ('', 'close-branch', None,
       
  1042      _('mark a branch as closed, hiding it from the branch list')),
       
  1043     ] + walkopts + commitopts + commitopts2,
       
  1044     _('[OPTION]... [FILE]...'))
   837 def commit(ui, repo, *pats, **opts):
  1045 def commit(ui, repo, *pats, **opts):
   838     """commit the specified files or all outstanding changes
  1046     """commit the specified files or all outstanding changes
   839 
  1047 
   840     Commit changes to the given files into the repository. Unlike a
  1048     Commit changes to the given files into the repository. Unlike a
   841     centralized SCM, this operation is a local operation. See
  1049     centralized SCM, this operation is a local operation. See
   927     if ui.debugflag:
  1135     if ui.debugflag:
   928         ui.write(_('committed changeset %d:%s\n') % (int(ctx), ctx.hex()))
  1136         ui.write(_('committed changeset %d:%s\n') % (int(ctx), ctx.hex()))
   929     elif ui.verbose:
  1137     elif ui.verbose:
   930         ui.write(_('committed changeset %d:%s\n') % (int(ctx), ctx))
  1138         ui.write(_('committed changeset %d:%s\n') % (int(ctx), ctx))
   931 
  1139 
       
  1140 @command('copy|cp',
       
  1141     [('A', 'after', None, _('record a copy that has already occurred')),
       
  1142     ('f', 'force', None, _('forcibly copy over an existing managed file')),
       
  1143     ] + walkopts + dryrunopts,
       
  1144     _('[OPTION]... [SOURCE]... DEST'))
   932 def copy(ui, repo, *pats, **opts):
  1145 def copy(ui, repo, *pats, **opts):
   933     """mark files as copied for the next commit
  1146     """mark files as copied for the next commit
   934 
  1147 
   935     Mark dest as having copies of source files. If dest is a
  1148     Mark dest as having copies of source files. If dest is a
   936     directory, copies are put in that directory. If dest is a file,
  1149     directory, copies are put in that directory. If dest is a file,
   949     try:
  1162     try:
   950         return cmdutil.copy(ui, repo, pats, opts)
  1163         return cmdutil.copy(ui, repo, pats, opts)
   951     finally:
  1164     finally:
   952         wlock.release()
  1165         wlock.release()
   953 
  1166 
       
  1167 @command('debugancestor', [], _('[INDEX] REV1 REV2'))
   954 def debugancestor(ui, repo, *args):
  1168 def debugancestor(ui, repo, *args):
   955     """find the ancestor revision of two revisions in a given index"""
  1169     """find the ancestor revision of two revisions in a given index"""
   956     if len(args) == 3:
  1170     if len(args) == 3:
   957         index, rev1, rev2 = args
  1171         index, rev1, rev2 = args
   958         r = revlog.revlog(scmutil.opener(os.getcwd(), audit=False), index)
  1172         r = revlog.revlog(scmutil.opener(os.getcwd(), audit=False), index)
   967     else:
  1181     else:
   968         raise util.Abort(_('either two or three arguments required'))
  1182         raise util.Abort(_('either two or three arguments required'))
   969     a = r.ancestor(lookup(rev1), lookup(rev2))
  1183     a = r.ancestor(lookup(rev1), lookup(rev2))
   970     ui.write("%d:%s\n" % (r.rev(a), hex(a)))
  1184     ui.write("%d:%s\n" % (r.rev(a), hex(a)))
   971 
  1185 
       
  1186 @command('debugbuilddag',
       
  1187     [('m', 'mergeable-file', None, _('add single file mergeable changes')),
       
  1188     ('o', 'overwritten-file', None, _('add single file all revs overwrite')),
       
  1189     ('n', 'new-file', None, _('add new file at each rev'))],
       
  1190     _('[OPTION]... [TEXT]'))
   972 def debugbuilddag(ui, repo, text=None,
  1191 def debugbuilddag(ui, repo, text=None,
   973                   mergeable_file=False,
  1192                   mergeable_file=False,
   974                   overwritten_file=False,
  1193                   overwritten_file=False,
   975                   new_file=False):
  1194                   new_file=False):
   976     """builds a repo with a given DAG from scratch in the current empty repo
  1195     """builds a repo with a given DAG from scratch in the current empty repo
  1109         tr.release()
  1328         tr.release()
  1110 
  1329 
  1111     if tags:
  1330     if tags:
  1112         repo.opener.write("localtags", "".join(tags))
  1331         repo.opener.write("localtags", "".join(tags))
  1113 
  1332 
       
  1333 @command('debugcommands', [], _('[COMMAND]'))
  1114 def debugcommands(ui, cmd='', *args):
  1334 def debugcommands(ui, cmd='', *args):
  1115     """list all available commands and options"""
  1335     """list all available commands and options"""
  1116     for cmd, vals in sorted(table.iteritems()):
  1336     for cmd, vals in sorted(table.iteritems()):
  1117         cmd = cmd.split('|')[0].strip('^')
  1337         cmd = cmd.split('|')[0].strip('^')
  1118         opts = ', '.join([i[1] for i in vals[1]])
  1338         opts = ', '.join([i[1] for i in vals[1]])
  1119         ui.write('%s: %s\n' % (cmd, opts))
  1339         ui.write('%s: %s\n' % (cmd, opts))
  1120 
  1340 
       
  1341 @command('debugcomplete',
       
  1342     [('o', 'options', None, _('show the command options'))],
       
  1343     _('[-o] CMD'))
  1121 def debugcomplete(ui, cmd='', **opts):
  1344 def debugcomplete(ui, cmd='', **opts):
  1122     """returns the completion list associated with the given command"""
  1345     """returns the completion list associated with the given command"""
  1123 
  1346 
  1124     if opts.get('options'):
  1347     if opts.get('options'):
  1125         options = []
  1348         options = []
  1140     cmdlist = cmdutil.findpossible(cmd, table)
  1363     cmdlist = cmdutil.findpossible(cmd, table)
  1141     if ui.verbose:
  1364     if ui.verbose:
  1142         cmdlist = [' '.join(c[0]) for c in cmdlist.values()]
  1365         cmdlist = [' '.join(c[0]) for c in cmdlist.values()]
  1143     ui.write("%s\n" % "\n".join(sorted(cmdlist)))
  1366     ui.write("%s\n" % "\n".join(sorted(cmdlist)))
  1144 
  1367 
       
  1368 @command('debugfsinfo', [], _('[PATH]'))
  1145 def debugfsinfo(ui, path = "."):
  1369 def debugfsinfo(ui, path = "."):
  1146     """show information detected about current filesystem"""
  1370     """show information detected about current filesystem"""
  1147     util.writefile('.debugfsinfo', '')
  1371     util.writefile('.debugfsinfo', '')
  1148     ui.write('exec: %s\n' % (util.checkexec(path) and 'yes' or 'no'))
  1372     ui.write('exec: %s\n' % (util.checkexec(path) and 'yes' or 'no'))
  1149     ui.write('symlink: %s\n' % (util.checklink(path) and 'yes' or 'no'))
  1373     ui.write('symlink: %s\n' % (util.checklink(path) and 'yes' or 'no'))
  1150     ui.write('case-sensitive: %s\n' % (util.checkcase('.debugfsinfo')
  1374     ui.write('case-sensitive: %s\n' % (util.checkcase('.debugfsinfo')
  1151                                 and 'yes' or 'no'))
  1375                                 and 'yes' or 'no'))
  1152     os.unlink('.debugfsinfo')
  1376     os.unlink('.debugfsinfo')
  1153 
  1377 
       
  1378 @command('debugrebuildstate',
       
  1379     [('r', 'rev', '', _('revision to rebuild to'), _('REV'))],
       
  1380     _('[-r REV] [REV]'))
  1154 def debugrebuildstate(ui, repo, rev="tip"):
  1381 def debugrebuildstate(ui, repo, rev="tip"):
  1155     """rebuild the dirstate as it would look like for the given revision"""
  1382     """rebuild the dirstate as it would look like for the given revision"""
  1156     ctx = cmdutil.revsingle(repo, rev)
  1383     ctx = cmdutil.revsingle(repo, rev)
  1157     wlock = repo.wlock()
  1384     wlock = repo.wlock()
  1158     try:
  1385     try:
  1159         repo.dirstate.rebuild(ctx.node(), ctx.manifest())
  1386         repo.dirstate.rebuild(ctx.node(), ctx.manifest())
  1160     finally:
  1387     finally:
  1161         wlock.release()
  1388         wlock.release()
  1162 
  1389 
       
  1390 @command('debugcheckstate', [], '')
  1163 def debugcheckstate(ui, repo):
  1391 def debugcheckstate(ui, repo):
  1164     """validate the correctness of the current dirstate"""
  1392     """validate the correctness of the current dirstate"""
  1165     parent1, parent2 = repo.dirstate.parents()
  1393     parent1, parent2 = repo.dirstate.parents()
  1166     m1 = repo[parent1].manifest()
  1394     m1 = repo[parent1].manifest()
  1167     m2 = repo[parent2].manifest()
  1395     m2 = repo[parent2].manifest()
  1185             errors += 1
  1413             errors += 1
  1186     if errors:
  1414     if errors:
  1187         error = _(".hg/dirstate inconsistent with current parent's manifest")
  1415         error = _(".hg/dirstate inconsistent with current parent's manifest")
  1188         raise util.Abort(error)
  1416         raise util.Abort(error)
  1189 
  1417 
       
  1418 @command('showconfig|debugconfig',
       
  1419     [('u', 'untrusted', None, _('show untrusted configuration options'))],
       
  1420     _('[-u] [NAME]...'))
  1190 def showconfig(ui, repo, *values, **opts):
  1421 def showconfig(ui, repo, *values, **opts):
  1191     """show combined config settings from all hgrc files
  1422     """show combined config settings from all hgrc files
  1192 
  1423 
  1193     With no arguments, print names and values of all config items.
  1424     With no arguments, print names and values of all config items.
  1194 
  1425 
  1228         else:
  1459         else:
  1229             ui.debug('%s: ' %
  1460             ui.debug('%s: ' %
  1230                      ui.configsource(section, name, untrusted))
  1461                      ui.configsource(section, name, untrusted))
  1231             ui.write('%s=%s\n' % (sectname, value))
  1462             ui.write('%s=%s\n' % (sectname, value))
  1232 
  1463 
       
  1464 @command('debugknown', [], _('REPO ID...'))
  1233 def debugknown(ui, repopath, *ids, **opts):
  1465 def debugknown(ui, repopath, *ids, **opts):
  1234     """test whether node ids are known to a repo
  1466     """test whether node ids are known to a repo
  1235 
  1467 
  1236     Every ID must be a full-length hex node id string. Returns a list of 0s and 1s
  1468     Every ID must be a full-length hex node id string. Returns a list of 0s and 1s
  1237     indicating unknown/known.
  1469     indicating unknown/known.
  1240     if not repo.capable('known'):
  1472     if not repo.capable('known'):
  1241         raise util.Abort("known() not supported by target repository")
  1473         raise util.Abort("known() not supported by target repository")
  1242     flags = repo.known([bin(s) for s in ids])
  1474     flags = repo.known([bin(s) for s in ids])
  1243     ui.write("%s\n" % ("".join([f and "1" or "0" for f in flags])))
  1475     ui.write("%s\n" % ("".join([f and "1" or "0" for f in flags])))
  1244 
  1476 
       
  1477 @command('debugbundle', [('a', 'all', None, _('show all details'))], _('FILE'))
  1245 def debugbundle(ui, bundlepath, all=None, **opts):
  1478 def debugbundle(ui, bundlepath, all=None, **opts):
  1246     """lists the contents of a bundle"""
  1479     """lists the contents of a bundle"""
  1247     f = url.open(ui, bundlepath)
  1480     f = url.open(ui, bundlepath)
  1248     try:
  1481     try:
  1249         gen = changegroup.readbundle(f, bundlepath)
  1482         gen = changegroup.readbundle(f, bundlepath)
  1289                 ui.write("%s\n" % hex(node))
  1522                 ui.write("%s\n" % hex(node))
  1290                 chain = node
  1523                 chain = node
  1291     finally:
  1524     finally:
  1292         f.close()
  1525         f.close()
  1293 
  1526 
       
  1527 @command('debuggetbundle',
       
  1528     [('H', 'head', [], _('id of head node'), _('ID')),
       
  1529     ('C', 'common', [], _('id of common node'), _('ID')),
       
  1530     ('t', 'type', 'bzip2', _('bundle compression type to use'), _('TYPE'))],
       
  1531     _('REPO FILE [-H|-C ID]...'))
  1294 def debuggetbundle(ui, repopath, bundlepath, head=None, common=None, **opts):
  1532 def debuggetbundle(ui, repopath, bundlepath, head=None, common=None, **opts):
  1295     """retrieves a bundle from a repo
  1533     """retrieves a bundle from a repo
  1296 
  1534 
  1297     Every ID must be a full-length hex node id string. Saves the bundle to the
  1535     Every ID must be a full-length hex node id string. Saves the bundle to the
  1298     given file.
  1536     given file.
  1312     bundletype = btypes.get(bundletype)
  1550     bundletype = btypes.get(bundletype)
  1313     if bundletype not in changegroup.bundletypes:
  1551     if bundletype not in changegroup.bundletypes:
  1314         raise util.Abort(_('unknown bundle type specified with --type'))
  1552         raise util.Abort(_('unknown bundle type specified with --type'))
  1315     changegroup.writebundle(bundle, bundlepath, bundletype)
  1553     changegroup.writebundle(bundle, bundlepath, bundletype)
  1316 
  1554 
       
  1555 @command('debugpushkey', [], _('REPO NAMESPACE [KEY OLD NEW]'))
  1317 def debugpushkey(ui, repopath, namespace, *keyinfo):
  1556 def debugpushkey(ui, repopath, namespace, *keyinfo):
  1318     '''access the pushkey key/value protocol
  1557     '''access the pushkey key/value protocol
  1319 
  1558 
  1320     With two args, list the keys in the given namespace.
  1559     With two args, list the keys in the given namespace.
  1321 
  1560 
  1332     else:
  1571     else:
  1333         for k, v in target.listkeys(namespace).iteritems():
  1572         for k, v in target.listkeys(namespace).iteritems():
  1334             ui.write("%s\t%s\n" % (k.encode('string-escape'),
  1573             ui.write("%s\t%s\n" % (k.encode('string-escape'),
  1335                                    v.encode('string-escape')))
  1574                                    v.encode('string-escape')))
  1336 
  1575 
       
  1576 @command('debugrevspec', [], ('REVSPEC'))
  1337 def debugrevspec(ui, repo, expr):
  1577 def debugrevspec(ui, repo, expr):
  1338     '''parse and apply a revision specification'''
  1578     '''parse and apply a revision specification'''
  1339     if ui.verbose:
  1579     if ui.verbose:
  1340         tree = revset.parse(expr)[0]
  1580         tree = revset.parse(expr)[0]
  1341         ui.note(tree, "\n")
  1581         ui.note(tree, "\n")
  1344             ui.note(newtree, "\n")
  1584             ui.note(newtree, "\n")
  1345     func = revset.match(ui, expr)
  1585     func = revset.match(ui, expr)
  1346     for c in func(repo, range(len(repo))):
  1586     for c in func(repo, range(len(repo))):
  1347         ui.write("%s\n" % c)
  1587         ui.write("%s\n" % c)
  1348 
  1588 
       
  1589 @command('debugsetparents', [], _('REV1 [REV2]'))
  1349 def debugsetparents(ui, repo, rev1, rev2=None):
  1590 def debugsetparents(ui, repo, rev1, rev2=None):
  1350     """manually set the parents of the current working directory
  1591     """manually set the parents of the current working directory
  1351 
  1592 
  1352     This is useful for writing repository conversion tools, but should
  1593     This is useful for writing repository conversion tools, but should
  1353     be used with care.
  1594     be used with care.
  1362     try:
  1603     try:
  1363         repo.dirstate.setparents(r1, r2)
  1604         repo.dirstate.setparents(r1, r2)
  1364     finally:
  1605     finally:
  1365         wlock.release()
  1606         wlock.release()
  1366 
  1607 
       
  1608 @command('debugstate',
       
  1609     [('', 'nodates', None, _('do not display the saved mtime')),
       
  1610     ('', 'datesort', None, _('sort by saved mtime'))],
       
  1611     _('[OPTION]...'))
  1367 def debugstate(ui, repo, nodates=None, datesort=None):
  1612 def debugstate(ui, repo, nodates=None, datesort=None):
  1368     """show the contents of the current dirstate"""
  1613     """show the contents of the current dirstate"""
  1369     timestr = ""
  1614     timestr = ""
  1370     showdate = not nodates
  1615     showdate = not nodates
  1371     if datesort:
  1616     if datesort:
  1390             mode = '%3o' % (ent[1] & 0777)
  1635             mode = '%3o' % (ent[1] & 0777)
  1391         ui.write("%c %s %10d %s%s\n" % (ent[0], mode, ent[2], timestr, file_))
  1636         ui.write("%c %s %10d %s%s\n" % (ent[0], mode, ent[2], timestr, file_))
  1392     for f in repo.dirstate.copies():
  1637     for f in repo.dirstate.copies():
  1393         ui.write(_("copy: %s -> %s\n") % (repo.dirstate.copied(f), f))
  1638         ui.write(_("copy: %s -> %s\n") % (repo.dirstate.copied(f), f))
  1394 
  1639 
       
  1640 @command('debugsub',
       
  1641     [('r', 'rev', '',
       
  1642      _('revision to check'), _('REV'))],
       
  1643     _('[-r REV] [REV]'))
  1395 def debugsub(ui, repo, rev=None):
  1644 def debugsub(ui, repo, rev=None):
  1396     ctx = cmdutil.revsingle(repo, rev, None)
  1645     ctx = cmdutil.revsingle(repo, rev, None)
  1397     for k, v in sorted(ctx.substate.items()):
  1646     for k, v in sorted(ctx.substate.items()):
  1398         ui.write('path %s\n' % k)
  1647         ui.write('path %s\n' % k)
  1399         ui.write(' source   %s\n' % v[0])
  1648         ui.write(' source   %s\n' % v[0])
  1400         ui.write(' revision %s\n' % v[1])
  1649         ui.write(' revision %s\n' % v[1])
  1401 
  1650 
       
  1651 @command('debugdag',
       
  1652     [('t', 'tags', None, _('use tags as labels')),
       
  1653     ('b', 'branches', None, _('annotate with branch names')),
       
  1654     ('', 'dots', None, _('use dots for runs')),
       
  1655     ('s', 'spaces', None, _('separate elements by spaces'))],
       
  1656     _('[OPTION]... [FILE [REV]...]'))
  1402 def debugdag(ui, repo, file_=None, *revs, **opts):
  1657 def debugdag(ui, repo, file_=None, *revs, **opts):
  1403     """format the changelog or an index DAG as a concise textual description
  1658     """format the changelog or an index DAG as a concise textual description
  1404 
  1659 
  1405     If you pass a revlog index, the revlog's DAG is emitted. If you list
  1660     If you pass a revlog index, the revlog's DAG is emitted. If you list
  1406     revision numbers, they get labelled in the output as rN.
  1661     revision numbers, they get labelled in the output as rN.
  1450                                        usedots=dots,
  1705                                        usedots=dots,
  1451                                        maxlinewidth=70):
  1706                                        maxlinewidth=70):
  1452         ui.write(line)
  1707         ui.write(line)
  1453         ui.write("\n")
  1708         ui.write("\n")
  1454 
  1709 
       
  1710 @command('debugdata', [], _('FILE REV'))
  1455 def debugdata(ui, repo, file_, rev):
  1711 def debugdata(ui, repo, file_, rev):
  1456     """dump the contents of a data file revision"""
  1712     """dump the contents of a data file revision"""
  1457     r = None
  1713     r = None
  1458     if repo:
  1714     if repo:
  1459         filelog = repo.file(file_)
  1715         filelog = repo.file(file_)
  1465     try:
  1721     try:
  1466         ui.write(r.revision(r.lookup(rev)))
  1722         ui.write(r.revision(r.lookup(rev)))
  1467     except KeyError:
  1723     except KeyError:
  1468         raise util.Abort(_('invalid revision identifier %s') % rev)
  1724         raise util.Abort(_('invalid revision identifier %s') % rev)
  1469 
  1725 
       
  1726 @command('debugdate',
       
  1727     [('e', 'extended', None, _('try extended date formats'))],
       
  1728     _('[-e] DATE [RANGE]'))
  1470 def debugdate(ui, date, range=None, **opts):
  1729 def debugdate(ui, date, range=None, **opts):
  1471     """parse and display a date"""
  1730     """parse and display a date"""
  1472     if opts["extended"]:
  1731     if opts["extended"]:
  1473         d = util.parsedate(date, util.extendeddateformats)
  1732         d = util.parsedate(date, util.extendeddateformats)
  1474     else:
  1733     else:
  1477     ui.write("standard: %s\n" % util.datestr(d))
  1736     ui.write("standard: %s\n" % util.datestr(d))
  1478     if range:
  1737     if range:
  1479         m = util.matchdate(range)
  1738         m = util.matchdate(range)
  1480         ui.write("match: %s\n" % m(d[0]))
  1739         ui.write("match: %s\n" % m(d[0]))
  1481 
  1740 
       
  1741 @command('debugignore', [], '')
  1482 def debugignore(ui, repo, *values, **opts):
  1742 def debugignore(ui, repo, *values, **opts):
  1483     """display the combined ignore pattern"""
  1743     """display the combined ignore pattern"""
  1484     ignore = repo.dirstate._ignore
  1744     ignore = repo.dirstate._ignore
  1485     if hasattr(ignore, 'includepat'):
  1745     if hasattr(ignore, 'includepat'):
  1486         ui.write("%s\n" % ignore.includepat)
  1746         ui.write("%s\n" % ignore.includepat)
  1487     else:
  1747     else:
  1488         raise util.Abort(_("no ignore patterns found"))
  1748         raise util.Abort(_("no ignore patterns found"))
  1489 
  1749 
       
  1750 @command('debugdiscovery',
       
  1751     [('', 'old', None, _('use old-style discovery')),
       
  1752     ('', 'nonheads', None,
       
  1753      _('use old-style discovery with non-heads included')),
       
  1754     ] + remoteopts,
       
  1755     _('[-l REV] [-r REV] [-b BRANCH]... [OTHER]'))
  1490 def debugdiscovery(ui, repo, remoteurl="default", **opts):
  1756 def debugdiscovery(ui, repo, remoteurl="default", **opts):
  1491     """runs the changeset discovery protocol in isolation"""
  1757     """runs the changeset discovery protocol in isolation"""
  1492     remoteurl, branches = hg.parseurl(ui.expandpath(remoteurl), opts.get('branch'))
  1758     remoteurl, branches = hg.parseurl(ui.expandpath(remoteurl), opts.get('branch'))
  1493     remote = hg.repository(hg.remoteui(repo, opts), remoteurl)
  1759     remote = hg.repository(hg.remoteui(repo, opts), remoteurl)
  1494     ui.status(_('comparing with %s\n') % util.hidepassword(remoteurl))
  1760     ui.status(_('comparing with %s\n') % util.hidepassword(remoteurl))
  1543         remoterevs, _checkout = hg.addbranchrevs(repo, remote, branches,
  1809         remoterevs, _checkout = hg.addbranchrevs(repo, remote, branches,
  1544                                                  opts.get('remote_head'))
  1810                                                  opts.get('remote_head'))
  1545         localrevs = opts.get('local_head')
  1811         localrevs = opts.get('local_head')
  1546         doit(localrevs, remoterevs)
  1812         doit(localrevs, remoterevs)
  1547 
  1813 
  1548 
  1814 @command('debugindex',
       
  1815     [('f', 'format', 0, _('revlog format'), _('FORMAT'))],
       
  1816     _('FILE'))
  1549 def debugindex(ui, repo, file_, **opts):
  1817 def debugindex(ui, repo, file_, **opts):
  1550     """dump the contents of an index file"""
  1818     """dump the contents of an index file"""
  1551     r = None
  1819     r = None
  1552     if repo:
  1820     if repo:
  1553         filelog = repo.file(file_)
  1821         filelog = repo.file(file_)
  1592             pr = r.parentrevs(i)
  1860             pr = r.parentrevs(i)
  1593             ui.write("% 6d %04x % 8d % 8d % 8d % 6d % 6d % 6d % 6d %s\n" % (
  1861             ui.write("% 6d %04x % 8d % 8d % 8d % 6d % 6d % 6d % 6d %s\n" % (
  1594                     i, r.flags(i), r.start(i), r.length(i), r.rawsize(i),
  1862                     i, r.flags(i), r.start(i), r.length(i), r.rawsize(i),
  1595                     base, r.linkrev(i), pr[0], pr[1], short(node)))
  1863                     base, r.linkrev(i), pr[0], pr[1], short(node)))
  1596 
  1864 
       
  1865 @command('debugindexdot', [], _('FILE'))
  1597 def debugindexdot(ui, repo, file_):
  1866 def debugindexdot(ui, repo, file_):
  1598     """dump an index DAG as a graphviz dot file"""
  1867     """dump an index DAG as a graphviz dot file"""
  1599     r = None
  1868     r = None
  1600     if repo:
  1869     if repo:
  1601         filelog = repo.file(file_)
  1870         filelog = repo.file(file_)
  1610         ui.write("\t%d -> %d\n" % (r.rev(pp[0]), i))
  1879         ui.write("\t%d -> %d\n" % (r.rev(pp[0]), i))
  1611         if pp[1] != nullid:
  1880         if pp[1] != nullid:
  1612             ui.write("\t%d -> %d\n" % (r.rev(pp[1]), i))
  1881             ui.write("\t%d -> %d\n" % (r.rev(pp[1]), i))
  1613     ui.write("}\n")
  1882     ui.write("}\n")
  1614 
  1883 
       
  1884 @command('debuginstall', [], '')
  1615 def debuginstall(ui):
  1885 def debuginstall(ui):
  1616     '''test Mercurial installation
  1886     '''test Mercurial installation
  1617 
  1887 
  1618     Returns 0 on success.
  1888     Returns 0 on success.
  1619     '''
  1889     '''
  1687         ui.write(_("%s problems detected,"
  1957         ui.write(_("%s problems detected,"
  1688                    " please check your install!\n") % problems)
  1958                    " please check your install!\n") % problems)
  1689 
  1959 
  1690     return problems
  1960     return problems
  1691 
  1961 
       
  1962 @command('debugrename',
       
  1963     [('r', 'rev', '', _('revision to debug'), _('REV'))],
       
  1964     _('[-r REV] FILE'))
  1692 def debugrename(ui, repo, file1, *pats, **opts):
  1965 def debugrename(ui, repo, file1, *pats, **opts):
  1693     """dump rename information"""
  1966     """dump rename information"""
  1694 
  1967 
  1695     ctx = cmdutil.revsingle(repo, opts.get('rev'))
  1968     ctx = cmdutil.revsingle(repo, opts.get('rev'))
  1696     m = cmdutil.match(repo, (file1,) + pats, opts)
  1969     m = cmdutil.match(repo, (file1,) + pats, opts)
  1701         if o:
  1974         if o:
  1702             ui.write(_("%s renamed from %s:%s\n") % (rel, o[0], hex(o[1])))
  1975             ui.write(_("%s renamed from %s:%s\n") % (rel, o[0], hex(o[1])))
  1703         else:
  1976         else:
  1704             ui.write(_("%s not renamed\n") % rel)
  1977             ui.write(_("%s not renamed\n") % rel)
  1705 
  1978 
       
  1979 @command('debugwalk', walkopts, _('[OPTION]... [FILE]...'))
  1706 def debugwalk(ui, repo, *pats, **opts):
  1980 def debugwalk(ui, repo, *pats, **opts):
  1707     """show how files match on given patterns"""
  1981     """show how files match on given patterns"""
  1708     m = cmdutil.match(repo, pats, opts)
  1982     m = cmdutil.match(repo, pats, opts)
  1709     items = list(repo.walk(m))
  1983     items = list(repo.walk(m))
  1710     if not items:
  1984     if not items:
  1714         max([len(m.rel(abs)) for abs in items]))
  1988         max([len(m.rel(abs)) for abs in items]))
  1715     for abs in items:
  1989     for abs in items:
  1716         line = fmt % (abs, m.rel(abs), m.exact(abs) and 'exact' or '')
  1990         line = fmt % (abs, m.rel(abs), m.exact(abs) and 'exact' or '')
  1717         ui.write("%s\n" % line.rstrip())
  1991         ui.write("%s\n" % line.rstrip())
  1718 
  1992 
       
  1993 @command('debugwireargs',
       
  1994     [('', 'three', '', 'three'),
       
  1995     ('', 'four', '', 'four'),
       
  1996     ('', 'five', '', 'five'),
       
  1997     ] + remoteopts,
       
  1998     _('REPO [OPTIONS]... [ONE [TWO]]'))
  1719 def debugwireargs(ui, repopath, *vals, **opts):
  1999 def debugwireargs(ui, repopath, *vals, **opts):
  1720     repo = hg.repository(hg.remoteui(ui, opts), repopath)
  2000     repo = hg.repository(hg.remoteui(ui, opts), repopath)
  1721     for opt in remoteopts:
  2001     for opt in remoteopts:
  1722         del opts[opt[1]]
  2002         del opts[opt[1]]
  1723     args = {}
  2003     args = {}
  1729     res2 = repo.debugwireargs(*vals, **args)
  2009     res2 = repo.debugwireargs(*vals, **args)
  1730     ui.write("%s\n" % res1)
  2010     ui.write("%s\n" % res1)
  1731     if res1 != res2:
  2011     if res1 != res2:
  1732         ui.warn("%s\n" % res2)
  2012         ui.warn("%s\n" % res2)
  1733 
  2013 
       
  2014 @command('^diff',
       
  2015     [('r', 'rev', [], _('revision'), _('REV')),
       
  2016     ('c', 'change', '', _('change made by revision'), _('REV'))
       
  2017     ] + diffopts + diffopts2 + walkopts + subrepoopts,
       
  2018     _('[OPTION]... ([-c REV] | [-r REV1 [-r REV2]]) [FILE]...'))
  1734 def diff(ui, repo, *pats, **opts):
  2019 def diff(ui, repo, *pats, **opts):
  1735     """diff repository (or selected files)
  2020     """diff repository (or selected files)
  1736 
  2021 
  1737     Show differences between revisions for the specified files.
  2022     Show differences between revisions for the specified files.
  1738 
  2023 
  1782     diffopts = patch.diffopts(ui, opts)
  2067     diffopts = patch.diffopts(ui, opts)
  1783     m = cmdutil.match(repo, pats, opts)
  2068     m = cmdutil.match(repo, pats, opts)
  1784     cmdutil.diffordiffstat(ui, repo, diffopts, node1, node2, m, stat=stat,
  2069     cmdutil.diffordiffstat(ui, repo, diffopts, node1, node2, m, stat=stat,
  1785                            listsubrepos=opts.get('subrepos'))
  2070                            listsubrepos=opts.get('subrepos'))
  1786 
  2071 
       
  2072 @command('^export',
       
  2073     [('o', 'output', '',
       
  2074      _('print output to file with formatted name'), _('FORMAT')),
       
  2075     ('', 'switch-parent', None, _('diff against the second parent')),
       
  2076     ('r', 'rev', [], _('revisions to export'), _('REV')),
       
  2077     ] + diffopts,
       
  2078     _('[OPTION]... [-o OUTFILESPEC] REV...'))
  1787 def export(ui, repo, *changesets, **opts):
  2079 def export(ui, repo, *changesets, **opts):
  1788     """dump the header and diffs for one or more changesets
  2080     """dump the header and diffs for one or more changesets
  1789 
  2081 
  1790     Print the changeset header and diffs for one or more revisions.
  2082     Print the changeset header and diffs for one or more revisions.
  1791 
  2083 
  1832         ui.note(_('exporting patch:\n'))
  2124         ui.note(_('exporting patch:\n'))
  1833     cmdutil.export(repo, revs, template=opts.get('output'),
  2125     cmdutil.export(repo, revs, template=opts.get('output'),
  1834                  switch_parent=opts.get('switch_parent'),
  2126                  switch_parent=opts.get('switch_parent'),
  1835                  opts=patch.diffopts(ui, opts))
  2127                  opts=patch.diffopts(ui, opts))
  1836 
  2128 
       
  2129 @command('^forget', walkopts, _('[OPTION]... FILE...'))
  1837 def forget(ui, repo, *pats, **opts):
  2130 def forget(ui, repo, *pats, **opts):
  1838     """forget the specified files on the next commit
  2131     """forget the specified files on the next commit
  1839 
  2132 
  1840     Mark the specified files so they will no longer be tracked
  2133     Mark the specified files so they will no longer be tracked
  1841     after the next commit.
  2134     after the next commit.
  1868             ui.status(_('removing %s\n') % m.rel(f))
  2161             ui.status(_('removing %s\n') % m.rel(f))
  1869 
  2162 
  1870     repo[None].remove(forget, unlink=False)
  2163     repo[None].remove(forget, unlink=False)
  1871     return errs
  2164     return errs
  1872 
  2165 
       
  2166 @command('grep',
       
  2167     [('0', 'print0', None, _('end fields with NUL')),
       
  2168     ('', 'all', None, _('print all revisions that match')),
       
  2169     ('a', 'text', None, _('treat all files as text')),
       
  2170     ('f', 'follow', None,
       
  2171      _('follow changeset history,'
       
  2172        ' or file history across copies and renames')),
       
  2173     ('i', 'ignore-case', None, _('ignore case when matching')),
       
  2174     ('l', 'files-with-matches', None,
       
  2175      _('print only filenames and revisions that match')),
       
  2176     ('n', 'line-number', None, _('print matching line numbers')),
       
  2177     ('r', 'rev', [],
       
  2178      _('only search files changed within revision range'), _('REV')),
       
  2179     ('u', 'user', None, _('list the author (long with -v)')),
       
  2180     ('d', 'date', None, _('list the date (short with -q)')),
       
  2181     ] + walkopts,
       
  2182     _('[OPTION]... PATTERN [FILE]...'))
  1873 def grep(ui, repo, pattern, *pats, **opts):
  2183 def grep(ui, repo, pattern, *pats, **opts):
  1874     """search for a pattern in specified files and revisions
  2184     """search for a pattern in specified files and revisions
  1875 
  2185 
  1876     Search revisions of files for a regular expression.
  2186     Search revisions of files for a regular expression.
  1877 
  2187 
  2060         del matches[rev]
  2370         del matches[rev]
  2061         del revfiles[rev]
  2371         del revfiles[rev]
  2062 
  2372 
  2063     return not found
  2373     return not found
  2064 
  2374 
       
  2375 @command('heads',
       
  2376     [('r', 'rev', '',
       
  2377      _('show only heads which are descendants of STARTREV'), _('STARTREV')),
       
  2378     ('t', 'topo', False, _('show topological heads only')),
       
  2379     ('a', 'active', False, _('show active branchheads only (DEPRECATED)')),
       
  2380     ('c', 'closed', False, _('show normal and closed branch heads')),
       
  2381     ] + templateopts,
       
  2382     _('[-ac] [-r STARTREV] [REV]...'))
  2065 def heads(ui, repo, *branchrevs, **opts):
  2383 def heads(ui, repo, *branchrevs, **opts):
  2066     """show current repository heads or show branch heads
  2384     """show current repository heads or show branch heads
  2067 
  2385 
  2068     With no arguments, show all repository branch heads.
  2386     With no arguments, show all repository branch heads.
  2069 
  2387 
  2132     displayer = cmdutil.show_changeset(ui, repo, opts)
  2450     displayer = cmdutil.show_changeset(ui, repo, opts)
  2133     for ctx in heads:
  2451     for ctx in heads:
  2134         displayer.show(ctx)
  2452         displayer.show(ctx)
  2135     displayer.close()
  2453     displayer.close()
  2136 
  2454 
       
  2455 @command('help',
       
  2456     [('e', 'extension', None, _('show only help for extensions')),
       
  2457      ('c', 'command', None, _('show only help for commands'))],
       
  2458     _('[-ec] [TOPIC]'))
  2137 def help_(ui, name=None, with_version=False, unknowncmd=False, full=True, **opts):
  2459 def help_(ui, name=None, with_version=False, unknowncmd=False, full=True, **opts):
  2138     """show help for a given topic or a help overview
  2460     """show help for a given topic or a help overview
  2139 
  2461 
  2140     With no arguments, print a list of commands with short help messages.
  2462     With no arguments, print a list of commands with short help messages.
  2141 
  2463 
  2447                                              initindent=initindent,
  2769                                              initindent=initindent,
  2448                                              hangindent=hangindent)))
  2770                                              hangindent=hangindent)))
  2449             else:
  2771             else:
  2450                 ui.write("%s\n" % opt)
  2772                 ui.write("%s\n" % opt)
  2451 
  2773 
       
  2774 @command('identify|id',
       
  2775     [('r', 'rev', '',
       
  2776      _('identify the specified revision'), _('REV')),
       
  2777     ('n', 'num', None, _('show local revision number')),
       
  2778     ('i', 'id', None, _('show global revision id')),
       
  2779     ('b', 'branch', None, _('show branch')),
       
  2780     ('t', 'tags', None, _('show tags')),
       
  2781     ('B', 'bookmarks', None, _('show bookmarks'))],
       
  2782     _('[-nibtB] [-r REV] [SOURCE]'))
  2452 def identify(ui, repo, source=None, rev=None,
  2783 def identify(ui, repo, source=None, rev=None,
  2453              num=None, id=None, branch=None, tags=None, bookmarks=None):
  2784              num=None, id=None, branch=None, tags=None, bookmarks=None):
  2454     """identify the working copy or specified revision
  2785     """identify the working copy or specified revision
  2455 
  2786 
  2456     Print a summary identifying the repository state at REV using one or
  2787     Print a summary identifying the repository state at REV using one or
  2555             if bookmarks:
  2886             if bookmarks:
  2556                 output.extend(ctx.bookmarks())
  2887                 output.extend(ctx.bookmarks())
  2557 
  2888 
  2558     ui.write("%s\n" % ' '.join(output))
  2889     ui.write("%s\n" % ' '.join(output))
  2559 
  2890 
       
  2891 @command('import|patch',
       
  2892     [('p', 'strip', 1,
       
  2893      _('directory strip option for patch. This has the same '
       
  2894        'meaning as the corresponding patch option'), _('NUM')),
       
  2895     ('b', 'base', '', _('base path'), _('PATH')),
       
  2896     ('f', 'force', None, _('skip check for outstanding uncommitted changes')),
       
  2897     ('', 'no-commit', None,
       
  2898      _("don't commit, just update the working directory")),
       
  2899     ('', 'exact', None,
       
  2900      _('apply patch to the nodes from which it was generated')),
       
  2901     ('', 'import-branch', None,
       
  2902      _('use any branch information in patch (implied by --exact)'))] +
       
  2903     commitopts + commitopts2 + similarityopts,
       
  2904     _('[OPTION]... PATCH...'))
  2560 def import_(ui, repo, patch1, *patches, **opts):
  2905 def import_(ui, repo, patch1, *patches, **opts):
  2561     """import an ordered set of patches
  2906     """import an ordered set of patches
  2562 
  2907 
  2563     Import a list of patches and commit them individually (unless
  2908     Import a list of patches and commit them individually (unless
  2564     --no-commit is specified).
  2909     --no-commit is specified).
  2715         if msgs:
  3060         if msgs:
  2716             repo.opener.write('last-message.txt', '\n* * *\n'.join(msgs))
  3061             repo.opener.write('last-message.txt', '\n* * *\n'.join(msgs))
  2717     finally:
  3062     finally:
  2718         release(lock, wlock)
  3063         release(lock, wlock)
  2719 
  3064 
       
  3065 @command('incoming|in',
       
  3066     [('f', 'force', None,
       
  3067      _('run even if remote repository is unrelated')),
       
  3068     ('n', 'newest-first', None, _('show newest record first')),
       
  3069     ('', 'bundle', '',
       
  3070      _('file to store the bundles into'), _('FILE')),
       
  3071     ('r', 'rev', [], _('a remote changeset intended to be added'), _('REV')),
       
  3072     ('B', 'bookmarks', False, _("compare bookmarks")),
       
  3073     ('b', 'branch', [],
       
  3074      _('a specific branch you would like to pull'), _('BRANCH')),
       
  3075     ] + logopts + remoteopts + subrepoopts,
       
  3076     _('[-p] [-n] [-M] [-f] [-r REV]... [--bundle FILENAME] [SOURCE]'))
  2720 def incoming(ui, repo, source="default", **opts):
  3077 def incoming(ui, repo, source="default", **opts):
  2721     """show new changesets found in source
  3078     """show new changesets found in source
  2722 
  3079 
  2723     Show new changesets found in the specified path/URL or the default
  3080     Show new changesets found in the specified path/URL or the default
  2724     pull location. These are the changesets that would have been pulled
  3081     pull location. These are the changesets that would have been pulled
  2745         return bookmarks.diff(ui, repo, other)
  3102         return bookmarks.diff(ui, repo, other)
  2746 
  3103 
  2747     ret = hg.incoming(ui, repo, source, opts)
  3104     ret = hg.incoming(ui, repo, source, opts)
  2748     return ret
  3105     return ret
  2749 
  3106 
       
  3107 @command('^init', remoteopts, _('[-e CMD] [--remotecmd CMD] [DEST]'))
  2750 def init(ui, dest=".", **opts):
  3108 def init(ui, dest=".", **opts):
  2751     """create a new repository in the given directory
  3109     """create a new repository in the given directory
  2752 
  3110 
  2753     Initialize a new repository in the given directory. If the given
  3111     Initialize a new repository in the given directory. If the given
  2754     directory does not exist, it will be created.
  3112     directory does not exist, it will be created.
  2760 
  3118 
  2761     Returns 0 on success.
  3119     Returns 0 on success.
  2762     """
  3120     """
  2763     hg.repository(hg.remoteui(ui, opts), ui.expandpath(dest), create=1)
  3121     hg.repository(hg.remoteui(ui, opts), ui.expandpath(dest), create=1)
  2764 
  3122 
       
  3123 @command('locate',
       
  3124     [('r', 'rev', '', _('search the repository as it is in REV'), _('REV')),
       
  3125     ('0', 'print0', None, _('end filenames with NUL, for use with xargs')),
       
  3126     ('f', 'fullpath', None, _('print complete paths from the filesystem root')),
       
  3127     ] + walkopts,
       
  3128     _('[OPTION]... [PATTERN]...'))
  2765 def locate(ui, repo, *pats, **opts):
  3129 def locate(ui, repo, *pats, **opts):
  2766     """locate files matching specific patterns
  3130     """locate files matching specific patterns
  2767 
  3131 
  2768     Print files under Mercurial control in the working directory whose
  3132     Print files under Mercurial control in the working directory whose
  2769     names match the given patterns.
  3133     names match the given patterns.
  2797             ui.write(((pats and m.rel(abs)) or abs), end)
  3161             ui.write(((pats and m.rel(abs)) or abs), end)
  2798         ret = 0
  3162         ret = 0
  2799 
  3163 
  2800     return ret
  3164     return ret
  2801 
  3165 
       
  3166 @command('^log|history',
       
  3167     [('f', 'follow', None,
       
  3168      _('follow changeset history, or file history across copies and renames')),
       
  3169     ('', 'follow-first', None,
       
  3170      _('only follow the first parent of merge changesets')),
       
  3171     ('d', 'date', '', _('show revisions matching date spec'), _('DATE')),
       
  3172     ('C', 'copies', None, _('show copied files')),
       
  3173     ('k', 'keyword', [],
       
  3174      _('do case-insensitive search for a given text'), _('TEXT')),
       
  3175     ('r', 'rev', [], _('show the specified revision or range'), _('REV')),
       
  3176     ('', 'removed', None, _('include revisions where files were removed')),
       
  3177     ('m', 'only-merges', None, _('show only merges')),
       
  3178     ('u', 'user', [], _('revisions committed by user'), _('USER')),
       
  3179     ('', 'only-branch', [],
       
  3180      _('show only changesets within the given named branch (DEPRECATED)'),
       
  3181      _('BRANCH')),
       
  3182     ('b', 'branch', [],
       
  3183      _('show changesets within the given named branch'), _('BRANCH')),
       
  3184     ('P', 'prune', [],
       
  3185      _('do not display revision or any of its ancestors'), _('REV')),
       
  3186     ] + logopts + walkopts,
       
  3187     _('[OPTION]... [FILE]'))
  2802 def log(ui, repo, *pats, **opts):
  3188 def log(ui, repo, *pats, **opts):
  2803     """show revision history of entire repository or files
  3189     """show revision history of entire repository or files
  2804 
  3190 
  2805     Print the revision history of the specified files or the entire
  3191     Print the revision history of the specified files or the entire
  2806     project.
  3192     project.
  2896             break
  3282             break
  2897         if displayer.flush(ctx.rev()):
  3283         if displayer.flush(ctx.rev()):
  2898             count += 1
  3284             count += 1
  2899     displayer.close()
  3285     displayer.close()
  2900 
  3286 
       
  3287 @command('manifest',
       
  3288     [('r', 'rev', '', _('revision to display'), _('REV'))],
       
  3289     _('[-r REV]'))
  2901 def manifest(ui, repo, node=None, rev=None):
  3290 def manifest(ui, repo, node=None, rev=None):
  2902     """output the current or given revision of the project manifest
  3291     """output the current or given revision of the project manifest
  2903 
  3292 
  2904     Print a list of version controlled files for the given revision.
  3293     Print a list of version controlled files for the given revision.
  2905     If no revision is given, the first parent of the working directory
  3294     If no revision is given, the first parent of the working directory
  2924             ui.write("%40s " % hex(ctx.manifest()[f]))
  3313             ui.write("%40s " % hex(ctx.manifest()[f]))
  2925         if ui.verbose:
  3314         if ui.verbose:
  2926             ui.write(decor[ctx.flags(f)])
  3315             ui.write(decor[ctx.flags(f)])
  2927         ui.write("%s\n" % f)
  3316         ui.write("%s\n" % f)
  2928 
  3317 
       
  3318 @command('^merge',
       
  3319     [('f', 'force', None, _('force a merge with outstanding changes')),
       
  3320     ('t', 'tool', '', _('specify merge tool')),
       
  3321     ('r', 'rev', '', _('revision to merge'), _('REV')),
       
  3322     ('P', 'preview', None,
       
  3323      _('review revisions to merge (no merge is performed)'))],
       
  3324     _('[-P] [-f] [[-r] REV]'))
  2929 def merge(ui, repo, node=None, **opts):
  3325 def merge(ui, repo, node=None, **opts):
  2930     """merge working directory with another revision
  3326     """merge working directory with another revision
  2931 
  3327 
  2932     The current working directory is updated with all changes made in
  3328     The current working directory is updated with all changes made in
  2933     the requested revision since the last common predecessor revision.
  3329     the requested revision since the last common predecessor revision.
  3006         ui.setconfig('ui', 'forcemerge', opts.get('tool', ''))
  3402         ui.setconfig('ui', 'forcemerge', opts.get('tool', ''))
  3007         return hg.merge(repo, node, force=opts.get('force'))
  3403         return hg.merge(repo, node, force=opts.get('force'))
  3008     finally:
  3404     finally:
  3009         ui.setconfig('ui', 'forcemerge', '')
  3405         ui.setconfig('ui', 'forcemerge', '')
  3010 
  3406 
       
  3407 @command('outgoing|out',
       
  3408     [('f', 'force', None, _('run even when the destination is unrelated')),
       
  3409     ('r', 'rev', [],
       
  3410      _('a changeset intended to be included in the destination'), _('REV')),
       
  3411     ('n', 'newest-first', None, _('show newest record first')),
       
  3412     ('B', 'bookmarks', False, _('compare bookmarks')),
       
  3413     ('b', 'branch', [], _('a specific branch you would like to push'),
       
  3414      _('BRANCH')),
       
  3415     ] + logopts + remoteopts + subrepoopts,
       
  3416     _('[-M] [-p] [-n] [-f] [-r REV]... [DEST]'))
  3011 def outgoing(ui, repo, dest=None, **opts):
  3417 def outgoing(ui, repo, dest=None, **opts):
  3012     """show changesets not found in the destination
  3418     """show changesets not found in the destination
  3013 
  3419 
  3014     Show changesets not found in the specified destination repository
  3420     Show changesets not found in the specified destination repository
  3015     or the default push location. These are the changesets that would
  3421     or the default push location. These are the changesets that would
  3031         return bookmarks.diff(ui, other, repo)
  3437         return bookmarks.diff(ui, other, repo)
  3032 
  3438 
  3033     ret = hg.outgoing(ui, repo, dest, opts)
  3439     ret = hg.outgoing(ui, repo, dest, opts)
  3034     return ret
  3440     return ret
  3035 
  3441 
       
  3442 @command('parents',
       
  3443     [('r', 'rev', '', _('show parents of the specified revision'), _('REV')),
       
  3444     ] + templateopts,
       
  3445     _('[-r REV] [FILE]'))
  3036 def parents(ui, repo, file_=None, **opts):
  3446 def parents(ui, repo, file_=None, **opts):
  3037     """show the parents of the working directory or revision
  3447     """show the parents of the working directory or revision
  3038 
  3448 
  3039     Print the working directory's parent revisions. If a revision is
  3449     Print the working directory's parent revisions. If a revision is
  3040     given via -r/--rev, the parent of that revision will be printed.
  3450     given via -r/--rev, the parent of that revision will be printed.
  3071     for n in p:
  3481     for n in p:
  3072         if n != nullid:
  3482         if n != nullid:
  3073             displayer.show(repo[n])
  3483             displayer.show(repo[n])
  3074     displayer.close()
  3484     displayer.close()
  3075 
  3485 
       
  3486 @command('paths', [], _('[NAME]'))
  3076 def paths(ui, repo, search=None):
  3487 def paths(ui, repo, search=None):
  3077     """show aliases for remote repositories
  3488     """show aliases for remote repositories
  3078 
  3489 
  3079     Show definition of symbolic path name NAME. If no name is given,
  3490     Show definition of symbolic path name NAME. If no name is given,
  3080     show definition of all available names.
  3491     show definition of all available names.
  3126         else:
  3537         else:
  3127             ui.status(_("(run 'hg heads' to see heads)\n"))
  3538             ui.status(_("(run 'hg heads' to see heads)\n"))
  3128     else:
  3539     else:
  3129         ui.status(_("(run 'hg update' to get a working copy)\n"))
  3540         ui.status(_("(run 'hg update' to get a working copy)\n"))
  3130 
  3541 
       
  3542 @command('^pull',
       
  3543     [('u', 'update', None,
       
  3544      _('update to new branch head if changesets were pulled')),
       
  3545     ('f', 'force', None, _('run even when remote repository is unrelated')),
       
  3546     ('r', 'rev', [], _('a remote changeset intended to be added'), _('REV')),
       
  3547     ('B', 'bookmark', [], _("bookmark to pull"), _('BOOKMARK')),
       
  3548     ('b', 'branch', [], _('a specific branch you would like to pull'),
       
  3549      _('BRANCH')),
       
  3550     ] + remoteopts,
       
  3551     _('[-u] [-f] [-r REV]... [-e CMD] [--remotecmd CMD] [SOURCE]'))
  3131 def pull(ui, repo, source="default", **opts):
  3552 def pull(ui, repo, source="default", **opts):
  3132     """pull changes from the specified source
  3553     """pull changes from the specified source
  3133 
  3554 
  3134     Pull changes from a remote repository to a local one.
  3555     Pull changes from a remote repository to a local one.
  3135 
  3556 
  3189             repo._bookmarks[b] = repo[rb[b]].node()
  3610             repo._bookmarks[b] = repo[rb[b]].node()
  3190         bookmarks.write(repo)
  3611         bookmarks.write(repo)
  3191 
  3612 
  3192     return ret
  3613     return ret
  3193 
  3614 
       
  3615 @command('^push',
       
  3616     [('f', 'force', None, _('force push')),
       
  3617     ('r', 'rev', [],
       
  3618      _('a changeset intended to be included in the destination'),
       
  3619      _('REV')),
       
  3620     ('B', 'bookmark', [], _("bookmark to push"), _('BOOKMARK')),
       
  3621     ('b', 'branch', [],
       
  3622      _('a specific branch you would like to push'), _('BRANCH')),
       
  3623     ('', 'new-branch', False, _('allow pushing a new branch')),
       
  3624     ] + remoteopts,
       
  3625     _('[-f] [-r REV]... [-e CMD] [--remotecmd CMD] [DEST]'))
  3194 def push(ui, repo, dest=None, **opts):
  3626 def push(ui, repo, dest=None, **opts):
  3195     """push changes to the specified destination
  3627     """push changes to the specified destination
  3196 
  3628 
  3197     Push changesets from the local repository to the specified
  3629     Push changesets from the local repository to the specified
  3198     destination.
  3630     destination.
  3275                 if not result:
  3707                 if not result:
  3276                     result = 2
  3708                     result = 2
  3277 
  3709 
  3278     return result
  3710     return result
  3279 
  3711 
       
  3712 @command('recover', [])
  3280 def recover(ui, repo):
  3713 def recover(ui, repo):
  3281     """roll back an interrupted transaction
  3714     """roll back an interrupted transaction
  3282 
  3715 
  3283     Recover from an interrupted commit or pull.
  3716     Recover from an interrupted commit or pull.
  3284 
  3717 
  3290     """
  3723     """
  3291     if repo.recover():
  3724     if repo.recover():
  3292         return hg.verify(repo)
  3725         return hg.verify(repo)
  3293     return 1
  3726     return 1
  3294 
  3727 
       
  3728 @command('^remove|rm',
       
  3729     [('A', 'after', None, _('record delete for missing files')),
       
  3730     ('f', 'force', None,
       
  3731      _('remove (and delete) file even if added or modified')),
       
  3732     ] + walkopts,
       
  3733     _('[OPTION]... FILE...'))
  3295 def remove(ui, repo, *pats, **opts):
  3734 def remove(ui, repo, *pats, **opts):
  3296     """remove the specified files on the next commit
  3735     """remove the specified files on the next commit
  3297 
  3736 
  3298     Schedule the indicated files for removal from the repository.
  3737     Schedule the indicated files for removal from the repository.
  3299 
  3738 
  3360 
  3799 
  3361     repo[None].forget(forget)
  3800     repo[None].forget(forget)
  3362     repo[None].remove(remove, unlink=not after)
  3801     repo[None].remove(remove, unlink=not after)
  3363     return ret
  3802     return ret
  3364 
  3803 
       
  3804 @command('rename|move|mv',
       
  3805     [('A', 'after', None, _('record a rename that has already occurred')),
       
  3806     ('f', 'force', None, _('forcibly copy over an existing managed file')),
       
  3807     ] + walkopts + dryrunopts,
       
  3808     _('[OPTION]... SOURCE... DEST'))
  3365 def rename(ui, repo, *pats, **opts):
  3809 def rename(ui, repo, *pats, **opts):
  3366     """rename files; equivalent of copy + remove
  3810     """rename files; equivalent of copy + remove
  3367 
  3811 
  3368     Mark dest as copies of sources; mark sources for deletion. If dest
  3812     Mark dest as copies of sources; mark sources for deletion. If dest
  3369     is a directory, copies are put in that directory. If dest is a
  3813     is a directory, copies are put in that directory. If dest is a
  3382     try:
  3826     try:
  3383         return cmdutil.copy(ui, repo, pats, opts, rename=True)
  3827         return cmdutil.copy(ui, repo, pats, opts, rename=True)
  3384     finally:
  3828     finally:
  3385         wlock.release()
  3829         wlock.release()
  3386 
  3830 
       
  3831 @command('resolve',
       
  3832     [('a', 'all', None, _('select all unresolved files')),
       
  3833     ('l', 'list', None, _('list state of files needing merge')),
       
  3834     ('m', 'mark', None, _('mark files as resolved')),
       
  3835     ('u', 'unmark', None, _('mark files as unresolved')),
       
  3836     ('t', 'tool', '', _('specify merge tool')),
       
  3837     ('n', 'no-status', None, _('hide status prefix'))]
       
  3838     + walkopts,
       
  3839     _('[OPTION]... [FILE]...'))
  3387 def resolve(ui, repo, *pats, **opts):
  3840 def resolve(ui, repo, *pats, **opts):
  3388     """redo merges or set/view the merge status of files
  3841     """redo merges or set/view the merge status of files
  3389 
  3842 
  3390     Merges with unresolved conflicts are often the result of
  3843     Merges with unresolved conflicts are often the result of
  3391     non-interactive merging using the ``internal:merge`` configuration
  3844     non-interactive merging using the ``internal:merge`` configuration
  3468                 util.rename(a + ".resolve", a + ".orig")
  3921                 util.rename(a + ".resolve", a + ".orig")
  3469 
  3922 
  3470     ms.commit()
  3923     ms.commit()
  3471     return ret
  3924     return ret
  3472 
  3925 
       
  3926 @command('revert',
       
  3927     [('a', 'all', None, _('revert all changes when no arguments given')),
       
  3928     ('d', 'date', '', _('tipmost revision matching date'), _('DATE')),
       
  3929     ('r', 'rev', '', _('revert to the specified revision'), _('REV')),
       
  3930     ('', 'no-backup', None, _('do not save backup copies of files')),
       
  3931     ] + walkopts + dryrunopts,
       
  3932     _('[OPTION]... [-r REV] [NAME]...'))
  3473 def revert(ui, repo, *pats, **opts):
  3933 def revert(ui, repo, *pats, **opts):
  3474     """restore individual files or directories to an earlier state
  3934     """restore individual files or directories to an earlier state
  3475 
  3935 
  3476     .. note::
  3936     .. note::
  3477        This command is most likely not what you are looking for.
  3937        This command is most likely not what you are looking for.
  3696                 normal(f)
  4156                 normal(f)
  3697 
  4157 
  3698     finally:
  4158     finally:
  3699         wlock.release()
  4159         wlock.release()
  3700 
  4160 
       
  4161 @command('rollback', dryrunopts)
  3701 def rollback(ui, repo, **opts):
  4162 def rollback(ui, repo, **opts):
  3702     """roll back the last transaction (dangerous)
  4163     """roll back the last transaction (dangerous)
  3703 
  4164 
  3704     This command should be used with care. There is only one level of
  4165     This command should be used with care. There is only one level of
  3705     rollback, and there is no way to undo a rollback. It will also
  4166     rollback, and there is no way to undo a rollback. It will also
  3727 
  4188 
  3728     Returns 0 on success, 1 if no rollback data is available.
  4189     Returns 0 on success, 1 if no rollback data is available.
  3729     """
  4190     """
  3730     return repo.rollback(opts.get('dry_run'))
  4191     return repo.rollback(opts.get('dry_run'))
  3731 
  4192 
       
  4193 @command('root', [])
  3732 def root(ui, repo):
  4194 def root(ui, repo):
  3733     """print the root (top) of the current working directory
  4195     """print the root (top) of the current working directory
  3734 
  4196 
  3735     Print the root directory of the current repository.
  4197     Print the root directory of the current repository.
  3736 
  4198 
  3737     Returns 0 on success.
  4199     Returns 0 on success.
  3738     """
  4200     """
  3739     ui.write(repo.root + "\n")
  4201     ui.write(repo.root + "\n")
  3740 
  4202 
       
  4203 @command('^serve',
       
  4204     [('A', 'accesslog', '', _('name of access log file to write to'),
       
  4205      _('FILE')),
       
  4206     ('d', 'daemon', None, _('run server in background')),
       
  4207     ('', 'daemon-pipefds', '', _('used internally by daemon mode'), _('NUM')),
       
  4208     ('E', 'errorlog', '', _('name of error log file to write to'), _('FILE')),
       
  4209     # use string type, then we can check if something was passed
       
  4210     ('p', 'port', '', _('port to listen on (default: 8000)'), _('PORT')),
       
  4211     ('a', 'address', '', _('address to listen on (default: all interfaces)'),
       
  4212      _('ADDR')),
       
  4213     ('', 'prefix', '', _('prefix path to serve from (default: server root)'),
       
  4214      _('PREFIX')),
       
  4215     ('n', 'name', '',
       
  4216      _('name to show in web pages (default: working directory)'), _('NAME')),
       
  4217     ('', 'web-conf', '',
       
  4218      _('name of the hgweb config file (see "hg help hgweb")'), _('FILE')),
       
  4219     ('', 'webdir-conf', '', _('name of the hgweb config file (DEPRECATED)'),
       
  4220      _('FILE')),
       
  4221     ('', 'pid-file', '', _('name of file to write process ID to'), _('FILE')),
       
  4222     ('', 'stdio', None, _('for remote clients')),
       
  4223     ('t', 'templates', '', _('web templates to use'), _('TEMPLATE')),
       
  4224     ('', 'style', '', _('template style to use'), _('STYLE')),
       
  4225     ('6', 'ipv6', None, _('use IPv6 in addition to IPv4')),
       
  4226     ('', 'certificate', '', _('SSL certificate file'), _('FILE'))],
       
  4227     _('[OPTION]...'))
  3741 def serve(ui, repo, **opts):
  4228 def serve(ui, repo, **opts):
  3742     """start stand-alone webserver
  4229     """start stand-alone webserver
  3743 
  4230 
  3744     Start a local HTTP repository browser and pull server. You can use
  4231     Start a local HTTP repository browser and pull server. You can use
  3745     this for ad-hoc sharing and browsing of repositories. It is
  4232     this for ad-hoc sharing and browsing of repositories. It is
  3832 
  4319 
  3833     service = service()
  4320     service = service()
  3834 
  4321 
  3835     cmdutil.service(opts, initfn=service.init, runfn=service.run)
  4322     cmdutil.service(opts, initfn=service.init, runfn=service.run)
  3836 
  4323 
       
  4324 @command('^status|st',
       
  4325     [('A', 'all', None, _('show status of all files')),
       
  4326     ('m', 'modified', None, _('show only modified files')),
       
  4327     ('a', 'added', None, _('show only added files')),
       
  4328     ('r', 'removed', None, _('show only removed files')),
       
  4329     ('d', 'deleted', None, _('show only deleted (but tracked) files')),
       
  4330     ('c', 'clean', None, _('show only files without changes')),
       
  4331     ('u', 'unknown', None, _('show only unknown (not tracked) files')),
       
  4332     ('i', 'ignored', None, _('show only ignored files')),
       
  4333     ('n', 'no-status', None, _('hide status prefix')),
       
  4334     ('C', 'copies', None, _('show source of copied files')),
       
  4335     ('0', 'print0', None, _('end filenames with NUL, for use with xargs')),
       
  4336     ('', 'rev', [], _('show difference from revision'), _('REV')),
       
  4337     ('', 'change', '', _('list the changed files of a revision'), _('REV')),
       
  4338     ] + walkopts + subrepoopts,
       
  4339     _('[OPTION]... [FILE]...'))
  3837 def status(ui, repo, *pats, **opts):
  4340 def status(ui, repo, *pats, **opts):
  3838     """show changed files in the working directory
  4341     """show changed files in the working directory
  3839 
  4342 
  3840     Show status of files in the repository. If names are given, only
  4343     Show status of files in the repository. If names are given, only
  3841     files that match are shown. Files that are clean or ignored or
  4344     files that match are shown. Files that are clean or ignored or
  3924                          label='status.' + state)
  4427                          label='status.' + state)
  3925                 if f in copy:
  4428                 if f in copy:
  3926                     ui.write('  %s%s' % (repo.pathto(copy[f], cwd), end),
  4429                     ui.write('  %s%s' % (repo.pathto(copy[f], cwd), end),
  3927                              label='status.copied')
  4430                              label='status.copied')
  3928 
  4431 
       
  4432 @command('^summary|sum',
       
  4433     [('', 'remote', None, _('check for push and pull'))], '[--remote]')
  3929 def summary(ui, repo, **opts):
  4434 def summary(ui, repo, **opts):
  3930     """summarize working directory state
  4435     """summarize working directory state
  3931 
  4436 
  3932     This generates a brief summary of the working directory state,
  4437     This generates a brief summary of the working directory state,
  3933     including parents, branch, commit status, and available updates.
  4438     including parents, branch, commit status, and available updates.
  4086         if t:
  4591         if t:
  4087             ui.write(_('remote: %s\n') % (', '.join(t)))
  4592             ui.write(_('remote: %s\n') % (', '.join(t)))
  4088         else:
  4593         else:
  4089             ui.status(_('remote: (synced)\n'))
  4594             ui.status(_('remote: (synced)\n'))
  4090 
  4595 
       
  4596 @command('tag',
       
  4597     [('f', 'force', None, _('force tag')),
       
  4598     ('l', 'local', None, _('make the tag local')),
       
  4599     ('r', 'rev', '', _('revision to tag'), _('REV')),
       
  4600     ('', 'remove', None, _('remove a tag')),
       
  4601     # -l/--local is already there, commitopts cannot be used
       
  4602     ('e', 'edit', None, _('edit commit message')),
       
  4603     ('m', 'message', '', _('use <text> as commit message'), _('TEXT')),
       
  4604     ] + commitopts2,
       
  4605     _('[-f] [-l] [-m TEXT] [-d DATE] [-u USER] [-r REV] NAME...'))
  4091 def tag(ui, repo, name1, *names, **opts):
  4606 def tag(ui, repo, name1, *names, **opts):
  4092     """add one or more tags for the current or given revision
  4607     """add one or more tags for the current or given revision
  4093 
  4608 
  4094     Name a particular revision using <name>.
  4609     Name a particular revision using <name>.
  4095 
  4610 
  4175     if opts.get('edit'):
  4690     if opts.get('edit'):
  4176         message = ui.edit(message, ui.username())
  4691         message = ui.edit(message, ui.username())
  4177 
  4692 
  4178     repo.tag(names, r, message, opts.get('local'), opts.get('user'), date)
  4693     repo.tag(names, r, message, opts.get('local'), opts.get('user'), date)
  4179 
  4694 
       
  4695 @command('tags', [], '')
  4180 def tags(ui, repo):
  4696 def tags(ui, repo):
  4181     """list repository tags
  4697     """list repository tags
  4182 
  4698 
  4183     This lists both regular and local tags. When the -v/--verbose
  4699     This lists both regular and local tags. When the -v/--verbose
  4184     switch is used, a third column "local" is printed for local tags.
  4700     switch is used, a third column "local" is printed for local tags.
  4203                 tagtype = " local"
  4719                 tagtype = " local"
  4204             else:
  4720             else:
  4205                 tagtype = ""
  4721                 tagtype = ""
  4206         ui.write("%s%s %s%s\n" % (t, spaces, r, tagtype))
  4722         ui.write("%s%s %s%s\n" % (t, spaces, r, tagtype))
  4207 
  4723 
       
  4724 @command('tip',
       
  4725     [('p', 'patch', None, _('show patch')),
       
  4726     ('g', 'git', None, _('use git extended diff format')),
       
  4727     ] + templateopts,
       
  4728     _('[-p] [-g]'))
  4208 def tip(ui, repo, **opts):
  4729 def tip(ui, repo, **opts):
  4209     """show the tip revision
  4730     """show the tip revision
  4210 
  4731 
  4211     The tip revision (usually just called the tip) is the changeset
  4732     The tip revision (usually just called the tip) is the changeset
  4212     most recently added to the repository (and therefore the most
  4733     most recently added to the repository (and therefore the most
  4221     """
  4742     """
  4222     displayer = cmdutil.show_changeset(ui, repo, opts)
  4743     displayer = cmdutil.show_changeset(ui, repo, opts)
  4223     displayer.show(repo[len(repo) - 1])
  4744     displayer.show(repo[len(repo) - 1])
  4224     displayer.close()
  4745     displayer.close()
  4225 
  4746 
       
  4747 @command('unbundle',
       
  4748     [('u', 'update', None,
       
  4749      _('update to new branch head if changesets were unbundled'))],
       
  4750     _('[-u] FILE...'))
  4226 def unbundle(ui, repo, fname1, *fnames, **opts):
  4751 def unbundle(ui, repo, fname1, *fnames, **opts):
  4227     """apply one or more changegroup files
  4752     """apply one or more changegroup files
  4228 
  4753 
  4229     Apply one or more compressed changegroup files generated by the
  4754     Apply one or more compressed changegroup files generated by the
  4230     bundle command.
  4755     bundle command.
  4244         bookmarks.updatecurrentbookmark(repo, wc.node(), wc.branch())
  4769         bookmarks.updatecurrentbookmark(repo, wc.node(), wc.branch())
  4245     finally:
  4770     finally:
  4246         lock.release()
  4771         lock.release()
  4247     return postincoming(ui, repo, modheads, opts.get('update'), None)
  4772     return postincoming(ui, repo, modheads, opts.get('update'), None)
  4248 
  4773 
       
  4774 @command('^update|up|checkout|co',
       
  4775     [('C', 'clean', None, _('discard uncommitted changes (no backup)')),
       
  4776     ('c', 'check', None,
       
  4777      _('update across branches if no uncommitted changes')),
       
  4778     ('d', 'date', '', _('tipmost revision matching date'), _('DATE')),
       
  4779     ('r', 'rev', '', _('revision'), _('REV'))],
       
  4780     _('[-c] [-C] [-d DATE] [[-r] REV]'))
  4249 def update(ui, repo, node=None, rev=None, clean=False, date=None, check=False):
  4781 def update(ui, repo, node=None, rev=None, clean=False, date=None, check=False):
  4250     """update working directory (or switch revisions)
  4782     """update working directory (or switch revisions)
  4251 
  4783 
  4252     Update the repository's working directory to the specified
  4784     Update the repository's working directory to the specified
  4253     changeset. If no changeset is specified, update to the tip of the
  4785     changeset. If no changeset is specified, update to the tip of the
  4319     if brev in repo._bookmarks:
  4851     if brev in repo._bookmarks:
  4320         bookmarks.setcurrent(repo, brev)
  4852         bookmarks.setcurrent(repo, brev)
  4321 
  4853 
  4322     return ret
  4854     return ret
  4323 
  4855 
       
  4856 @command('verify', [])
  4324 def verify(ui, repo):
  4857 def verify(ui, repo):
  4325     """verify the integrity of the repository
  4858     """verify the integrity of the repository
  4326 
  4859 
  4327     Verify the integrity of the current repository.
  4860     Verify the integrity of the current repository.
  4328 
  4861 
  4333 
  4866 
  4334     Returns 0 on success, 1 if errors are encountered.
  4867     Returns 0 on success, 1 if errors are encountered.
  4335     """
  4868     """
  4336     return hg.verify(repo)
  4869     return hg.verify(repo)
  4337 
  4870 
       
  4871 @command('version', [])
  4338 def version_(ui):
  4872 def version_(ui):
  4339     """output version and copyright information"""
  4873     """output version and copyright information"""
  4340     ui.write(_("Mercurial Distributed SCM (version %s)\n")
  4874     ui.write(_("Mercurial Distributed SCM (version %s)\n")
  4341              % util.version())
  4875              % util.version())
  4342     ui.status(_(
  4876     ui.status(_(
  4345         "This is free software; see the source for copying conditions. "
  4879         "This is free software; see the source for copying conditions. "
  4346         "There is NO\nwarranty; "
  4880         "There is NO\nwarranty; "
  4347         "not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n"
  4881         "not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n"
  4348     ))
  4882     ))
  4349 
  4883 
  4350 # Command options and aliases are listed here, alphabetically
       
  4351 
       
  4352 globalopts = [
       
  4353     ('R', 'repository', '',
       
  4354      _('repository root directory or name of overlay bundle file'),
       
  4355      _('REPO')),
       
  4356     ('', 'cwd', '',
       
  4357      _('change working directory'), _('DIR')),
       
  4358     ('y', 'noninteractive', None,
       
  4359      _('do not prompt, assume \'yes\' for any required answers')),
       
  4360     ('q', 'quiet', None, _('suppress output')),
       
  4361     ('v', 'verbose', None, _('enable additional output')),
       
  4362     ('', 'config', [],
       
  4363      _('set/override config option (use \'section.name=value\')'),
       
  4364      _('CONFIG')),
       
  4365     ('', 'debug', None, _('enable debugging output')),
       
  4366     ('', 'debugger', None, _('start debugger')),
       
  4367     ('', 'encoding', encoding.encoding, _('set the charset encoding'),
       
  4368      _('ENCODE')),
       
  4369     ('', 'encodingmode', encoding.encodingmode,
       
  4370      _('set the charset encoding mode'), _('MODE')),
       
  4371     ('', 'traceback', None, _('always print a traceback on exception')),
       
  4372     ('', 'time', None, _('time how long the command takes')),
       
  4373     ('', 'profile', None, _('print command execution profile')),
       
  4374     ('', 'version', None, _('output version information and exit')),
       
  4375     ('h', 'help', None, _('display help and exit')),
       
  4376 ]
       
  4377 
       
  4378 dryrunopts = [('n', 'dry-run', None,
       
  4379                _('do not perform actions, just print output'))]
       
  4380 
       
  4381 remoteopts = [
       
  4382     ('e', 'ssh', '',
       
  4383      _('specify ssh command to use'), _('CMD')),
       
  4384     ('', 'remotecmd', '',
       
  4385      _('specify hg command to run on the remote side'), _('CMD')),
       
  4386     ('', 'insecure', None,
       
  4387      _('do not verify server certificate (ignoring web.cacerts config)')),
       
  4388 ]
       
  4389 
       
  4390 walkopts = [
       
  4391     ('I', 'include', [],
       
  4392      _('include names matching the given patterns'), _('PATTERN')),
       
  4393     ('X', 'exclude', [],
       
  4394      _('exclude names matching the given patterns'), _('PATTERN')),
       
  4395 ]
       
  4396 
       
  4397 commitopts = [
       
  4398     ('m', 'message', '',
       
  4399      _('use text as commit message'), _('TEXT')),
       
  4400     ('l', 'logfile', '',
       
  4401      _('read commit message from file'), _('FILE')),
       
  4402 ]
       
  4403 
       
  4404 commitopts2 = [
       
  4405     ('d', 'date', '',
       
  4406      _('record the specified date as commit date'), _('DATE')),
       
  4407     ('u', 'user', '',
       
  4408      _('record the specified user as committer'), _('USER')),
       
  4409 ]
       
  4410 
       
  4411 templateopts = [
       
  4412     ('', 'style', '',
       
  4413      _('display using template map file'), _('STYLE')),
       
  4414     ('', 'template', '',
       
  4415      _('display with template'), _('TEMPLATE')),
       
  4416 ]
       
  4417 
       
  4418 logopts = [
       
  4419     ('p', 'patch', None, _('show patch')),
       
  4420     ('g', 'git', None, _('use git extended diff format')),
       
  4421     ('l', 'limit', '',
       
  4422      _('limit number of changes displayed'), _('NUM')),
       
  4423     ('M', 'no-merges', None, _('do not show merges')),
       
  4424     ('', 'stat', None, _('output diffstat-style summary of changes')),
       
  4425 ] + templateopts
       
  4426 
       
  4427 diffopts = [
       
  4428     ('a', 'text', None, _('treat all files as text')),
       
  4429     ('g', 'git', None, _('use git extended diff format')),
       
  4430     ('', 'nodates', None, _('omit dates from diff headers'))
       
  4431 ]
       
  4432 
       
  4433 diffopts2 = [
       
  4434     ('p', 'show-function', None, _('show which function each change is in')),
       
  4435     ('', 'reverse', None, _('produce a diff that undoes the changes')),
       
  4436     ('w', 'ignore-all-space', None,
       
  4437      _('ignore white space when comparing lines')),
       
  4438     ('b', 'ignore-space-change', None,
       
  4439      _('ignore changes in the amount of white space')),
       
  4440     ('B', 'ignore-blank-lines', None,
       
  4441      _('ignore changes whose lines are all blank')),
       
  4442     ('U', 'unified', '',
       
  4443      _('number of lines of context to show'), _('NUM')),
       
  4444     ('', 'stat', None, _('output diffstat-style summary of changes')),
       
  4445 ]
       
  4446 
       
  4447 similarityopts = [
       
  4448     ('s', 'similarity', '',
       
  4449      _('guess renamed files by similarity (0<=s<=100)'), _('SIMILARITY'))
       
  4450 ]
       
  4451 
       
  4452 subrepoopts = [
       
  4453     ('S', 'subrepos', None,
       
  4454      _('recurse into subrepositories'))
       
  4455 ]
       
  4456 
       
  4457 table = {
       
  4458     "^add": (add, walkopts + subrepoopts + dryrunopts,
       
  4459              _('[OPTION]... [FILE]...')),
       
  4460     "addremove":
       
  4461         (addremove, similarityopts + walkopts + dryrunopts,
       
  4462          _('[OPTION]... [FILE]...')),
       
  4463     "^annotate|blame":
       
  4464         (annotate,
       
  4465          [('r', 'rev', '',
       
  4466            _('annotate the specified revision'), _('REV')),
       
  4467           ('', 'follow', None,
       
  4468            _('follow copies/renames and list the filename (DEPRECATED)')),
       
  4469           ('', 'no-follow', None, _("don't follow copies and renames")),
       
  4470           ('a', 'text', None, _('treat all files as text')),
       
  4471           ('u', 'user', None, _('list the author (long with -v)')),
       
  4472           ('f', 'file', None, _('list the filename')),
       
  4473           ('d', 'date', None, _('list the date (short with -q)')),
       
  4474           ('n', 'number', None, _('list the revision number (default)')),
       
  4475           ('c', 'changeset', None, _('list the changeset')),
       
  4476           ('l', 'line-number', None,
       
  4477            _('show line number at the first appearance'))
       
  4478          ] + walkopts,
       
  4479          _('[-r REV] [-f] [-a] [-u] [-d] [-n] [-c] [-l] FILE...')),
       
  4480     "archive":
       
  4481         (archive,
       
  4482          [('', 'no-decode', None, _('do not pass files through decoders')),
       
  4483           ('p', 'prefix', '',
       
  4484            _('directory prefix for files in archive'), _('PREFIX')),
       
  4485           ('r', 'rev', '',
       
  4486            _('revision to distribute'), _('REV')),
       
  4487           ('t', 'type', '',
       
  4488            _('type of distribution to create'), _('TYPE')),
       
  4489          ] + subrepoopts + walkopts,
       
  4490          _('[OPTION]... DEST')),
       
  4491     "backout":
       
  4492         (backout,
       
  4493          [('', 'merge', None,
       
  4494            _('merge with old dirstate parent after backout')),
       
  4495           ('', 'parent', '',
       
  4496            _('parent to choose when backing out merge'), _('REV')),
       
  4497           ('t', 'tool', '',
       
  4498            _('specify merge tool')),
       
  4499           ('r', 'rev', '',
       
  4500            _('revision to backout'), _('REV')),
       
  4501          ] + walkopts + commitopts + commitopts2,
       
  4502          _('[OPTION]... [-r] REV')),
       
  4503     "bisect":
       
  4504         (bisect,
       
  4505          [('r', 'reset', False, _('reset bisect state')),
       
  4506           ('g', 'good', False, _('mark changeset good')),
       
  4507           ('b', 'bad', False, _('mark changeset bad')),
       
  4508           ('s', 'skip', False, _('skip testing changeset')),
       
  4509           ('e', 'extend', False, _('extend the bisect range')),
       
  4510           ('c', 'command', '',
       
  4511            _('use command to check changeset state'), _('CMD')),
       
  4512           ('U', 'noupdate', False, _('do not update to target'))],
       
  4513          _("[-gbsr] [-U] [-c CMD] [REV]")),
       
  4514     "bookmarks":
       
  4515         (bookmark,
       
  4516          [('f', 'force', False, _('force')),
       
  4517           ('r', 'rev', '', _('revision'), _('REV')),
       
  4518           ('d', 'delete', False, _('delete a given bookmark')),
       
  4519           ('m', 'rename', '', _('rename a given bookmark'), _('NAME')),
       
  4520           ('i', 'inactive', False, _('do not mark a new bookmark active'))],
       
  4521          _('hg bookmarks [-f] [-d] [-i] [-m NAME] [-r REV] [NAME]')),
       
  4522     "branch":
       
  4523         (branch,
       
  4524          [('f', 'force', None,
       
  4525            _('set branch name even if it shadows an existing branch')),
       
  4526           ('C', 'clean', None, _('reset branch name to parent branch name'))],
       
  4527          _('[-fC] [NAME]')),
       
  4528     "branches":
       
  4529         (branches,
       
  4530          [('a', 'active', False,
       
  4531            _('show only branches that have unmerged heads')),
       
  4532           ('c', 'closed', False,
       
  4533            _('show normal and closed branches'))],
       
  4534          _('[-ac]')),
       
  4535     "bundle":
       
  4536         (bundle,
       
  4537          [('f', 'force', None,
       
  4538            _('run even when the destination is unrelated')),
       
  4539           ('r', 'rev', [],
       
  4540            _('a changeset intended to be added to the destination'),
       
  4541            _('REV')),
       
  4542           ('b', 'branch', [],
       
  4543            _('a specific branch you would like to bundle'),
       
  4544            _('BRANCH')),
       
  4545           ('', 'base', [],
       
  4546            _('a base changeset assumed to be available at the destination'),
       
  4547            _('REV')),
       
  4548           ('a', 'all', None, _('bundle all changesets in the repository')),
       
  4549           ('t', 'type', 'bzip2',
       
  4550            _('bundle compression type to use'), _('TYPE')),
       
  4551          ] + remoteopts,
       
  4552          _('[-f] [-t TYPE] [-a] [-r REV]... [--base REV]... FILE [DEST]')),
       
  4553     "cat":
       
  4554         (cat,
       
  4555          [('o', 'output', '',
       
  4556           _('print output to file with formatted name'), _('FORMAT')),
       
  4557           ('r', 'rev', '',
       
  4558            _('print the given revision'), _('REV')),
       
  4559           ('', 'decode', None, _('apply any matching decode filter')),
       
  4560          ] + walkopts,
       
  4561          _('[OPTION]... FILE...')),
       
  4562     "^clone":
       
  4563         (clone,
       
  4564          [('U', 'noupdate', None,
       
  4565           _('the clone will include an empty working copy (only a repository)')),
       
  4566           ('u', 'updaterev', '',
       
  4567            _('revision, tag or branch to check out'), _('REV')),
       
  4568           ('r', 'rev', [],
       
  4569            _('include the specified changeset'), _('REV')),
       
  4570           ('b', 'branch', [],
       
  4571            _('clone only the specified branch'), _('BRANCH')),
       
  4572           ('', 'pull', None, _('use pull protocol to copy metadata')),
       
  4573           ('', 'uncompressed', None,
       
  4574            _('use uncompressed transfer (fast over LAN)')),
       
  4575          ] + remoteopts,
       
  4576          _('[OPTION]... SOURCE [DEST]')),
       
  4577     "^commit|ci":
       
  4578         (commit,
       
  4579          [('A', 'addremove', None,
       
  4580            _('mark new/missing files as added/removed before committing')),
       
  4581           ('', 'close-branch', None,
       
  4582            _('mark a branch as closed, hiding it from the branch list')),
       
  4583          ] + walkopts + commitopts + commitopts2,
       
  4584          _('[OPTION]... [FILE]...')),
       
  4585     "copy|cp":
       
  4586         (copy,
       
  4587          [('A', 'after', None, _('record a copy that has already occurred')),
       
  4588           ('f', 'force', None,
       
  4589            _('forcibly copy over an existing managed file')),
       
  4590          ] + walkopts + dryrunopts,
       
  4591          _('[OPTION]... [SOURCE]... DEST')),
       
  4592     "debugancestor": (debugancestor, [], _('[INDEX] REV1 REV2')),
       
  4593     "debugbuilddag":
       
  4594         (debugbuilddag,
       
  4595          [('m', 'mergeable-file', None, _('add single file mergeable changes')),
       
  4596           ('o', 'overwritten-file', None, _('add single file all revs overwrite')),
       
  4597           ('n', 'new-file', None, _('add new file at each rev')),
       
  4598          ],
       
  4599          _('[OPTION]... [TEXT]')),
       
  4600     "debugbundle":
       
  4601         (debugbundle,
       
  4602          [('a', 'all', None, _('show all details')),
       
  4603           ],
       
  4604          _('FILE')),
       
  4605     "debugcheckstate": (debugcheckstate, [], ''),
       
  4606     "debugcommands": (debugcommands, [], _('[COMMAND]')),
       
  4607     "debugcomplete":
       
  4608         (debugcomplete,
       
  4609          [('o', 'options', None, _('show the command options'))],
       
  4610          _('[-o] CMD')),
       
  4611     "debugdag":
       
  4612         (debugdag,
       
  4613          [('t', 'tags', None, _('use tags as labels')),
       
  4614           ('b', 'branches', None, _('annotate with branch names')),
       
  4615           ('', 'dots', None, _('use dots for runs')),
       
  4616           ('s', 'spaces', None, _('separate elements by spaces')),
       
  4617          ],
       
  4618          _('[OPTION]... [FILE [REV]...]')),
       
  4619     "debugdate":
       
  4620         (debugdate,
       
  4621          [('e', 'extended', None, _('try extended date formats'))],
       
  4622          _('[-e] DATE [RANGE]')),
       
  4623     "debugdata": (debugdata, [], _('FILE REV')),
       
  4624     "debugdiscovery": (debugdiscovery,
       
  4625          [('', 'old', None,
       
  4626            _('use old-style discovery')),
       
  4627           ('', 'nonheads', None,
       
  4628            _('use old-style discovery with non-heads included')),
       
  4629          ] + remoteopts,
       
  4630          _('[-l REV] [-r REV] [-b BRANCH]...'
       
  4631            ' [OTHER]')),
       
  4632     "debugfsinfo": (debugfsinfo, [], _('[PATH]')),
       
  4633     "debuggetbundle":
       
  4634         (debuggetbundle,
       
  4635          [('H', 'head', [], _('id of head node'), _('ID')),
       
  4636           ('C', 'common', [], _('id of common node'), _('ID')),
       
  4637           ('t', 'type', 'bzip2', _('bundle compression type to use'), _('TYPE')),
       
  4638          ],
       
  4639          _('REPO FILE [-H|-C ID]...')),
       
  4640     "debugignore": (debugignore, [], ''),
       
  4641     "debugindex": (debugindex,
       
  4642                    [('f', 'format', 0, _('revlog format'), _('FORMAT'))],
       
  4643                    _('FILE')),
       
  4644     "debugindexdot": (debugindexdot, [], _('FILE')),
       
  4645     "debuginstall": (debuginstall, [], ''),
       
  4646     "debugknown": (debugknown, [], _('REPO ID...')),
       
  4647     "debugpushkey": (debugpushkey, [], _('REPO NAMESPACE [KEY OLD NEW]')),
       
  4648     "debugrebuildstate":
       
  4649         (debugrebuildstate,
       
  4650          [('r', 'rev', '',
       
  4651            _('revision to rebuild to'), _('REV'))],
       
  4652          _('[-r REV] [REV]')),
       
  4653     "debugrename":
       
  4654         (debugrename,
       
  4655          [('r', 'rev', '',
       
  4656            _('revision to debug'), _('REV'))],
       
  4657          _('[-r REV] FILE')),
       
  4658     "debugrevspec":
       
  4659         (debugrevspec, [], ('REVSPEC')),
       
  4660     "debugsetparents":
       
  4661         (debugsetparents, [], _('REV1 [REV2]')),
       
  4662     "debugstate":
       
  4663         (debugstate,
       
  4664          [('', 'nodates', None, _('do not display the saved mtime')),
       
  4665           ('', 'datesort', None, _('sort by saved mtime'))],
       
  4666          _('[OPTION]...')),
       
  4667     "debugsub":
       
  4668         (debugsub,
       
  4669          [('r', 'rev', '',
       
  4670            _('revision to check'), _('REV'))],
       
  4671          _('[-r REV] [REV]')),
       
  4672     "debugwalk": (debugwalk, walkopts, _('[OPTION]... [FILE]...')),
       
  4673     "debugwireargs":
       
  4674         (debugwireargs,
       
  4675          [('', 'three', '', 'three'),
       
  4676           ('', 'four', '', 'four'),
       
  4677           ('', 'five', '', 'five'),
       
  4678           ] + remoteopts,
       
  4679          _('REPO [OPTIONS]... [ONE [TWO]]')),
       
  4680     "^diff":
       
  4681         (diff,
       
  4682          [('r', 'rev', [],
       
  4683            _('revision'), _('REV')),
       
  4684           ('c', 'change', '',
       
  4685            _('change made by revision'), _('REV'))
       
  4686          ] + diffopts + diffopts2 + walkopts + subrepoopts,
       
  4687          _('[OPTION]... ([-c REV] | [-r REV1 [-r REV2]]) [FILE]...')),
       
  4688     "^export":
       
  4689         (export,
       
  4690          [('o', 'output', '',
       
  4691            _('print output to file with formatted name'), _('FORMAT')),
       
  4692           ('', 'switch-parent', None, _('diff against the second parent')),
       
  4693           ('r', 'rev', [],
       
  4694            _('revisions to export'), _('REV')),
       
  4695           ] + diffopts,
       
  4696          _('[OPTION]... [-o OUTFILESPEC] REV...')),
       
  4697     "^forget":
       
  4698         (forget,
       
  4699          [] + walkopts,
       
  4700          _('[OPTION]... FILE...')),
       
  4701     "grep":
       
  4702         (grep,
       
  4703          [('0', 'print0', None, _('end fields with NUL')),
       
  4704           ('', 'all', None, _('print all revisions that match')),
       
  4705           ('a', 'text', None, _('treat all files as text')),
       
  4706           ('f', 'follow', None,
       
  4707            _('follow changeset history,'
       
  4708              ' or file history across copies and renames')),
       
  4709           ('i', 'ignore-case', None, _('ignore case when matching')),
       
  4710           ('l', 'files-with-matches', None,
       
  4711            _('print only filenames and revisions that match')),
       
  4712           ('n', 'line-number', None, _('print matching line numbers')),
       
  4713           ('r', 'rev', [],
       
  4714            _('only search files changed within revision range'), _('REV')),
       
  4715           ('u', 'user', None, _('list the author (long with -v)')),
       
  4716           ('d', 'date', None, _('list the date (short with -q)')),
       
  4717          ] + walkopts,
       
  4718          _('[OPTION]... PATTERN [FILE]...')),
       
  4719     "heads":
       
  4720         (heads,
       
  4721          [('r', 'rev', '',
       
  4722            _('show only heads which are descendants of STARTREV'),
       
  4723            _('STARTREV')),
       
  4724           ('t', 'topo', False, _('show topological heads only')),
       
  4725           ('a', 'active', False,
       
  4726            _('show active branchheads only (DEPRECATED)')),
       
  4727           ('c', 'closed', False,
       
  4728            _('show normal and closed branch heads')),
       
  4729          ] + templateopts,
       
  4730          _('[-ac] [-r STARTREV] [REV]...')),
       
  4731     "help": (help_,
       
  4732         [('e', 'extension', None, _('show only help for extensions')),
       
  4733          ('c', 'command', None, _('show only help for commands'))],
       
  4734         _('[-ec] [TOPIC]')),
       
  4735     "identify|id":
       
  4736         (identify,
       
  4737          [('r', 'rev', '',
       
  4738            _('identify the specified revision'), _('REV')),
       
  4739           ('n', 'num', None, _('show local revision number')),
       
  4740           ('i', 'id', None, _('show global revision id')),
       
  4741           ('b', 'branch', None, _('show branch')),
       
  4742           ('t', 'tags', None, _('show tags')),
       
  4743           ('B', 'bookmarks', None, _('show bookmarks'))],
       
  4744          _('[-nibtB] [-r REV] [SOURCE]')),
       
  4745     "import|patch":
       
  4746         (import_,
       
  4747          [('p', 'strip', 1,
       
  4748            _('directory strip option for patch. This has the same '
       
  4749              'meaning as the corresponding patch option'),
       
  4750            _('NUM')),
       
  4751           ('b', 'base', '',
       
  4752            _('base path'), _('PATH')),
       
  4753           ('f', 'force', None,
       
  4754            _('skip check for outstanding uncommitted changes')),
       
  4755           ('', 'no-commit', None,
       
  4756            _("don't commit, just update the working directory")),
       
  4757           ('', 'exact', None,
       
  4758            _('apply patch to the nodes from which it was generated')),
       
  4759           ('', 'import-branch', None,
       
  4760            _('use any branch information in patch (implied by --exact)'))] +
       
  4761          commitopts + commitopts2 + similarityopts,
       
  4762          _('[OPTION]... PATCH...')),
       
  4763     "incoming|in":
       
  4764         (incoming,
       
  4765          [('f', 'force', None,
       
  4766            _('run even if remote repository is unrelated')),
       
  4767           ('n', 'newest-first', None, _('show newest record first')),
       
  4768           ('', 'bundle', '',
       
  4769            _('file to store the bundles into'), _('FILE')),
       
  4770           ('r', 'rev', [],
       
  4771            _('a remote changeset intended to be added'), _('REV')),
       
  4772           ('B', 'bookmarks', False, _("compare bookmarks")),
       
  4773           ('b', 'branch', [],
       
  4774            _('a specific branch you would like to pull'), _('BRANCH')),
       
  4775          ] + logopts + remoteopts + subrepoopts,
       
  4776          _('[-p] [-n] [-M] [-f] [-r REV]...'
       
  4777            ' [--bundle FILENAME] [SOURCE]')),
       
  4778     "^init":
       
  4779         (init,
       
  4780          remoteopts,
       
  4781          _('[-e CMD] [--remotecmd CMD] [DEST]')),
       
  4782     "locate":
       
  4783         (locate,
       
  4784          [('r', 'rev', '',
       
  4785            _('search the repository as it is in REV'), _('REV')),
       
  4786           ('0', 'print0', None,
       
  4787            _('end filenames with NUL, for use with xargs')),
       
  4788           ('f', 'fullpath', None,
       
  4789            _('print complete paths from the filesystem root')),
       
  4790          ] + walkopts,
       
  4791          _('[OPTION]... [PATTERN]...')),
       
  4792     "^log|history":
       
  4793         (log,
       
  4794          [('f', 'follow', None,
       
  4795            _('follow changeset history,'
       
  4796              ' or file history across copies and renames')),
       
  4797           ('', 'follow-first', None,
       
  4798            _('only follow the first parent of merge changesets')),
       
  4799           ('d', 'date', '',
       
  4800            _('show revisions matching date spec'), _('DATE')),
       
  4801           ('C', 'copies', None, _('show copied files')),
       
  4802           ('k', 'keyword', [],
       
  4803            _('do case-insensitive search for a given text'), _('TEXT')),
       
  4804           ('r', 'rev', [],
       
  4805            _('show the specified revision or range'), _('REV')),
       
  4806           ('', 'removed', None, _('include revisions where files were removed')),
       
  4807           ('m', 'only-merges', None, _('show only merges')),
       
  4808           ('u', 'user', [],
       
  4809            _('revisions committed by user'), _('USER')),
       
  4810           ('', 'only-branch', [],
       
  4811            _('show only changesets within the given named branch (DEPRECATED)'),
       
  4812            _('BRANCH')),
       
  4813           ('b', 'branch', [],
       
  4814            _('show changesets within the given named branch'), _('BRANCH')),
       
  4815           ('P', 'prune', [],
       
  4816            _('do not display revision or any of its ancestors'), _('REV')),
       
  4817          ] + logopts + walkopts,
       
  4818          _('[OPTION]... [FILE]')),
       
  4819     "manifest":
       
  4820         (manifest,
       
  4821          [('r', 'rev', '',
       
  4822            _('revision to display'), _('REV'))],
       
  4823          _('[-r REV]')),
       
  4824     "^merge":
       
  4825         (merge,
       
  4826          [('f', 'force', None, _('force a merge with outstanding changes')),
       
  4827           ('t', 'tool', '', _('specify merge tool')),
       
  4828           ('r', 'rev', '',
       
  4829            _('revision to merge'), _('REV')),
       
  4830           ('P', 'preview', None,
       
  4831            _('review revisions to merge (no merge is performed)'))],
       
  4832          _('[-P] [-f] [[-r] REV]')),
       
  4833     "outgoing|out":
       
  4834         (outgoing,
       
  4835          [('f', 'force', None,
       
  4836            _('run even when the destination is unrelated')),
       
  4837           ('r', 'rev', [],
       
  4838            _('a changeset intended to be included in the destination'),
       
  4839            _('REV')),
       
  4840           ('n', 'newest-first', None, _('show newest record first')),
       
  4841           ('B', 'bookmarks', False, _("compare bookmarks")),
       
  4842           ('b', 'branch', [],
       
  4843            _('a specific branch you would like to push'), _('BRANCH')),
       
  4844          ] + logopts + remoteopts + subrepoopts,
       
  4845          _('[-M] [-p] [-n] [-f] [-r REV]... [DEST]')),
       
  4846     "parents":
       
  4847         (parents,
       
  4848          [('r', 'rev', '',
       
  4849            _('show parents of the specified revision'), _('REV')),
       
  4850          ] + templateopts,
       
  4851          _('[-r REV] [FILE]')),
       
  4852     "paths": (paths, [], _('[NAME]')),
       
  4853     "^pull":
       
  4854         (pull,
       
  4855          [('u', 'update', None,
       
  4856            _('update to new branch head if changesets were pulled')),
       
  4857           ('f', 'force', None,
       
  4858            _('run even when remote repository is unrelated')),
       
  4859           ('r', 'rev', [],
       
  4860            _('a remote changeset intended to be added'), _('REV')),
       
  4861           ('B', 'bookmark', [], _("bookmark to pull"), _('BOOKMARK')),
       
  4862           ('b', 'branch', [],
       
  4863            _('a specific branch you would like to pull'), _('BRANCH')),
       
  4864          ] + remoteopts,
       
  4865          _('[-u] [-f] [-r REV]... [-e CMD] [--remotecmd CMD] [SOURCE]')),
       
  4866     "^push":
       
  4867         (push,
       
  4868          [('f', 'force', None, _('force push')),
       
  4869           ('r', 'rev', [],
       
  4870            _('a changeset intended to be included in the destination'),
       
  4871            _('REV')),
       
  4872           ('B', 'bookmark', [], _("bookmark to push"), _('BOOKMARK')),
       
  4873           ('b', 'branch', [],
       
  4874            _('a specific branch you would like to push'), _('BRANCH')),
       
  4875           ('', 'new-branch', False, _('allow pushing a new branch')),
       
  4876          ] + remoteopts,
       
  4877          _('[-f] [-r REV]... [-e CMD] [--remotecmd CMD] [DEST]')),
       
  4878     "recover": (recover, []),
       
  4879     "^remove|rm":
       
  4880         (remove,
       
  4881          [('A', 'after', None, _('record delete for missing files')),
       
  4882           ('f', 'force', None,
       
  4883            _('remove (and delete) file even if added or modified')),
       
  4884          ] + walkopts,
       
  4885          _('[OPTION]... FILE...')),
       
  4886     "rename|move|mv":
       
  4887         (rename,
       
  4888          [('A', 'after', None, _('record a rename that has already occurred')),
       
  4889           ('f', 'force', None,
       
  4890            _('forcibly copy over an existing managed file')),
       
  4891          ] + walkopts + dryrunopts,
       
  4892          _('[OPTION]... SOURCE... DEST')),
       
  4893     "resolve":
       
  4894         (resolve,
       
  4895          [('a', 'all', None, _('select all unresolved files')),
       
  4896           ('l', 'list', None, _('list state of files needing merge')),
       
  4897           ('m', 'mark', None, _('mark files as resolved')),
       
  4898           ('u', 'unmark', None, _('mark files as unresolved')),
       
  4899           ('t', 'tool', '', _('specify merge tool')),
       
  4900           ('n', 'no-status', None, _('hide status prefix'))]
       
  4901           + walkopts,
       
  4902           _('[OPTION]... [FILE]...')),
       
  4903     "revert":
       
  4904         (revert,
       
  4905          [('a', 'all', None, _('revert all changes when no arguments given')),
       
  4906           ('d', 'date', '',
       
  4907            _('tipmost revision matching date'), _('DATE')),
       
  4908           ('r', 'rev', '',
       
  4909            _('revert to the specified revision'), _('REV')),
       
  4910           ('', 'no-backup', None, _('do not save backup copies of files')),
       
  4911          ] + walkopts + dryrunopts,
       
  4912          _('[OPTION]... [-r REV] [NAME]...')),
       
  4913     "rollback": (rollback, dryrunopts),
       
  4914     "root": (root, []),
       
  4915     "^serve":
       
  4916         (serve,
       
  4917          [('A', 'accesslog', '',
       
  4918            _('name of access log file to write to'), _('FILE')),
       
  4919           ('d', 'daemon', None, _('run server in background')),
       
  4920           ('', 'daemon-pipefds', '',
       
  4921            _('used internally by daemon mode'), _('NUM')),
       
  4922           ('E', 'errorlog', '',
       
  4923            _('name of error log file to write to'), _('FILE')),
       
  4924           # use string type, then we can check if something was passed
       
  4925           ('p', 'port', '',
       
  4926            _('port to listen on (default: 8000)'), _('PORT')),
       
  4927           ('a', 'address', '',
       
  4928            _('address to listen on (default: all interfaces)'), _('ADDR')),
       
  4929           ('', 'prefix', '',
       
  4930            _('prefix path to serve from (default: server root)'), _('PREFIX')),
       
  4931           ('n', 'name', '',
       
  4932            _('name to show in web pages (default: working directory)'),
       
  4933            _('NAME')),
       
  4934           ('', 'web-conf', '',
       
  4935            _('name of the hgweb config file (see "hg help hgweb")'),
       
  4936            _('FILE')),
       
  4937           ('', 'webdir-conf', '',
       
  4938            _('name of the hgweb config file (DEPRECATED)'), _('FILE')),
       
  4939           ('', 'pid-file', '',
       
  4940            _('name of file to write process ID to'), _('FILE')),
       
  4941           ('', 'stdio', None, _('for remote clients')),
       
  4942           ('t', 'templates', '',
       
  4943            _('web templates to use'), _('TEMPLATE')),
       
  4944           ('', 'style', '',
       
  4945            _('template style to use'), _('STYLE')),
       
  4946           ('6', 'ipv6', None, _('use IPv6 in addition to IPv4')),
       
  4947           ('', 'certificate', '',
       
  4948            _('SSL certificate file'), _('FILE'))],
       
  4949          _('[OPTION]...')),
       
  4950     "showconfig|debugconfig":
       
  4951         (showconfig,
       
  4952          [('u', 'untrusted', None, _('show untrusted configuration options'))],
       
  4953          _('[-u] [NAME]...')),
       
  4954     "^summary|sum":
       
  4955         (summary,
       
  4956          [('', 'remote', None, _('check for push and pull'))], '[--remote]'),
       
  4957     "^status|st":
       
  4958         (status,
       
  4959          [('A', 'all', None, _('show status of all files')),
       
  4960           ('m', 'modified', None, _('show only modified files')),
       
  4961           ('a', 'added', None, _('show only added files')),
       
  4962           ('r', 'removed', None, _('show only removed files')),
       
  4963           ('d', 'deleted', None, _('show only deleted (but tracked) files')),
       
  4964           ('c', 'clean', None, _('show only files without changes')),
       
  4965           ('u', 'unknown', None, _('show only unknown (not tracked) files')),
       
  4966           ('i', 'ignored', None, _('show only ignored files')),
       
  4967           ('n', 'no-status', None, _('hide status prefix')),
       
  4968           ('C', 'copies', None, _('show source of copied files')),
       
  4969           ('0', 'print0', None,
       
  4970            _('end filenames with NUL, for use with xargs')),
       
  4971           ('', 'rev', [],
       
  4972            _('show difference from revision'), _('REV')),
       
  4973           ('', 'change', '',
       
  4974            _('list the changed files of a revision'), _('REV')),
       
  4975          ] + walkopts + subrepoopts,
       
  4976          _('[OPTION]... [FILE]...')),
       
  4977     "tag":
       
  4978         (tag,
       
  4979          [('f', 'force', None, _('force tag')),
       
  4980           ('l', 'local', None, _('make the tag local')),
       
  4981           ('r', 'rev', '',
       
  4982            _('revision to tag'), _('REV')),
       
  4983           ('', 'remove', None, _('remove a tag')),
       
  4984           # -l/--local is already there, commitopts cannot be used
       
  4985           ('e', 'edit', None, _('edit commit message')),
       
  4986           ('m', 'message', '',
       
  4987            _('use <text> as commit message'), _('TEXT')),
       
  4988          ] + commitopts2,
       
  4989          _('[-f] [-l] [-m TEXT] [-d DATE] [-u USER] [-r REV] NAME...')),
       
  4990     "tags": (tags, [], ''),
       
  4991     "tip":
       
  4992         (tip,
       
  4993          [('p', 'patch', None, _('show patch')),
       
  4994           ('g', 'git', None, _('use git extended diff format')),
       
  4995          ] + templateopts,
       
  4996          _('[-p] [-g]')),
       
  4997     "unbundle":
       
  4998         (unbundle,
       
  4999          [('u', 'update', None,
       
  5000            _('update to new branch head if changesets were unbundled'))],
       
  5001          _('[-u] FILE...')),
       
  5002     "^update|up|checkout|co":
       
  5003         (update,
       
  5004          [('C', 'clean', None, _('discard uncommitted changes (no backup)')),
       
  5005           ('c', 'check', None,
       
  5006            _('update across branches if no uncommitted changes')),
       
  5007           ('d', 'date', '',
       
  5008            _('tipmost revision matching date'), _('DATE')),
       
  5009           ('r', 'rev', '',
       
  5010            _('revision'), _('REV'))],
       
  5011          _('[-c] [-C] [-d DATE] [[-r] REV]')),
       
  5012     "verify": (verify, []),
       
  5013     "version": (version_, []),
       
  5014 }
       
  5015 
       
  5016 norepo = ("clone init version help debugcommands debugcomplete"
  4884 norepo = ("clone init version help debugcommands debugcomplete"
  5017           " debugdate debuginstall debugfsinfo debugpushkey debugwireargs"
  4885           " debugdate debuginstall debugfsinfo debugpushkey debugwireargs"
  5018           " debugknown debuggetbundle debugbundle")
  4886           " debugknown debuggetbundle debugbundle")
  5019 optionalrepo = ("identify paths serve showconfig debugancestor debugdag"
  4887 optionalrepo = ("identify paths serve showconfig debugancestor debugdag"
  5020                 " debugdata debugindex debugindexdot")
  4888                 " debugdata debugindex debugindexdot")