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