mercurial/commands.py
changeset 40293 c303d65d2e34
parent 40117 dd23eb81a3a3
child 40295 fa88170c10bb
equal deleted inserted replaced
40292:9c6473d2038b 40293:c303d65d2e34
   132 # Commands start here, listed alphabetically
   132 # Commands start here, listed alphabetically
   133 
   133 
   134 @command('^add',
   134 @command('^add',
   135     walkopts + subrepoopts + dryrunopts,
   135     walkopts + subrepoopts + dryrunopts,
   136     _('[OPTION]... [FILE]...'),
   136     _('[OPTION]... [FILE]...'),
       
   137     helpcategory=command.CATEGORY_WORKING_DIRECTORY,
   137     inferrepo=True)
   138     inferrepo=True)
   138 def add(ui, repo, *pats, **opts):
   139 def add(ui, repo, *pats, **opts):
   139     """add the specified files on the next commit
   140     """add the specified files on the next commit
   140 
   141 
   141     Schedule files to be version controlled and added to the
   142     Schedule files to be version controlled and added to the
   183     return rejected and 1 or 0
   184     return rejected and 1 or 0
   184 
   185 
   185 @command('addremove',
   186 @command('addremove',
   186     similarityopts + subrepoopts + walkopts + dryrunopts,
   187     similarityopts + subrepoopts + walkopts + dryrunopts,
   187     _('[OPTION]... [FILE]...'),
   188     _('[OPTION]... [FILE]...'),
       
   189     helpcategory=command.CATEGORY_WORKING_DIRECTORY,
   188     inferrepo=True)
   190     inferrepo=True)
   189 def addremove(ui, repo, *pats, **opts):
   191 def addremove(ui, repo, *pats, **opts):
   190     """add all new files, delete all missing files
   192     """add all new files, delete all missing files
   191 
   193 
   192     Add all new files and remove all missing files from the
   194     Add all new files and remove all missing files from the
   267     ('c', 'changeset', None, _('list the changeset')),
   269     ('c', 'changeset', None, _('list the changeset')),
   268     ('l', 'line-number', None, _('show line number at the first appearance')),
   270     ('l', 'line-number', None, _('show line number at the first appearance')),
   269     ('', 'skip', [], _('revision to not display (EXPERIMENTAL)'), _('REV')),
   271     ('', 'skip', [], _('revision to not display (EXPERIMENTAL)'), _('REV')),
   270     ] + diffwsopts + walkopts + formatteropts,
   272     ] + diffwsopts + walkopts + formatteropts,
   271     _('[-r REV] [-f] [-a] [-u] [-d] [-n] [-c] [-l] FILE...'),
   273     _('[-r REV] [-f] [-a] [-u] [-d] [-n] [-c] [-l] FILE...'),
       
   274     helpcategory=command.CATEGORY_FILE_CONTENTS,
   272     inferrepo=True)
   275     inferrepo=True)
   273 def annotate(ui, repo, *pats, **opts):
   276 def annotate(ui, repo, *pats, **opts):
   274     """show changeset information by line for each file
   277     """show changeset information by line for each file
   275 
   278 
   276     List changes in files, showing the revision id responsible for
   279     List changes in files, showing the revision id responsible for
   449     ('p', 'prefix', '', _('directory prefix for files in archive'),
   452     ('p', 'prefix', '', _('directory prefix for files in archive'),
   450      _('PREFIX')),
   453      _('PREFIX')),
   451     ('r', 'rev', '', _('revision to distribute'), _('REV')),
   454     ('r', 'rev', '', _('revision to distribute'), _('REV')),
   452     ('t', 'type', '', _('type of distribution to create'), _('TYPE')),
   455     ('t', 'type', '', _('type of distribution to create'), _('TYPE')),
   453     ] + subrepoopts + walkopts,
   456     ] + subrepoopts + walkopts,
   454     _('[OPTION]... DEST'))
   457     _('[OPTION]... DEST'),
       
   458     helpcategory=command.CATEGORY_IMPORT_EXPORT)
   455 def archive(ui, repo, dest, **opts):
   459 def archive(ui, repo, dest, **opts):
   456     '''create an unversioned archive of a repository revision
   460     '''create an unversioned archive of a repository revision
   457 
   461 
   458     By default, the revision used is the parent of the working
   462     By default, the revision used is the parent of the working
   459     directory; use -r/--rev to specify a different revision.
   463     directory; use -r/--rev to specify a different revision.
   528     ('', 'parent', '',
   532     ('', 'parent', '',
   529      _('parent to choose when backing out merge (DEPRECATED)'), _('REV')),
   533      _('parent to choose when backing out merge (DEPRECATED)'), _('REV')),
   530     ('r', 'rev', '', _('revision to backout'), _('REV')),
   534     ('r', 'rev', '', _('revision to backout'), _('REV')),
   531     ('e', 'edit', False, _('invoke editor on commit messages')),
   535     ('e', 'edit', False, _('invoke editor on commit messages')),
   532     ] + mergetoolopts + walkopts + commitopts + commitopts2,
   536     ] + mergetoolopts + walkopts + commitopts + commitopts2,
   533     _('[OPTION]... [-r] REV'))
   537     _('[OPTION]... [-r] REV'),
       
   538     helpcategory=command.CATEGORY_CHANGE_MANAGEMENT)
   534 def backout(ui, repo, node=None, rev=None, **opts):
   539 def backout(ui, repo, node=None, rev=None, **opts):
   535     '''reverse effect of earlier changeset
   540     '''reverse effect of earlier changeset
   536 
   541 
   537     Prepare a new changeset with the effect of REV undone in the
   542     Prepare a new changeset with the effect of REV undone in the
   538     current working directory. If no conflicts were encountered,
   543     current working directory. If no conflicts were encountered,
   691     ('b', 'bad', False, _('mark changeset bad')),
   696     ('b', 'bad', False, _('mark changeset bad')),
   692     ('s', 'skip', False, _('skip testing changeset')),
   697     ('s', 'skip', False, _('skip testing changeset')),
   693     ('e', 'extend', False, _('extend the bisect range')),
   698     ('e', 'extend', False, _('extend the bisect range')),
   694     ('c', 'command', '', _('use command to check changeset state'), _('CMD')),
   699     ('c', 'command', '', _('use command to check changeset state'), _('CMD')),
   695     ('U', 'noupdate', False, _('do not update to target'))],
   700     ('U', 'noupdate', False, _('do not update to target'))],
   696     _("[-gbsr] [-U] [-c CMD] [REV]"))
   701     _("[-gbsr] [-U] [-c CMD] [REV]"),
       
   702     helpcategory=command.CATEGORY_CHANGE_NAVIGATION)
   697 def bisect(ui, repo, rev=None, extra=None, command=None,
   703 def bisect(ui, repo, rev=None, extra=None, command=None,
   698                reset=None, good=None, bad=None, skip=None, extend=None,
   704                reset=None, good=None, bad=None, skip=None, extend=None,
   699                noupdate=None):
   705                noupdate=None):
   700     """subdivision search of changesets
   706     """subdivision search of changesets
   701 
   707 
   924     ('d', 'delete', False, _('delete a given bookmark')),
   930     ('d', 'delete', False, _('delete a given bookmark')),
   925     ('m', 'rename', '', _('rename a given bookmark'), _('OLD')),
   931     ('m', 'rename', '', _('rename a given bookmark'), _('OLD')),
   926     ('i', 'inactive', False, _('mark a bookmark inactive')),
   932     ('i', 'inactive', False, _('mark a bookmark inactive')),
   927     ('l', 'list', False, _('list existing bookmarks')),
   933     ('l', 'list', False, _('list existing bookmarks')),
   928     ] + formatteropts,
   934     ] + formatteropts,
   929     _('hg bookmarks [OPTIONS]... [NAME]...'))
   935     _('hg bookmarks [OPTIONS]... [NAME]...'),
       
   936     helpcategory=command.CATEGORY_CHANGE_ORGANIZATION)
   930 def bookmark(ui, repo, *names, **opts):
   937 def bookmark(ui, repo, *names, **opts):
   931     '''create a new bookmark or list existing bookmarks
   938     '''create a new bookmark or list existing bookmarks
   932 
   939 
   933     Bookmarks are labels on changesets to help track lines of development.
   940     Bookmarks are labels on changesets to help track lines of development.
   934     Bookmarks are unversioned and can be moved, renamed and deleted.
   941     Bookmarks are unversioned and can be moved, renamed and deleted.
  1044     [('f', 'force', None,
  1051     [('f', 'force', None,
  1045      _('set branch name even if it shadows an existing branch')),
  1052      _('set branch name even if it shadows an existing branch')),
  1046      ('C', 'clean', None, _('reset branch name to parent branch name')),
  1053      ('C', 'clean', None, _('reset branch name to parent branch name')),
  1047      ('r', 'rev', [], _('change branches of the given revs (EXPERIMENTAL)')),
  1054      ('r', 'rev', [], _('change branches of the given revs (EXPERIMENTAL)')),
  1048     ],
  1055     ],
  1049     _('[-fC] [NAME]'))
  1056     _('[-fC] [NAME]'),
       
  1057     helpcategory=command.CATEGORY_CHANGE_ORGANIZATION)
  1050 def branch(ui, repo, label=None, **opts):
  1058 def branch(ui, repo, label=None, **opts):
  1051     """set or show the current branch name
  1059     """set or show the current branch name
  1052 
  1060 
  1053     .. note::
  1061     .. note::
  1054 
  1062 
  1119     [('a', 'active', False,
  1127     [('a', 'active', False,
  1120       _('show only branches that have unmerged heads (DEPRECATED)')),
  1128       _('show only branches that have unmerged heads (DEPRECATED)')),
  1121      ('c', 'closed', False, _('show normal and closed branches')),
  1129      ('c', 'closed', False, _('show normal and closed branches')),
  1122     ] + formatteropts,
  1130     ] + formatteropts,
  1123     _('[-c]'),
  1131     _('[-c]'),
       
  1132     helpcategory=command.CATEGORY_CHANGE_ORGANIZATION,
  1124     intents={INTENT_READONLY})
  1133     intents={INTENT_READONLY})
  1125 def branches(ui, repo, active=False, closed=False, **opts):
  1134 def branches(ui, repo, active=False, closed=False, **opts):
  1126     """list repository named branches
  1135     """list repository named branches
  1127 
  1136 
  1128     List the repository's named branches, indicating which ones are
  1137     List the repository's named branches, indicating which ones are
  1204      _('a base changeset assumed to be available at the destination'),
  1213      _('a base changeset assumed to be available at the destination'),
  1205      _('REV')),
  1214      _('REV')),
  1206     ('a', 'all', None, _('bundle all changesets in the repository')),
  1215     ('a', 'all', None, _('bundle all changesets in the repository')),
  1207     ('t', 'type', 'bzip2', _('bundle compression type to use'), _('TYPE')),
  1216     ('t', 'type', 'bzip2', _('bundle compression type to use'), _('TYPE')),
  1208     ] + remoteopts,
  1217     ] + remoteopts,
  1209     _('[-f] [-t BUNDLESPEC] [-a] [-r REV]... [--base REV]... FILE [DEST]'))
  1218     _('[-f] [-t BUNDLESPEC] [-a] [-r REV]... [--base REV]... FILE [DEST]'),
       
  1219     helpcategory=command.CATEGORY_IMPORT_EXPORT)
  1210 def bundle(ui, repo, fname, dest=None, **opts):
  1220 def bundle(ui, repo, fname, dest=None, **opts):
  1211     """create a bundle file
  1221     """create a bundle file
  1212 
  1222 
  1213     Generate a bundle file containing data to be transferred to another
  1223     Generate a bundle file containing data to be transferred to another
  1214     repository.
  1224     repository.
  1331      _('print output to file with formatted name'), _('FORMAT')),
  1341      _('print output to file with formatted name'), _('FORMAT')),
  1332     ('r', 'rev', '', _('print the given revision'), _('REV')),
  1342     ('r', 'rev', '', _('print the given revision'), _('REV')),
  1333     ('', 'decode', None, _('apply any matching decode filter')),
  1343     ('', 'decode', None, _('apply any matching decode filter')),
  1334     ] + walkopts + formatteropts,
  1344     ] + walkopts + formatteropts,
  1335     _('[OPTION]... FILE...'),
  1345     _('[OPTION]... FILE...'),
       
  1346     helpcategory=command.CATEGORY_FILE_CONTENTS,
  1336     inferrepo=True,
  1347     inferrepo=True,
  1337     intents={INTENT_READONLY})
  1348     intents={INTENT_READONLY})
  1338 def cat(ui, repo, file1, *pats, **opts):
  1349 def cat(ui, repo, file1, *pats, **opts):
  1339     """output the current or given revision of files
  1350     """output the current or given revision of files
  1340 
  1351 
  1402        _('an alias to --stream (DEPRECATED)')),
  1413        _('an alias to --stream (DEPRECATED)')),
  1403     ('', 'stream', None,
  1414     ('', 'stream', None,
  1404        _('clone with minimal data processing')),
  1415        _('clone with minimal data processing')),
  1405     ] + remoteopts,
  1416     ] + remoteopts,
  1406     _('[OPTION]... SOURCE [DEST]'),
  1417     _('[OPTION]... SOURCE [DEST]'),
       
  1418     helpcategory=command.CATEGORY_REPO_CREATION,
  1407     norepo=True)
  1419     norepo=True)
  1408 def clone(ui, source, dest=None, **opts):
  1420 def clone(ui, source, dest=None, **opts):
  1409     """make a copy of an existing repository
  1421     """make a copy of an existing repository
  1410 
  1422 
  1411     Create a copy of an existing repository in a new directory.
  1423     Create a copy of an existing repository in a new directory.
  1552     ('s', 'secret', None, _('use the secret phase for committing')),
  1564     ('s', 'secret', None, _('use the secret phase for committing')),
  1553     ('e', 'edit', None, _('invoke editor on commit messages')),
  1565     ('e', 'edit', None, _('invoke editor on commit messages')),
  1554     ('i', 'interactive', None, _('use interactive mode')),
  1566     ('i', 'interactive', None, _('use interactive mode')),
  1555     ] + walkopts + commitopts + commitopts2 + subrepoopts,
  1567     ] + walkopts + commitopts + commitopts2 + subrepoopts,
  1556     _('[OPTION]... [FILE]...'),
  1568     _('[OPTION]... [FILE]...'),
       
  1569     helpcategory=command.CATEGORY_COMMITTING,
  1557     inferrepo=True)
  1570     inferrepo=True)
  1558 def commit(ui, repo, *pats, **opts):
  1571 def commit(ui, repo, *pats, **opts):
  1559     """commit the specified files or all outstanding changes
  1572     """commit the specified files or all outstanding changes
  1560 
  1573 
  1561     Commit changes to the given files into the repository. Unlike a
  1574     Commit changes to the given files into the repository. Unlike a
  1704     [('u', 'untrusted', None, _('show untrusted configuration options')),
  1717     [('u', 'untrusted', None, _('show untrusted configuration options')),
  1705      ('e', 'edit', None, _('edit user config')),
  1718      ('e', 'edit', None, _('edit user config')),
  1706      ('l', 'local', None, _('edit repository config')),
  1719      ('l', 'local', None, _('edit repository config')),
  1707      ('g', 'global', None, _('edit global config'))] + formatteropts,
  1720      ('g', 'global', None, _('edit global config'))] + formatteropts,
  1708     _('[-u] [NAME]...'),
  1721     _('[-u] [NAME]...'),
       
  1722     helpcategory=command.CATEGORY_HELP,
  1709     optionalrepo=True,
  1723     optionalrepo=True,
  1710     intents={INTENT_READONLY})
  1724     intents={INTENT_READONLY})
  1711 def config(ui, repo, *values, **opts):
  1725 def config(ui, repo, *values, **opts):
  1712     """show combined config settings from all hgrc files
  1726     """show combined config settings from all hgrc files
  1713 
  1727 
  1822 
  1836 
  1823 @command('copy|cp',
  1837 @command('copy|cp',
  1824     [('A', 'after', None, _('record a copy that has already occurred')),
  1838     [('A', 'after', None, _('record a copy that has already occurred')),
  1825     ('f', 'force', None, _('forcibly copy over an existing managed file')),
  1839     ('f', 'force', None, _('forcibly copy over an existing managed file')),
  1826     ] + walkopts + dryrunopts,
  1840     ] + walkopts + dryrunopts,
  1827     _('[OPTION]... [SOURCE]... DEST'))
  1841     _('[OPTION]... [SOURCE]... DEST'),
       
  1842     helpcategory=command.CATEGORY_FILE_CONTENTS)
  1828 def copy(ui, repo, *pats, **opts):
  1843 def copy(ui, repo, *pats, **opts):
  1829     """mark files as copied for the next commit
  1844     """mark files as copied for the next commit
  1830 
  1845 
  1831     Mark dest as having copies of source files. If dest is a
  1846     Mark dest as having copies of source files. If dest is a
  1832     directory, copies are put in that directory. If dest is a file,
  1847     directory, copies are put in that directory. If dest is a file,
  1843     """
  1858     """
  1844     opts = pycompat.byteskwargs(opts)
  1859     opts = pycompat.byteskwargs(opts)
  1845     with repo.wlock(False):
  1860     with repo.wlock(False):
  1846         return cmdutil.copy(ui, repo, pats, opts)
  1861         return cmdutil.copy(ui, repo, pats, opts)
  1847 
  1862 
  1848 @command('debugcommands', [], _('[COMMAND]'), norepo=True)
  1863 @command(
       
  1864     'debugcommands', [], _('[COMMAND]'),
       
  1865     helpcategory=command.CATEGORY_HELP,
       
  1866     norepo=True)
  1849 def debugcommands(ui, cmd='', *args):
  1867 def debugcommands(ui, cmd='', *args):
  1850     """list all available commands and options"""
  1868     """list all available commands and options"""
  1851     for cmd, vals in sorted(table.iteritems()):
  1869     for cmd, vals in sorted(table.iteritems()):
  1852         cmd = cmd.split('|')[0].strip('^')
  1870         cmd = cmd.split('|')[0].strip('^')
  1853         opts = ', '.join([i[1] for i in vals[1]])
  1871         opts = ', '.join([i[1] for i in vals[1]])
  1854         ui.write('%s: %s\n' % (cmd, opts))
  1872         ui.write('%s: %s\n' % (cmd, opts))
  1855 
  1873 
  1856 @command('debugcomplete',
  1874 @command('debugcomplete',
  1857     [('o', 'options', None, _('show the command options'))],
  1875     [('o', 'options', None, _('show the command options'))],
  1858     _('[-o] CMD'),
  1876     _('[-o] CMD'),
       
  1877     helpcategory=command.CATEGORY_HELP,
  1859     norepo=True)
  1878     norepo=True)
  1860 def debugcomplete(ui, cmd='', **opts):
  1879 def debugcomplete(ui, cmd='', **opts):
  1861     """returns the completion list associated with the given command"""
  1880     """returns the completion list associated with the given command"""
  1862 
  1881 
  1863     if opts.get(r'options'):
  1882     if opts.get(r'options'):
  1884 @command('^diff',
  1903 @command('^diff',
  1885     [('r', 'rev', [], _('revision'), _('REV')),
  1904     [('r', 'rev', [], _('revision'), _('REV')),
  1886     ('c', 'change', '', _('change made by revision'), _('REV'))
  1905     ('c', 'change', '', _('change made by revision'), _('REV'))
  1887     ] + diffopts + diffopts2 + walkopts + subrepoopts,
  1906     ] + diffopts + diffopts2 + walkopts + subrepoopts,
  1888     _('[OPTION]... ([-c REV] | [-r REV1 [-r REV2]]) [FILE]...'),
  1907     _('[OPTION]... ([-c REV] | [-r REV1 [-r REV2]]) [FILE]...'),
       
  1908     helpcategory=command.CATEGORY_FILE_CONTENTS,
  1889     inferrepo=True,
  1909     inferrepo=True,
  1890     intents={INTENT_READONLY})
  1910     intents={INTENT_READONLY})
  1891 def diff(ui, repo, *pats, **opts):
  1911 def diff(ui, repo, *pats, **opts):
  1892     """diff repository (or selected files)
  1912     """diff repository (or selected files)
  1893 
  1913 
  1982      _('print output to file with formatted name'), _('FORMAT')),
  2002      _('print output to file with formatted name'), _('FORMAT')),
  1983     ('', 'switch-parent', None, _('diff against the second parent')),
  2003     ('', 'switch-parent', None, _('diff against the second parent')),
  1984     ('r', 'rev', [], _('revisions to export'), _('REV')),
  2004     ('r', 'rev', [], _('revisions to export'), _('REV')),
  1985     ] + diffopts + formatteropts,
  2005     ] + diffopts + formatteropts,
  1986     _('[OPTION]... [-o OUTFILESPEC] [-r] [REV]...'),
  2006     _('[OPTION]... [-o OUTFILESPEC] [-r] [REV]...'),
       
  2007     helpcategory=command.CATEGORY_IMPORT_EXPORT,
  1987     intents={INTENT_READONLY})
  2008     intents={INTENT_READONLY})
  1988 def export(ui, repo, *changesets, **opts):
  2009 def export(ui, repo, *changesets, **opts):
  1989     """dump the header and diffs for one or more changesets
  2010     """dump the header and diffs for one or more changesets
  1990 
  2011 
  1991     Print the changeset header and diffs for one or more revisions.
  2012     Print the changeset header and diffs for one or more revisions.
  2102 @command('files',
  2123 @command('files',
  2103     [('r', 'rev', '', _('search the repository as it is in REV'), _('REV')),
  2124     [('r', 'rev', '', _('search the repository as it is in REV'), _('REV')),
  2104      ('0', 'print0', None, _('end filenames with NUL, for use with xargs')),
  2125      ('0', 'print0', None, _('end filenames with NUL, for use with xargs')),
  2105     ] + walkopts + formatteropts + subrepoopts,
  2126     ] + walkopts + formatteropts + subrepoopts,
  2106     _('[OPTION]... [FILE]...'),
  2127     _('[OPTION]... [FILE]...'),
       
  2128     helpcategory=command.CATEGORY_WORKING_DIRECTORY,
  2107     intents={INTENT_READONLY})
  2129     intents={INTENT_READONLY})
  2108 def files(ui, repo, *pats, **opts):
  2130 def files(ui, repo, *pats, **opts):
  2109     """list tracked files
  2131     """list tracked files
  2110 
  2132 
  2111     Print files under Mercurial control in the working directory or
  2133     Print files under Mercurial control in the working directory or
  2177 
  2199 
  2178 @command(
  2200 @command(
  2179     '^forget',
  2201     '^forget',
  2180     [('i', 'interactive', None, _('use interactive mode')),
  2202     [('i', 'interactive', None, _('use interactive mode')),
  2181     ] + walkopts + dryrunopts,
  2203     ] + walkopts + dryrunopts,
  2182     _('[OPTION]... FILE...'), inferrepo=True)
  2204     _('[OPTION]... FILE...'),
       
  2205     helpcategory=command.CATEGORY_WORKING_DIRECTORY,
       
  2206     inferrepo=True)
  2183 def forget(ui, repo, *pats, **opts):
  2207 def forget(ui, repo, *pats, **opts):
  2184     """forget the specified files on the next commit
  2208     """forget the specified files on the next commit
  2185 
  2209 
  2186     Mark the specified files so they will no longer be tracked
  2210     Mark the specified files so they will no longer be tracked
  2187     after the next commit.
  2211     after the next commit.
  2234      ('D', 'currentdate', False,
  2258      ('D', 'currentdate', False,
  2235       _('record the current date as commit date')),
  2259       _('record the current date as commit date')),
  2236      ('U', 'currentuser', False,
  2260      ('U', 'currentuser', False,
  2237       _('record the current user as committer'), _('DATE'))]
  2261       _('record the current user as committer'), _('DATE'))]
  2238     + commitopts2 + mergetoolopts  + dryrunopts,
  2262     + commitopts2 + mergetoolopts  + dryrunopts,
  2239     _('[OPTION]... [-r REV]... REV...'))
  2263     _('[OPTION]... [-r REV]... REV...'),
       
  2264     helpcategory=command.CATEGORY_CHANGE_MANAGEMENT)
  2240 def graft(ui, repo, *revs, **opts):
  2265 def graft(ui, repo, *revs, **opts):
  2241     '''copy changes from other branches onto the current branch
  2266     '''copy changes from other branches onto the current branch
  2242 
  2267 
  2243     This command uses Mercurial's merge logic to copy individual
  2268     This command uses Mercurial's merge logic to copy individual
  2244     changes from other branches without merging branches in the
  2269     changes from other branches without merging branches in the
  2622      _('include all files in the changeset while grepping (EXPERIMENTAL)')),
  2647      _('include all files in the changeset while grepping (EXPERIMENTAL)')),
  2623     ('u', 'user', None, _('list the author (long with -v)')),
  2648     ('u', 'user', None, _('list the author (long with -v)')),
  2624     ('d', 'date', None, _('list the date (short with -q)')),
  2649     ('d', 'date', None, _('list the date (short with -q)')),
  2625     ] + formatteropts + walkopts,
  2650     ] + formatteropts + walkopts,
  2626     _('[OPTION]... PATTERN [FILE]...'),
  2651     _('[OPTION]... PATTERN [FILE]...'),
       
  2652     helpcategory=command.CATEGORY_FILE_CONTENTS,
  2627     inferrepo=True,
  2653     inferrepo=True,
  2628     intents={INTENT_READONLY})
  2654     intents={INTENT_READONLY})
  2629 def grep(ui, repo, pattern, *pats, **opts):
  2655 def grep(ui, repo, pattern, *pats, **opts):
  2630     """search revision history for a pattern in specified files
  2656     """search revision history for a pattern in specified files
  2631 
  2657 
  2915     ('t', 'topo', False, _('show topological heads only')),
  2941     ('t', 'topo', False, _('show topological heads only')),
  2916     ('a', 'active', False, _('show active branchheads only (DEPRECATED)')),
  2942     ('a', 'active', False, _('show active branchheads only (DEPRECATED)')),
  2917     ('c', 'closed', False, _('show normal and closed branch heads')),
  2943     ('c', 'closed', False, _('show normal and closed branch heads')),
  2918     ] + templateopts,
  2944     ] + templateopts,
  2919     _('[-ct] [-r STARTREV] [REV]...'),
  2945     _('[-ct] [-r STARTREV] [REV]...'),
       
  2946     helpcategory=command.CATEGORY_CHANGE_NAVIGATION,
  2920     intents={INTENT_READONLY})
  2947     intents={INTENT_READONLY})
  2921 def heads(ui, repo, *branchrevs, **opts):
  2948 def heads(ui, repo, *branchrevs, **opts):
  2922     """show branch heads
  2949     """show branch heads
  2923 
  2950 
  2924     With no arguments, show all open branch heads in the repository.
  2951     With no arguments, show all open branch heads in the repository.
  2991      ('c', 'command', None, _('show only help for commands')),
  3018      ('c', 'command', None, _('show only help for commands')),
  2992      ('k', 'keyword', None, _('show topics matching keyword')),
  3019      ('k', 'keyword', None, _('show topics matching keyword')),
  2993      ('s', 'system', [], _('show help for specific platform(s)')),
  3020      ('s', 'system', [], _('show help for specific platform(s)')),
  2994      ],
  3021      ],
  2995     _('[-ecks] [TOPIC]'),
  3022     _('[-ecks] [TOPIC]'),
       
  3023     helpcategory=command.CATEGORY_HELP,
  2996     norepo=True,
  3024     norepo=True,
  2997     intents={INTENT_READONLY})
  3025     intents={INTENT_READONLY})
  2998 def help_(ui, name=None, **opts):
  3026 def help_(ui, name=None, **opts):
  2999     """show help for a given topic or a help overview
  3027     """show help for a given topic or a help overview
  3000 
  3028 
  3034     ('b', 'branch', None, _('show branch')),
  3062     ('b', 'branch', None, _('show branch')),
  3035     ('t', 'tags', None, _('show tags')),
  3063     ('t', 'tags', None, _('show tags')),
  3036     ('B', 'bookmarks', None, _('show bookmarks')),
  3064     ('B', 'bookmarks', None, _('show bookmarks')),
  3037     ] + remoteopts + formatteropts,
  3065     ] + remoteopts + formatteropts,
  3038     _('[-nibtB] [-r REV] [SOURCE]'),
  3066     _('[-nibtB] [-r REV] [SOURCE]'),
       
  3067     helpcategory=command.CATEGORY_CHANGE_NAVIGATION,
  3039     optionalrepo=True,
  3068     optionalrepo=True,
  3040     intents={INTENT_READONLY})
  3069     intents={INTENT_READONLY})
  3041 def identify(ui, repo, source=None, rev=None,
  3070 def identify(ui, repo, source=None, rev=None,
  3042              num=None, id=None, branch=None, tags=None, bookmarks=None, **opts):
  3071              num=None, id=None, branch=None, tags=None, bookmarks=None, **opts):
  3043     """identify the working directory or specified revision
  3072     """identify the working directory or specified revision
  3232     ('', 'prefix', '',
  3261     ('', 'prefix', '',
  3233      _('apply patch to subdirectory'), _('DIR')),
  3262      _('apply patch to subdirectory'), _('DIR')),
  3234     ('', 'import-branch', None,
  3263     ('', 'import-branch', None,
  3235      _('use any branch information in patch (implied by --exact)'))] +
  3264      _('use any branch information in patch (implied by --exact)'))] +
  3236     commitopts + commitopts2 + similarityopts,
  3265     commitopts + commitopts2 + similarityopts,
  3237     _('[OPTION]... PATCH...'))
  3266     _('[OPTION]... PATCH...'),
       
  3267     helpcategory=command.CATEGORY_IMPORT_EXPORT)
  3238 def import_(ui, repo, patch1=None, *patches, **opts):
  3268 def import_(ui, repo, patch1=None, *patches, **opts):
  3239     """import an ordered set of patches
  3269     """import an ordered set of patches
  3240 
  3270 
  3241     Import a list of patches and commit them individually (unless
  3271     Import a list of patches and commit them individually (unless
  3242     --no-commit is specified).
  3272     --no-commit is specified).
  3429     ('r', 'rev', [], _('a remote changeset intended to be added'), _('REV')),
  3459     ('r', 'rev', [], _('a remote changeset intended to be added'), _('REV')),
  3430     ('B', 'bookmarks', False, _("compare bookmarks")),
  3460     ('B', 'bookmarks', False, _("compare bookmarks")),
  3431     ('b', 'branch', [],
  3461     ('b', 'branch', [],
  3432      _('a specific branch you would like to pull'), _('BRANCH')),
  3462      _('a specific branch you would like to pull'), _('BRANCH')),
  3433     ] + logopts + remoteopts + subrepoopts,
  3463     ] + logopts + remoteopts + subrepoopts,
  3434     _('[-p] [-n] [-M] [-f] [-r REV]... [--bundle FILENAME] [SOURCE]'))
  3464     _('[-p] [-n] [-M] [-f] [-r REV]... [--bundle FILENAME] [SOURCE]'),
       
  3465     helpcategory=command.CATEGORY_REMOTE_REPO_MANAGEMENT)
  3435 def incoming(ui, repo, source="default", **opts):
  3466 def incoming(ui, repo, source="default", **opts):
  3436     """show new changesets found in source
  3467     """show new changesets found in source
  3437 
  3468 
  3438     Show new changesets found in the specified path/URL or the default
  3469     Show new changesets found in the specified path/URL or the default
  3439     pull location. These are the changesets that would have been pulled
  3470     pull location. These are the changesets that would have been pulled
  3517     finally:
  3548     finally:
  3518         del repo._subtoppath
  3549         del repo._subtoppath
  3519 
  3550 
  3520 
  3551 
  3521 @command('^init', remoteopts, _('[-e CMD] [--remotecmd CMD] [DEST]'),
  3552 @command('^init', remoteopts, _('[-e CMD] [--remotecmd CMD] [DEST]'),
       
  3553         helpcategory=command.CATEGORY_REPO_CREATION,
  3522          norepo=True)
  3554          norepo=True)
  3523 def init(ui, dest=".", **opts):
  3555 def init(ui, dest=".", **opts):
  3524     """create a new repository in the given directory
  3556     """create a new repository in the given directory
  3525 
  3557 
  3526     Initialize a new repository in the given directory. If the given
  3558     Initialize a new repository in the given directory. If the given
  3539 @command('locate',
  3571 @command('locate',
  3540     [('r', 'rev', '', _('search the repository as it is in REV'), _('REV')),
  3572     [('r', 'rev', '', _('search the repository as it is in REV'), _('REV')),
  3541     ('0', 'print0', None, _('end filenames with NUL, for use with xargs')),
  3573     ('0', 'print0', None, _('end filenames with NUL, for use with xargs')),
  3542     ('f', 'fullpath', None, _('print complete paths from the filesystem root')),
  3574     ('f', 'fullpath', None, _('print complete paths from the filesystem root')),
  3543     ] + walkopts,
  3575     ] + walkopts,
  3544     _('[OPTION]... [PATTERN]...'))
  3576     _('[OPTION]... [PATTERN]...'),
       
  3577     helpcategory=command.CATEGORY_WORKING_DIRECTORY)
  3545 def locate(ui, repo, *pats, **opts):
  3578 def locate(ui, repo, *pats, **opts):
  3546     """locate files matching specific patterns (DEPRECATED)
  3579     """locate files matching specific patterns (DEPRECATED)
  3547 
  3580 
  3548     Print files under Mercurial control in the working directory whose
  3581     Print files under Mercurial control in the working directory whose
  3549     names match the given patterns.
  3582     names match the given patterns.
  3614      _('show changesets within the given named branch'), _('BRANCH')),
  3647      _('show changesets within the given named branch'), _('BRANCH')),
  3615     ('P', 'prune', [],
  3648     ('P', 'prune', [],
  3616      _('do not display revision or any of its ancestors'), _('REV')),
  3649      _('do not display revision or any of its ancestors'), _('REV')),
  3617     ] + logopts + walkopts,
  3650     ] + logopts + walkopts,
  3618     _('[OPTION]... [FILE]'),
  3651     _('[OPTION]... [FILE]'),
       
  3652     helpcategory=command.CATEGORY_CHANGE_NAVIGATION,
  3619     inferrepo=True,
  3653     inferrepo=True,
  3620     intents={INTENT_READONLY})
  3654     intents={INTENT_READONLY})
  3621 def log(ui, repo, *pats, **opts):
  3655 def log(ui, repo, *pats, **opts):
  3622     """show revision history of entire repository or files
  3656     """show revision history of entire repository or files
  3623 
  3657 
  3784 @command('manifest',
  3818 @command('manifest',
  3785     [('r', 'rev', '', _('revision to display'), _('REV')),
  3819     [('r', 'rev', '', _('revision to display'), _('REV')),
  3786      ('', 'all', False, _("list files from all revisions"))]
  3820      ('', 'all', False, _("list files from all revisions"))]
  3787          + formatteropts,
  3821          + formatteropts,
  3788     _('[-r REV]'),
  3822     _('[-r REV]'),
       
  3823     helpcategory=command.CATEGORY_MAINTENANCE,
  3789     intents={INTENT_READONLY})
  3824     intents={INTENT_READONLY})
  3790 def manifest(ui, repo, node=None, rev=None, **opts):
  3825 def manifest(ui, repo, node=None, rev=None, **opts):
  3791     """output the current or given revision of the project manifest
  3826     """output the current or given revision of the project manifest
  3792 
  3827 
  3793     Print a list of version controlled files for the given revision.
  3828     Print a list of version controlled files for the given revision.
  3849     ('r', 'rev', '', _('revision to merge'), _('REV')),
  3884     ('r', 'rev', '', _('revision to merge'), _('REV')),
  3850     ('P', 'preview', None,
  3885     ('P', 'preview', None,
  3851      _('review revisions to merge (no merge is performed)')),
  3886      _('review revisions to merge (no merge is performed)')),
  3852     ('', 'abort', None, _('abort the ongoing merge')),
  3887     ('', 'abort', None, _('abort the ongoing merge')),
  3853      ] + mergetoolopts,
  3888      ] + mergetoolopts,
  3854     _('[-P] [[-r] REV]'))
  3889     _('[-P] [[-r] REV]'),
       
  3890     helpcategory=command.CATEGORY_CHANGE_MANAGEMENT)
  3855 def merge(ui, repo, node=None, **opts):
  3891 def merge(ui, repo, node=None, **opts):
  3856     """merge another revision into working directory
  3892     """merge another revision into working directory
  3857 
  3893 
  3858     The current working directory is updated with all changes made in
  3894     The current working directory is updated with all changes made in
  3859     the requested revision since the last common predecessor revision.
  3895     the requested revision since the last common predecessor revision.
  3930     ('n', 'newest-first', None, _('show newest record first')),
  3966     ('n', 'newest-first', None, _('show newest record first')),
  3931     ('B', 'bookmarks', False, _('compare bookmarks')),
  3967     ('B', 'bookmarks', False, _('compare bookmarks')),
  3932     ('b', 'branch', [], _('a specific branch you would like to push'),
  3968     ('b', 'branch', [], _('a specific branch you would like to push'),
  3933      _('BRANCH')),
  3969      _('BRANCH')),
  3934     ] + logopts + remoteopts + subrepoopts,
  3970     ] + logopts + remoteopts + subrepoopts,
  3935     _('[-M] [-p] [-n] [-f] [-r REV]... [DEST]'))
  3971     _('[-M] [-p] [-n] [-f] [-r REV]... [DEST]'),
       
  3972     helpcategory=command.CATEGORY_REMOTE_REPO_MANAGEMENT)
  3936 def outgoing(ui, repo, dest=None, **opts):
  3973 def outgoing(ui, repo, dest=None, **opts):
  3937     """show changesets not found in the destination
  3974     """show changesets not found in the destination
  3938 
  3975 
  3939     Show changesets not found in the specified destination repository
  3976     Show changesets not found in the specified destination repository
  3940     or the default push location. These are the changesets that would
  3977     or the default push location. These are the changesets that would
  4010 
  4047 
  4011 @command('parents',
  4048 @command('parents',
  4012     [('r', 'rev', '', _('show parents of the specified revision'), _('REV')),
  4049     [('r', 'rev', '', _('show parents of the specified revision'), _('REV')),
  4013     ] + templateopts,
  4050     ] + templateopts,
  4014     _('[-r REV] [FILE]'),
  4051     _('[-r REV] [FILE]'),
       
  4052     helpcategory=command.CATEGORY_CHANGE_NAVIGATION,
  4015     inferrepo=True)
  4053     inferrepo=True)
  4016 def parents(ui, repo, file_=None, **opts):
  4054 def parents(ui, repo, file_=None, **opts):
  4017     """show the parents of the working directory or revision (DEPRECATED)
  4055     """show the parents of the working directory or revision (DEPRECATED)
  4018 
  4056 
  4019     Print the working directory's parent revisions. If a revision is
  4057     Print the working directory's parent revisions. If a revision is
  4066     for n in p:
  4104     for n in p:
  4067         if n != nullid:
  4105         if n != nullid:
  4068             displayer.show(repo[n])
  4106             displayer.show(repo[n])
  4069     displayer.close()
  4107     displayer.close()
  4070 
  4108 
  4071 @command('paths', formatteropts, _('[NAME]'), optionalrepo=True,
  4109 @command('paths', formatteropts, _('[NAME]'),
  4072     intents={INTENT_READONLY})
  4110     helpcategory=command.CATEGORY_REMOTE_REPO_MANAGEMENT,
       
  4111     optionalrepo=True, intents={INTENT_READONLY})
  4073 def paths(ui, repo, search=None, **opts):
  4112 def paths(ui, repo, search=None, **opts):
  4074     """show aliases for remote repositories
  4113     """show aliases for remote repositories
  4075 
  4114 
  4076     Show definition of symbolic path name NAME. If no name is given,
  4115     Show definition of symbolic path name NAME. If no name is given,
  4077     show definition of all available names.
  4116     show definition of all available names.
  4155      ('d', 'draft', False, _('set changeset phase to draft')),
  4194      ('d', 'draft', False, _('set changeset phase to draft')),
  4156      ('s', 'secret', False, _('set changeset phase to secret')),
  4195      ('s', 'secret', False, _('set changeset phase to secret')),
  4157      ('f', 'force', False, _('allow to move boundary backward')),
  4196      ('f', 'force', False, _('allow to move boundary backward')),
  4158      ('r', 'rev', [], _('target revision'), _('REV')),
  4197      ('r', 'rev', [], _('target revision'), _('REV')),
  4159     ],
  4198     ],
  4160     _('[-p|-d|-s] [-f] [-r] [REV...]'))
  4199     _('[-p|-d|-s] [-f] [-r] [REV...]'),
       
  4200     helpcategory=command.CATEGORY_CHANGE_ORGANIZATION)
  4161 def phase(ui, repo, *revs, **opts):
  4201 def phase(ui, repo, *revs, **opts):
  4162     """set or show the current phase name
  4202     """set or show the current phase name
  4163 
  4203 
  4164     With no argument, show the phase name of the current revision(s).
  4204     With no argument, show the phase name of the current revision(s).
  4165 
  4205 
  4272     ('r', 'rev', [], _('a remote changeset intended to be added'), _('REV')),
  4312     ('r', 'rev', [], _('a remote changeset intended to be added'), _('REV')),
  4273     ('B', 'bookmark', [], _("bookmark to pull"), _('BOOKMARK')),
  4313     ('B', 'bookmark', [], _("bookmark to pull"), _('BOOKMARK')),
  4274     ('b', 'branch', [], _('a specific branch you would like to pull'),
  4314     ('b', 'branch', [], _('a specific branch you would like to pull'),
  4275      _('BRANCH')),
  4315      _('BRANCH')),
  4276     ] + remoteopts,
  4316     ] + remoteopts,
  4277     _('[-u] [-f] [-r REV]... [-e CMD] [--remotecmd CMD] [SOURCE]'))
  4317     _('[-u] [-f] [-r REV]... [-e CMD] [--remotecmd CMD] [SOURCE]'),
       
  4318     helpcategory=command.CATEGORY_REMOTE_REPO_MANAGEMENT)
  4278 def pull(ui, repo, source="default", **opts):
  4319 def pull(ui, repo, source="default", **opts):
  4279     """pull changes from the specified source
  4320     """pull changes from the specified source
  4280 
  4321 
  4281     Pull changes from a remote repository to a local one.
  4322     Pull changes from a remote repository to a local one.
  4282 
  4323 
  4403     ('b', 'branch', [],
  4444     ('b', 'branch', [],
  4404      _('a specific branch you would like to push'), _('BRANCH')),
  4445      _('a specific branch you would like to push'), _('BRANCH')),
  4405     ('', 'new-branch', False, _('allow pushing a new branch')),
  4446     ('', 'new-branch', False, _('allow pushing a new branch')),
  4406     ('', 'pushvars', [], _('variables that can be sent to server (ADVANCED)')),
  4447     ('', 'pushvars', [], _('variables that can be sent to server (ADVANCED)')),
  4407     ] + remoteopts,
  4448     ] + remoteopts,
  4408     _('[-f] [-r REV]... [-e CMD] [--remotecmd CMD] [DEST]'))
  4449     _('[-f] [-r REV]... [-e CMD] [--remotecmd CMD] [DEST]'),
       
  4450     helpcategory=command.CATEGORY_REMOTE_REPO_MANAGEMENT)
  4409 def push(ui, repo, dest=None, **opts):
  4451 def push(ui, repo, dest=None, **opts):
  4410     """push changes to the specified destination
  4452     """push changes to the specified destination
  4411 
  4453 
  4412     Push changesets from the local repository to the specified
  4454     Push changesets from the local repository to the specified
  4413     destination.
  4455     destination.
  4529         elif not result and pushop.bkresult:
  4571         elif not result and pushop.bkresult:
  4530             result = 2
  4572             result = 2
  4531 
  4573 
  4532     return result
  4574     return result
  4533 
  4575 
  4534 @command('recover', [])
  4576 @command('recover', [], helpcategory=command.CATEGORY_MAINTENANCE)
  4535 def recover(ui, repo):
  4577 def recover(ui, repo):
  4536     """roll back an interrupted transaction
  4578     """roll back an interrupted transaction
  4537 
  4579 
  4538     Recover from an interrupted commit or pull.
  4580     Recover from an interrupted commit or pull.
  4539 
  4581 
  4551     [('A', 'after', None, _('record delete for missing files')),
  4593     [('A', 'after', None, _('record delete for missing files')),
  4552     ('f', 'force', None,
  4594     ('f', 'force', None,
  4553      _('forget added files, delete modified files')),
  4595      _('forget added files, delete modified files')),
  4554     ] + subrepoopts + walkopts + dryrunopts,
  4596     ] + subrepoopts + walkopts + dryrunopts,
  4555     _('[OPTION]... FILE...'),
  4597     _('[OPTION]... FILE...'),
       
  4598     helpcategory=command.CATEGORY_WORKING_DIRECTORY,
  4556     inferrepo=True)
  4599     inferrepo=True)
  4557 def remove(ui, repo, *pats, **opts):
  4600 def remove(ui, repo, *pats, **opts):
  4558     """remove the specified files on the next commit
  4601     """remove the specified files on the next commit
  4559 
  4602 
  4560     Schedule the indicated files for removal from the current branch.
  4603     Schedule the indicated files for removal from the current branch.
  4606 
  4649 
  4607 @command('rename|move|mv',
  4650 @command('rename|move|mv',
  4608     [('A', 'after', None, _('record a rename that has already occurred')),
  4651     [('A', 'after', None, _('record a rename that has already occurred')),
  4609     ('f', 'force', None, _('forcibly copy over an existing managed file')),
  4652     ('f', 'force', None, _('forcibly copy over an existing managed file')),
  4610     ] + walkopts + dryrunopts,
  4653     ] + walkopts + dryrunopts,
  4611     _('[OPTION]... SOURCE... DEST'))
  4654     _('[OPTION]... SOURCE... DEST'),
       
  4655     helpcategory=command.CATEGORY_WORKING_DIRECTORY)
  4612 def rename(ui, repo, *pats, **opts):
  4656 def rename(ui, repo, *pats, **opts):
  4613     """rename files; equivalent of copy + remove
  4657     """rename files; equivalent of copy + remove
  4614 
  4658 
  4615     Mark dest as copies of sources; mark sources for deletion. If dest
  4659     Mark dest as copies of sources; mark sources for deletion. If dest
  4616     is a directory, copies are put in that directory. If dest is a
  4660     is a directory, copies are put in that directory. If dest is a
  4636     ('u', 'unmark', None, _('mark files as unresolved')),
  4680     ('u', 'unmark', None, _('mark files as unresolved')),
  4637     ('n', 'no-status', None, _('hide status prefix')),
  4681     ('n', 'no-status', None, _('hide status prefix')),
  4638     ('', 're-merge', None, _('re-merge files'))]
  4682     ('', 're-merge', None, _('re-merge files'))]
  4639     + mergetoolopts + walkopts + formatteropts,
  4683     + mergetoolopts + walkopts + formatteropts,
  4640     _('[OPTION]... [FILE]...'),
  4684     _('[OPTION]... [FILE]...'),
       
  4685     helpcategory=command.CATEGORY_WORKING_DIRECTORY,
  4641     inferrepo=True)
  4686     inferrepo=True)
  4642 def resolve(ui, repo, *pats, **opts):
  4687 def resolve(ui, repo, *pats, **opts):
  4643     """redo merges or set/view the merge status of files
  4688     """redo merges or set/view the merge status of files
  4644 
  4689 
  4645     Merges with unresolved conflicts are often the result of
  4690     Merges with unresolved conflicts are often the result of
  4937     ('d', 'date', '', _('tipmost revision matching date'), _('DATE')),
  4982     ('d', 'date', '', _('tipmost revision matching date'), _('DATE')),
  4938     ('r', 'rev', '', _('revert to the specified revision'), _('REV')),
  4983     ('r', 'rev', '', _('revert to the specified revision'), _('REV')),
  4939     ('C', 'no-backup', None, _('do not save backup copies of files')),
  4984     ('C', 'no-backup', None, _('do not save backup copies of files')),
  4940     ('i', 'interactive', None, _('interactively select the changes')),
  4985     ('i', 'interactive', None, _('interactively select the changes')),
  4941     ] + walkopts + dryrunopts,
  4986     ] + walkopts + dryrunopts,
  4942     _('[OPTION]... [-r REV] [NAME]...'))
  4987     _('[OPTION]... [-r REV] [NAME]...'),
       
  4988     helpcategory=command.CATEGORY_WORKING_DIRECTORY)
  4943 def revert(ui, repo, *pats, **opts):
  4989 def revert(ui, repo, *pats, **opts):
  4944     """restore files to their checkout state
  4990     """restore files to their checkout state
  4945 
  4991 
  4946     .. note::
  4992     .. note::
  4947 
  4993 
  5017         raise error.Abort(msg, hint=hint)
  5063         raise error.Abort(msg, hint=hint)
  5018 
  5064 
  5019     return cmdutil.revert(ui, repo, ctx, (parent, p2), *pats,
  5065     return cmdutil.revert(ui, repo, ctx, (parent, p2), *pats,
  5020                           **pycompat.strkwargs(opts))
  5066                           **pycompat.strkwargs(opts))
  5021 
  5067 
  5022 @command('rollback', dryrunopts +
  5068 @command(
  5023          [('f', 'force', False, _('ignore safety measures'))])
  5069     'rollback',
       
  5070     dryrunopts + [('f', 'force', False, _('ignore safety measures'))],
       
  5071     helpcategory=command.CATEGORY_MAINTENANCE)
  5024 def rollback(ui, repo, **opts):
  5072 def rollback(ui, repo, **opts):
  5025     """roll back the last transaction (DANGEROUS) (DEPRECATED)
  5073     """roll back the last transaction (DANGEROUS) (DEPRECATED)
  5026 
  5074 
  5027     Please use :hg:`commit --amend` instead of rollback to correct
  5075     Please use :hg:`commit --amend` instead of rollback to correct
  5028     mistakes in the last commit.
  5076     mistakes in the last commit.
  5070         raise error.Abort(_('rollback is disabled because it is unsafe'),
  5118         raise error.Abort(_('rollback is disabled because it is unsafe'),
  5071                           hint=('see `hg help -v rollback` for information'))
  5119                           hint=('see `hg help -v rollback` for information'))
  5072     return repo.rollback(dryrun=opts.get(r'dry_run'),
  5120     return repo.rollback(dryrun=opts.get(r'dry_run'),
  5073                          force=opts.get(r'force'))
  5121                          force=opts.get(r'force'))
  5074 
  5122 
  5075 @command('root', [], intents={INTENT_READONLY})
  5123 @command(
       
  5124     'root', [], intents={INTENT_READONLY},
       
  5125     helpcategory=command.CATEGORY_WORKING_DIRECTORY)
  5076 def root(ui, repo):
  5126 def root(ui, repo):
  5077     """print the root (top) of the current working directory
  5127     """print the root (top) of the current working directory
  5078 
  5128 
  5079     Print the root directory of the current repository.
  5129     Print the root directory of the current repository.
  5080 
  5130 
  5108     ('6', 'ipv6', None, _('use IPv6 in addition to IPv4')),
  5158     ('6', 'ipv6', None, _('use IPv6 in addition to IPv4')),
  5109     ('', 'certificate', '', _('SSL certificate file'), _('FILE')),
  5159     ('', 'certificate', '', _('SSL certificate file'), _('FILE')),
  5110     ('', 'print-url', None, _('start and print only the URL'))]
  5160     ('', 'print-url', None, _('start and print only the URL'))]
  5111      + subrepoopts,
  5161      + subrepoopts,
  5112     _('[OPTION]...'),
  5162     _('[OPTION]...'),
       
  5163     helpcategory=command.CATEGORY_REMOTE_REPO_MANAGEMENT,
  5113     optionalrepo=True)
  5164     optionalrepo=True)
  5114 def serve(ui, repo, **opts):
  5165 def serve(ui, repo, **opts):
  5115     """start stand-alone webserver
  5166     """start stand-alone webserver
  5116 
  5167 
  5117     Start a local HTTP repository browser and pull server. You can use
  5168     Start a local HTTP repository browser and pull server. You can use
  5169     ('0', 'print0', None, _('end filenames with NUL, for use with xargs')),
  5220     ('0', 'print0', None, _('end filenames with NUL, for use with xargs')),
  5170     ('', 'rev', [], _('show difference from revision'), _('REV')),
  5221     ('', 'rev', [], _('show difference from revision'), _('REV')),
  5171     ('', 'change', '', _('list the changed files of a revision'), _('REV')),
  5222     ('', 'change', '', _('list the changed files of a revision'), _('REV')),
  5172     ] + walkopts + subrepoopts + formatteropts,
  5223     ] + walkopts + subrepoopts + formatteropts,
  5173     _('[OPTION]... [FILE]...'),
  5224     _('[OPTION]... [FILE]...'),
       
  5225     helpcategory=command.CATEGORY_WORKING_DIRECTORY,
  5174     inferrepo=True,
  5226     inferrepo=True,
  5175     intents={INTENT_READONLY})
  5227     intents={INTENT_READONLY})
  5176 def status(ui, repo, *pats, **opts):
  5228 def status(ui, repo, *pats, **opts):
  5177     """show changed files in the working directory
  5229     """show changed files in the working directory
  5178 
  5230 
  5358     fm.end()
  5410     fm.end()
  5359 
  5411 
  5360 @command('^summary|sum',
  5412 @command('^summary|sum',
  5361     [('', 'remote', None, _('check for push and pull'))],
  5413     [('', 'remote', None, _('check for push and pull'))],
  5362     '[--remote]',
  5414     '[--remote]',
       
  5415     helpcategory=command.CATEGORY_WORKING_DIRECTORY,
  5363     intents={INTENT_READONLY})
  5416     intents={INTENT_READONLY})
  5364 def summary(ui, repo, **opts):
  5417 def summary(ui, repo, **opts):
  5365     """summarize working directory state
  5418     """summarize working directory state
  5366 
  5419 
  5367     This generates a brief summary of the working directory state,
  5420     This generates a brief summary of the working directory state,
  5648     ('', 'remove', None, _('remove a tag')),
  5701     ('', 'remove', None, _('remove a tag')),
  5649     # -l/--local is already there, commitopts cannot be used
  5702     # -l/--local is already there, commitopts cannot be used
  5650     ('e', 'edit', None, _('invoke editor on commit messages')),
  5703     ('e', 'edit', None, _('invoke editor on commit messages')),
  5651     ('m', 'message', '', _('use text as commit message'), _('TEXT')),
  5704     ('m', 'message', '', _('use text as commit message'), _('TEXT')),
  5652     ] + commitopts2,
  5705     ] + commitopts2,
  5653     _('[-f] [-l] [-m TEXT] [-d DATE] [-u USER] [-r REV] NAME...'))
  5706     _('[-f] [-l] [-m TEXT] [-d DATE] [-u USER] [-r REV] NAME...'),
       
  5707     helpcategory=command.CATEGORY_CHANGE_ORGANIZATION)
  5654 def tag(ui, repo, name1, *names, **opts):
  5708 def tag(ui, repo, name1, *names, **opts):
  5655     """add one or more tags for the current or given revision
  5709     """add one or more tags for the current or given revision
  5656 
  5710 
  5657     Name a particular revision using <name>.
  5711     Name a particular revision using <name>.
  5658 
  5712 
  5754             raise error.Abort(_("cannot tag null revision"))
  5808             raise error.Abort(_("cannot tag null revision"))
  5755 
  5809 
  5756         tagsmod.tag(repo, names, node, message, opts.get('local'),
  5810         tagsmod.tag(repo, names, node, message, opts.get('local'),
  5757                     opts.get('user'), date, editor=editor)
  5811                     opts.get('user'), date, editor=editor)
  5758 
  5812 
  5759 @command('tags', formatteropts, '', intents={INTENT_READONLY})
  5813 @command(
       
  5814     'tags', formatteropts, '',
       
  5815     helpcategory=command.CATEGORY_CHANGE_ORGANIZATION,
       
  5816     intents={INTENT_READONLY})
  5760 def tags(ui, repo, **opts):
  5817 def tags(ui, repo, **opts):
  5761     """list repository tags
  5818     """list repository tags
  5762 
  5819 
  5763     This lists both regular and local tags. When the -v/--verbose
  5820     This lists both regular and local tags. When the -v/--verbose
  5764     switch is used, a third column "local" is printed for local tags.
  5821     switch is used, a third column "local" is printed for local tags.
  5804 
  5861 
  5805 @command('tip',
  5862 @command('tip',
  5806     [('p', 'patch', None, _('show patch')),
  5863     [('p', 'patch', None, _('show patch')),
  5807     ('g', 'git', None, _('use git extended diff format')),
  5864     ('g', 'git', None, _('use git extended diff format')),
  5808     ] + templateopts,
  5865     ] + templateopts,
  5809     _('[-p] [-g]'))
  5866     _('[-p] [-g]'),
       
  5867     helpcategory=command.CATEGORY_CHANGE_NAVIGATION)
  5810 def tip(ui, repo, **opts):
  5868 def tip(ui, repo, **opts):
  5811     """show the tip revision (DEPRECATED)
  5869     """show the tip revision (DEPRECATED)
  5812 
  5870 
  5813     The tip revision (usually just called the tip) is the changeset
  5871     The tip revision (usually just called the tip) is the changeset
  5814     most recently added to the repository (and therefore the most
  5872     most recently added to the repository (and therefore the most
  5829     displayer.close()
  5887     displayer.close()
  5830 
  5888 
  5831 @command('unbundle',
  5889 @command('unbundle',
  5832     [('u', 'update', None,
  5890     [('u', 'update', None,
  5833      _('update to new branch head if changesets were unbundled'))],
  5891      _('update to new branch head if changesets were unbundled'))],
  5834     _('[-u] FILE...'))
  5892     _('[-u] FILE...'),
       
  5893     helpcategory=command.CATEGORY_IMPORT_EXPORT)
  5835 def unbundle(ui, repo, fname1, *fnames, **opts):
  5894 def unbundle(ui, repo, fname1, *fnames, **opts):
  5836     """apply one or more bundle files
  5895     """apply one or more bundle files
  5837 
  5896 
  5838     Apply one or more bundle files generated by :hg:`bundle`.
  5897     Apply one or more bundle files generated by :hg:`bundle`.
  5839 
  5898 
  5873     ('c', 'check', None, _('require clean working directory')),
  5932     ('c', 'check', None, _('require clean working directory')),
  5874     ('m', 'merge', None, _('merge uncommitted changes')),
  5933     ('m', 'merge', None, _('merge uncommitted changes')),
  5875     ('d', 'date', '', _('tipmost revision matching date'), _('DATE')),
  5934     ('d', 'date', '', _('tipmost revision matching date'), _('DATE')),
  5876     ('r', 'rev', '', _('revision'), _('REV'))
  5935     ('r', 'rev', '', _('revision'), _('REV'))
  5877      ] + mergetoolopts,
  5936      ] + mergetoolopts,
  5878     _('[-C|-c|-m] [-d DATE] [[-r] REV]'))
  5937     _('[-C|-c|-m] [-d DATE] [[-r] REV]'),
       
  5938     helpcategory=command.CATEGORY_WORKING_DIRECTORY)
  5879 def update(ui, repo, node=None, **opts):
  5939 def update(ui, repo, node=None, **opts):
  5880     """update working directory (or switch revisions)
  5940     """update working directory (or switch revisions)
  5881 
  5941 
  5882     Update the repository's working directory to the specified
  5942     Update the repository's working directory to the specified
  5883     changeset. If no changeset is specified, update to the tip of the
  5943     changeset. If no changeset is specified, update to the tip of the
  5984             if ctx.obsolete():
  6044             if ctx.obsolete():
  5985                 obsfatemsg = obsutil._getfilteredreason(repo, ctxstr, ctx)
  6045                 obsfatemsg = obsutil._getfilteredreason(repo, ctxstr, ctx)
  5986                 ui.warn("(%s)\n" % obsfatemsg)
  6046                 ui.warn("(%s)\n" % obsfatemsg)
  5987         return ret
  6047         return ret
  5988 
  6048 
  5989 @command('verify', [])
  6049 @command('verify', [], helpcategory=command.CATEGORY_MAINTENANCE)
  5990 def verify(ui, repo):
  6050 def verify(ui, repo):
  5991     """verify the integrity of the repository
  6051     """verify the integrity of the repository
  5992 
  6052 
  5993     Verify the integrity of the current repository.
  6053     Verify the integrity of the current repository.
  5994 
  6054 
  6003 
  6063 
  6004     Returns 0 on success, 1 if errors are encountered.
  6064     Returns 0 on success, 1 if errors are encountered.
  6005     """
  6065     """
  6006     return hg.verify(repo)
  6066     return hg.verify(repo)
  6007 
  6067 
  6008 @command('version', [] + formatteropts, norepo=True,
  6068 @command(
  6009          intents={INTENT_READONLY})
  6069     'version', [] + formatteropts, helpcategory=command.CATEGORY_HELP,
       
  6070     norepo=True, intents={INTENT_READONLY})
  6010 def version_(ui, **opts):
  6071 def version_(ui, **opts):
  6011     """output version and copyright information
  6072     """output version and copyright information
  6012 
  6073 
  6013     .. container:: verbose
  6074     .. container:: verbose
  6014 
  6075