##// END OF EJS Templates
commands: define optionalrepo in command decorator
Gregory Szorc -
r21775:5403245e default
parent child Browse files
Show More
@@ -29,8 +29,10 b' command = cmdutil.command(table)'
29 # Space delimited list of commands that don't require local repositories.
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.
30 # This should be populated by passing norepo=True into the @command decorator.
31 norepo = ''
31 norepo = ''
32 optionalrepo = ("identify paths serve config showconfig debugancestor debugdag"
32 # Space delimited list of commands that optionally require local repositories.
33 " debugdata debugindex debugindexdot debugrevlog")
33 # This should be populated by passing optionalrepo=True into the @command
34 # decorator.
35 optionalrepo = ''
34 inferrepo = ("add addremove annotate cat commit diff grep forget log parents"
36 inferrepo = ("add addremove annotate cat commit diff grep forget log parents"
35 " remove resolve status debugwalk")
37 " remove resolve status debugwalk")
36 # common command options
38 # common command options
@@ -1466,7 +1468,8 b' def commit(ui, repo, *pats, **opts):'
1466 ('e', 'edit', None, _('edit user config')),
1468 ('e', 'edit', None, _('edit user config')),
1467 ('l', 'local', None, _('edit repository config')),
1469 ('l', 'local', None, _('edit repository config')),
1468 ('g', 'global', None, _('edit global config'))],
1470 ('g', 'global', None, _('edit global config'))],
1469 _('[-u] [NAME]...'))
1471 _('[-u] [NAME]...'),
1472 optionalrepo=True)
1470 def config(ui, repo, *values, **opts):
1473 def config(ui, repo, *values, **opts):
1471 """show combined config settings from all hgrc files
1474 """show combined config settings from all hgrc files
1472
1475
@@ -1585,7 +1588,7 b' def copy(ui, repo, *pats, **opts):'
1585 finally:
1588 finally:
1586 wlock.release()
1589 wlock.release()
1587
1590
1588 @command('debugancestor', [], _('[INDEX] REV1 REV2'))
1591 @command('debugancestor', [], _('[INDEX] REV1 REV2'), optionalrepo=True)
1589 def debugancestor(ui, repo, *args):
1592 def debugancestor(ui, repo, *args):
1590 """find the ancestor revision of two revisions in a given index"""
1593 """find the ancestor revision of two revisions in a given index"""
1591 if len(args) == 3:
1594 if len(args) == 3:
@@ -1877,7 +1880,8 b" def debugcomplete(ui, cmd='', **opts):"
1877 ('b', 'branches', None, _('annotate with branch names')),
1880 ('b', 'branches', None, _('annotate with branch names')),
1878 ('', 'dots', None, _('use dots for runs')),
1881 ('', 'dots', None, _('use dots for runs')),
1879 ('s', 'spaces', None, _('separate elements by spaces'))],
1882 ('s', 'spaces', None, _('separate elements by spaces'))],
1880 _('[OPTION]... [FILE [REV]...]'))
1883 _('[OPTION]... [FILE [REV]...]'),
1884 optionalrepo=True)
1881 def debugdag(ui, repo, file_=None, *revs, **opts):
1885 def debugdag(ui, repo, file_=None, *revs, **opts):
1882 """format the changelog or an index DAG as a concise textual description
1886 """format the changelog or an index DAG as a concise textual description
1883
1887
@@ -1952,7 +1956,7 b' def debugdata(ui, repo, file_, rev=None,'
1952 @command('debugdate',
1956 @command('debugdate',
1953 [('e', 'extended', None, _('try extended date formats'))],
1957 [('e', 'extended', None, _('try extended date formats'))],
1954 _('[-e] DATE [RANGE]'),
1958 _('[-e] DATE [RANGE]'),
1955 norepo=True)
1959 norepo=True, optionalrepo=True)
1956 def debugdate(ui, date, range=None, **opts):
1960 def debugdate(ui, date, range=None, **opts):
1957 """parse and display a date"""
1961 """parse and display a date"""
1958 if opts["extended"]:
1962 if opts["extended"]:
@@ -2104,7 +2108,8 b' def debugignore(ui, repo, *values, **opt'
2104 [('c', 'changelog', False, _('open changelog')),
2108 [('c', 'changelog', False, _('open changelog')),
2105 ('m', 'manifest', False, _('open manifest')),
2109 ('m', 'manifest', False, _('open manifest')),
2106 ('f', 'format', 0, _('revlog format'), _('FORMAT'))],
2110 ('f', 'format', 0, _('revlog format'), _('FORMAT'))],
2107 _('[-f FORMAT] -c|-m|FILE'))
2111 _('[-f FORMAT] -c|-m|FILE'),
2112 optionalrepo=True)
2108 def debugindex(ui, repo, file_=None, **opts):
2113 def debugindex(ui, repo, file_=None, **opts):
2109 """dump the contents of an index file"""
2114 """dump the contents of an index file"""
2110 r = cmdutil.openrevlog(repo, 'debugindex', file_, opts)
2115 r = cmdutil.openrevlog(repo, 'debugindex', file_, opts)
@@ -2146,7 +2151,7 b' def debugindex(ui, repo, file_=None, **o'
2146 i, r.flags(i), r.start(i), r.length(i), r.rawsize(i),
2151 i, r.flags(i), r.start(i), r.length(i), r.rawsize(i),
2147 base, r.linkrev(i), pr[0], pr[1], short(node)))
2152 base, r.linkrev(i), pr[0], pr[1], short(node)))
2148
2153
2149 @command('debugindexdot', [], _('FILE'))
2154 @command('debugindexdot', [], _('FILE'), optionalrepo=True)
2150 def debugindexdot(ui, repo, file_):
2155 def debugindexdot(ui, repo, file_):
2151 """dump an index DAG as a graphviz dot file"""
2156 """dump an index DAG as a graphviz dot file"""
2152 r = None
2157 r = None
@@ -2485,7 +2490,8 b' def debugrename(ui, repo, file1, *pats, '
2485 [('c', 'changelog', False, _('open changelog')),
2490 [('c', 'changelog', False, _('open changelog')),
2486 ('m', 'manifest', False, _('open manifest')),
2491 ('m', 'manifest', False, _('open manifest')),
2487 ('d', 'dump', False, _('dump index data'))],
2492 ('d', 'dump', False, _('dump index data'))],
2488 _('-c|-m|FILE'))
2493 _('-c|-m|FILE'),
2494 optionalrepo=True)
2489 def debugrevlog(ui, repo, file_=None, **opts):
2495 def debugrevlog(ui, repo, file_=None, **opts):
2490 """show data and statistics about a revlog"""
2496 """show data and statistics about a revlog"""
2491 r = cmdutil.openrevlog(repo, 'debugrevlog', file_, opts)
2497 r = cmdutil.openrevlog(repo, 'debugrevlog', file_, opts)
@@ -3577,7 +3583,8 b' def help_(ui, name=None, **opts):'
3577 ('t', 'tags', None, _('show tags')),
3583 ('t', 'tags', None, _('show tags')),
3578 ('B', 'bookmarks', None, _('show bookmarks')),
3584 ('B', 'bookmarks', None, _('show bookmarks')),
3579 ] + remoteopts,
3585 ] + remoteopts,
3580 _('[-nibtB] [-r REV] [SOURCE]'))
3586 _('[-nibtB] [-r REV] [SOURCE]'),
3587 optionalrepo=True)
3581 def identify(ui, repo, source=None, rev=None,
3588 def identify(ui, repo, source=None, rev=None,
3582 num=None, id=None, branch=None, tags=None, bookmarks=None, **opts):
3589 num=None, id=None, branch=None, tags=None, bookmarks=None, **opts):
3583 """identify the working copy or specified revision
3590 """identify the working copy or specified revision
@@ -4441,7 +4448,7 b' def parents(ui, repo, file_=None, **opts'
4441 displayer.show(repo[n])
4448 displayer.show(repo[n])
4442 displayer.close()
4449 displayer.close()
4443
4450
4444 @command('paths', [], _('[NAME]'))
4451 @command('paths', [], _('[NAME]'), optionalrepo=True)
4445 def paths(ui, repo, search=None):
4452 def paths(ui, repo, search=None):
4446 """show aliases for remote repositories
4453 """show aliases for remote repositories
4447
4454
@@ -5193,7 +5200,8 b' def root(ui, repo):'
5193 ('', 'style', '', _('template style to use'), _('STYLE')),
5200 ('', 'style', '', _('template style to use'), _('STYLE')),
5194 ('6', 'ipv6', None, _('use IPv6 in addition to IPv4')),
5201 ('6', 'ipv6', None, _('use IPv6 in addition to IPv4')),
5195 ('', 'certificate', '', _('SSL certificate file'), _('FILE'))],
5202 ('', 'certificate', '', _('SSL certificate file'), _('FILE'))],
5196 _('[OPTION]...'))
5203 _('[OPTION]...'),
5204 optionalrepo=True)
5197 def serve(ui, repo, **opts):
5205 def serve(ui, repo, **opts):
5198 """start stand-alone webserver
5206 """start stand-alone webserver
5199
5207
General Comments 0
You need to be logged in to leave comments. Login now