Comments
Patch
@@ -2429,29 +2429,36 @@ 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.
+
+ The optionalrepo argument defines whether the command optionally requires
+ a local repository.
"""
- def cmd(name, options=(), synopsis=None, norepo=False):
+ def cmd(name, options=(), synopsis=None, norepo=False, optionalrepo=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))
+ if optionalrepo:
+ import commands
+ commands.optionalrepo += ' %s' % ' '.join(parsealiases(name))
+
return func
return decorator
return cmd
# a list of (ui, repo, otherpeer, opts, missing) functions called by
# commands.outgoing. "missing" is "missing" of the result of
# "findcommonoutgoing()"