Comments
Patch
@@ -2488,16 +2488,25 @@ def command(table):
See ``mercurial.fancyopts.fancyopts()`` for the format of each tuple.
The synopsis argument defines a short, one line summary of how to use the
command. This shows up in the help output.
+
+ The norepo argument defines whether the command does not require a
+ local repository. Most commands operate against a repository, thus the
+ default is False.
"""
-
- def cmd(name, options=(), synopsis=None):
+ def cmd(name, options=(), synopsis=None, norepo=False):
def decorator(func):
if synopsis:
table[name] = func, list(options), synopsis
else:
table[name] = func, list(options)
+
+ if norepo:
+ # Avoid import cycle.
+ import commands
+ commands.norepo += ' %s' % ' '.join(parsealiases(name))
+
return func
return decorator
return cmd