##// END OF EJS Templates
commands: add norepo argument to command decorator...
Gregory Szorc -
r21767:75a96326 default
parent child Browse files
Show More
@@ -2489,14 +2489,23 b' def command(table):'
2489 2489
2490 2490 The synopsis argument defines a short, one line summary of how to use the
2491 2491 command. This shows up in the help output.
2492
2493 The norepo argument defines whether the command does not require a
2494 local repository. Most commands operate against a repository, thus the
2495 default is False.
2492 2496 """
2493
2494 def cmd(name, options=(), synopsis=None):
2497 def cmd(name, options=(), synopsis=None, norepo=False):
2495 2498 def decorator(func):
2496 2499 if synopsis:
2497 2500 table[name] = func, list(options), synopsis
2498 2501 else:
2499 2502 table[name] = func, list(options)
2503
2504 if norepo:
2505 # Avoid import cycle.
2506 import commands
2507 commands.norepo += ' %s' % ' '.join(parsealiases(name))
2508
2500 2509 return func
2501 2510 return decorator
2502 2511
@@ -26,6 +26,13 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")
32 optionalrepo = ("identify paths serve config showconfig debugancestor debugdag"
33 " debugdata debugindex debugindexdot debugrevlog")
34 inferrepo = ("add addremove annotate cat commit diff grep forget log parents"
35 " remove resolve status debugwalk")
29 36 # common command options
30 37
31 38 globalopts = [
@@ -5977,11 +5984,3 b' def version_(ui):'
5977 5984 "There is NO\nwarranty; "
5978 5985 "not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n"
5979 5986 ))
5980
5981 norepo = ("clone init version help debugcommands debugcomplete"
5982 " debugdate debuginstall debugfsinfo debugpushkey debugwireargs"
5983 " debugknown debuggetbundle debugbundle")
5984 optionalrepo = ("identify paths serve config showconfig debugancestor debugdag"
5985 " debugdata debugindex debugindexdot debugrevlog")
5986 inferrepo = ("add addremove annotate cat commit diff grep forget log parents"
5987 " remove resolve status debugwalk")
General Comments 0
You need to be logged in to leave comments. Login now