##// END OF EJS Templates
commands: define norepo in command decorator
Gregory Szorc -
r21768:16aeb28c default
parent child Browse files
Show More
@@ -26,9 +26,9 b' table = {}'
26
26
27 command = cmdutil.command(table)
27 command = cmdutil.command(table)
28
28
29 norepo = ("clone init version help debugcommands debugcomplete"
29 # Space delimited list of commands that don't require local repositories.
30 " debugdate debuginstall debugfsinfo debugpushkey debugwireargs"
30 # This should be populated by passing norepo=True into the @command decorator.
31 " debugknown debuggetbundle debugbundle")
31 norepo = ''
32 optionalrepo = ("identify paths serve config showconfig debugancestor debugdag"
32 optionalrepo = ("identify paths serve config showconfig debugancestor debugdag"
33 " debugdata debugindex debugindexdot debugrevlog")
33 " debugdata debugindex debugindexdot debugrevlog")
34 inferrepo = ("add addremove annotate cat commit diff grep forget log parents"
34 inferrepo = ("add addremove annotate cat commit diff grep forget log parents"
@@ -1212,7 +1212,8 b' def cat(ui, repo, file1, *pats, **opts):'
1212 ('', 'pull', None, _('use pull protocol to copy metadata')),
1212 ('', 'pull', None, _('use pull protocol to copy metadata')),
1213 ('', 'uncompressed', None, _('use uncompressed transfer (fast over LAN)')),
1213 ('', 'uncompressed', None, _('use uncompressed transfer (fast over LAN)')),
1214 ] + remoteopts,
1214 ] + remoteopts,
1215 _('[OPTION]... SOURCE [DEST]'))
1215 _('[OPTION]... SOURCE [DEST]'),
1216 norepo=True)
1216 def clone(ui, source, dest=None, **opts):
1217 def clone(ui, source, dest=None, **opts):
1217 """make a copy of an existing repository
1218 """make a copy of an existing repository
1218
1219
@@ -1754,7 +1755,10 b' def debugbuilddag(ui, repo, text=None,'
1754 ui.progress(_('building'), None)
1755 ui.progress(_('building'), None)
1755 release(tr, lock)
1756 release(tr, lock)
1756
1757
1757 @command('debugbundle', [('a', 'all', None, _('show all details'))], _('FILE'))
1758 @command('debugbundle',
1759 [('a', 'all', None, _('show all details'))],
1760 _('FILE'),
1761 norepo=True)
1758 def debugbundle(ui, bundlepath, all=None, **opts):
1762 def debugbundle(ui, bundlepath, all=None, **opts):
1759 """lists the contents of a bundle"""
1763 """lists the contents of a bundle"""
1760 f = hg.openpath(ui, bundlepath)
1764 f = hg.openpath(ui, bundlepath)
@@ -1832,7 +1836,7 b' def debugcheckstate(ui, repo):'
1832 error = _(".hg/dirstate inconsistent with current parent's manifest")
1836 error = _(".hg/dirstate inconsistent with current parent's manifest")
1833 raise util.Abort(error)
1837 raise util.Abort(error)
1834
1838
1835 @command('debugcommands', [], _('[COMMAND]'))
1839 @command('debugcommands', [], _('[COMMAND]'), norepo=True)
1836 def debugcommands(ui, cmd='', *args):
1840 def debugcommands(ui, cmd='', *args):
1837 """list all available commands and options"""
1841 """list all available commands and options"""
1838 for cmd, vals in sorted(table.iteritems()):
1842 for cmd, vals in sorted(table.iteritems()):
@@ -1842,7 +1846,8 b" def debugcommands(ui, cmd='', *args):"
1842
1846
1843 @command('debugcomplete',
1847 @command('debugcomplete',
1844 [('o', 'options', None, _('show the command options'))],
1848 [('o', 'options', None, _('show the command options'))],
1845 _('[-o] CMD'))
1849 _('[-o] CMD'),
1850 norepo=True)
1846 def debugcomplete(ui, cmd='', **opts):
1851 def debugcomplete(ui, cmd='', **opts):
1847 """returns the completion list associated with the given command"""
1852 """returns the completion list associated with the given command"""
1848
1853
@@ -1946,7 +1951,8 b' def debugdata(ui, repo, file_, rev=None,'
1946
1951
1947 @command('debugdate',
1952 @command('debugdate',
1948 [('e', 'extended', None, _('try extended date formats'))],
1953 [('e', 'extended', None, _('try extended date formats'))],
1949 _('[-e] DATE [RANGE]'))
1954 _('[-e] DATE [RANGE]'),
1955 norepo=True)
1950 def debugdate(ui, date, range=None, **opts):
1956 def debugdate(ui, date, range=None, **opts):
1951 """parse and display a date"""
1957 """parse and display a date"""
1952 if opts["extended"]:
1958 if opts["extended"]:
@@ -2042,7 +2048,7 b' def debugfileset(ui, repo, expr, **opts)'
2042 for f in ctx.getfileset(expr):
2048 for f in ctx.getfileset(expr):
2043 ui.write("%s\n" % f)
2049 ui.write("%s\n" % f)
2044
2050
2045 @command('debugfsinfo', [], _('[PATH]'))
2051 @command('debugfsinfo', [], _('[PATH]'), norepo=True)
2046 def debugfsinfo(ui, path="."):
2052 def debugfsinfo(ui, path="."):
2047 """show information detected about current filesystem"""
2053 """show information detected about current filesystem"""
2048 util.writefile('.debugfsinfo', '')
2054 util.writefile('.debugfsinfo', '')
@@ -2057,7 +2063,8 b' def debugfsinfo(ui, path="."):'
2057 [('H', 'head', [], _('id of head node'), _('ID')),
2063 [('H', 'head', [], _('id of head node'), _('ID')),
2058 ('C', 'common', [], _('id of common node'), _('ID')),
2064 ('C', 'common', [], _('id of common node'), _('ID')),
2059 ('t', 'type', 'bzip2', _('bundle compression type to use'), _('TYPE'))],
2065 ('t', 'type', 'bzip2', _('bundle compression type to use'), _('TYPE'))],
2060 _('REPO FILE [-H|-C ID]...'))
2066 _('REPO FILE [-H|-C ID]...'),
2067 norepo=True)
2061 def debuggetbundle(ui, repopath, bundlepath, head=None, common=None, **opts):
2068 def debuggetbundle(ui, repopath, bundlepath, head=None, common=None, **opts):
2062 """retrieves a bundle from a repo
2069 """retrieves a bundle from a repo
2063
2070
@@ -2158,7 +2165,7 b' def debugindexdot(ui, repo, file_):'
2158 ui.write("\t%d -> %d\n" % (r.rev(pp[1]), i))
2165 ui.write("\t%d -> %d\n" % (r.rev(pp[1]), i))
2159 ui.write("}\n")
2166 ui.write("}\n")
2160
2167
2161 @command('debuginstall', [], '')
2168 @command('debuginstall', [], '', norepo=True)
2162 def debuginstall(ui):
2169 def debuginstall(ui):
2163 '''test Mercurial installation
2170 '''test Mercurial installation
2164
2171
@@ -2256,7 +2263,7 b' def debuginstall(ui):'
2256
2263
2257 return problems
2264 return problems
2258
2265
2259 @command('debugknown', [], _('REPO ID...'))
2266 @command('debugknown', [], _('REPO ID...'), norepo=True)
2260 def debugknown(ui, repopath, *ids, **opts):
2267 def debugknown(ui, repopath, *ids, **opts):
2261 """test whether node ids are known to a repo
2268 """test whether node ids are known to a repo
2262
2269
@@ -2393,7 +2400,7 b' def debugpathcomplete(ui, repo, *specs, '
2393 ui.write('\n'.join(repo.pathto(p, cwd) for p in sorted(files)))
2400 ui.write('\n'.join(repo.pathto(p, cwd) for p in sorted(files)))
2394 ui.write('\n')
2401 ui.write('\n')
2395
2402
2396 @command('debugpushkey', [], _('REPO NAMESPACE [KEY OLD NEW]'))
2403 @command('debugpushkey', [], _('REPO NAMESPACE [KEY OLD NEW]'), norepo=True)
2397 def debugpushkey(ui, repopath, namespace, *keyinfo, **opts):
2404 def debugpushkey(ui, repopath, namespace, *keyinfo, **opts):
2398 '''access the pushkey key/value protocol
2405 '''access the pushkey key/value protocol
2399
2406
@@ -2807,7 +2814,8 b' def debugwalk(ui, repo, *pats, **opts):'
2807 ('', 'four', '', 'four'),
2814 ('', 'four', '', 'four'),
2808 ('', 'five', '', 'five'),
2815 ('', 'five', '', 'five'),
2809 ] + remoteopts,
2816 ] + remoteopts,
2810 _('REPO [OPTIONS]... [ONE [TWO]]'))
2817 _('REPO [OPTIONS]... [ONE [TWO]]'),
2818 norepo=True)
2811 def debugwireargs(ui, repopath, *vals, **opts):
2819 def debugwireargs(ui, repopath, *vals, **opts):
2812 repo = hg.peer(ui, opts, repopath)
2820 repo = hg.peer(ui, opts, repopath)
2813 for opt in remoteopts:
2821 for opt in remoteopts:
@@ -3533,7 +3541,8 b' def heads(ui, repo, *branchrevs, **opts)'
3533 ('c', 'command', None, _('show only help for commands')),
3541 ('c', 'command', None, _('show only help for commands')),
3534 ('k', 'keyword', '', _('show topics matching keyword')),
3542 ('k', 'keyword', '', _('show topics matching keyword')),
3535 ],
3543 ],
3536 _('[-ec] [TOPIC]'))
3544 _('[-ec] [TOPIC]'),
3545 norepo=True)
3537 def help_(ui, name=None, **opts):
3546 def help_(ui, name=None, **opts):
3538 """show help for a given topic or a help overview
3547 """show help for a given topic or a help overview
3539
3548
@@ -3950,7 +3959,8 b' def incoming(ui, repo, source="default",'
3950 del repo._subtoppath
3959 del repo._subtoppath
3951
3960
3952
3961
3953 @command('^init', remoteopts, _('[-e CMD] [--remotecmd CMD] [DEST]'))
3962 @command('^init', remoteopts, _('[-e CMD] [--remotecmd CMD] [DEST]'),
3963 norepo=True)
3954 def init(ui, dest=".", **opts):
3964 def init(ui, dest=".", **opts):
3955 """create a new repository in the given directory
3965 """create a new repository in the given directory
3956
3966
@@ -5972,7 +5982,7 b' def verify(ui, repo):'
5972 """
5982 """
5973 return hg.verify(repo)
5983 return hg.verify(repo)
5974
5984
5975 @command('version', [])
5985 @command('version', [], norepo=True)
5976 def version_(ui):
5986 def version_(ui):
5977 """output version and copyright information"""
5987 """output version and copyright information"""
5978 ui.write(_("Mercurial Distributed SCM (version %s)\n")
5988 ui.write(_("Mercurial Distributed SCM (version %s)\n")
General Comments 0
You need to be logged in to leave comments. Login now