mercurial/cmdutil.py
changeset 21774 b280d0b60bc3
parent 21767 75a96326cecb
child 21777 17d1ac452127
--- a/mercurial/cmdutil.py	Sun May 04 22:07:45 2014 -0700
+++ b/mercurial/cmdutil.py	Sun May 04 22:12:34 2014 -0700
@@ -2493,8 +2493,11 @@
     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
@@ -2506,6 +2509,10 @@
                 import commands
                 commands.norepo += ' %s' % ' '.join(parsealiases(name))
 
+            if optionalrepo:
+                import commands
+                commands.optionalrepo += ' %s' % ' '.join(parsealiases(name))
+
             return func
         return decorator