diff mercurial/dispatch.py @ 27679:6822f9382b4c

dispatch: copy inferrepo attribute to alias commands The other attributes are copied. Let's do the same for the inferrepo.
author Yuya Nishihara <yuya@tcha.org>
date Mon, 04 Jan 2016 21:40:05 +0900
parents 707d66afce21
children a6344df5108e
line wrap: on
line diff
--- a/mercurial/dispatch.py	Wed Jan 06 04:59:46 2016 +0000
+++ b/mercurial/dispatch.py	Mon Jan 04 21:40:05 2016 +0900
@@ -434,6 +434,7 @@
         self.help = ''
         self.norepo = True
         self.optionalrepo = False
+        self.inferrepo = False
         self.badalias = None
         self.unknowncmd = False
 
@@ -499,6 +500,8 @@
                 self.norepo = False
             if cmd in commands.optionalrepo.split(' '):
                 self.optionalrepo = True
+            if cmd in commands.inferrepo.split(' '):
+                self.inferrepo = True
             if self.help.startswith("hg " + cmd):
                 # drop prefix in old-style help lines so hg shows the alias
                 self.help = self.help[4 + len(cmd):]
@@ -557,6 +560,8 @@
             commands.norepo += ' %s' % alias
         if aliasdef.optionalrepo:
             commands.optionalrepo += ' %s' % alias
+        if aliasdef.inferrepo:
+            commands.inferrepo += ' %s' % alias
 
 def _parse(ui, args):
     options = {}
@@ -723,9 +728,11 @@
         strict = True
         norepo = commands.norepo
         optionalrepo = commands.optionalrepo
+        inferrepo = commands.inferrepo
         def restorecommands():
             commands.norepo = norepo
             commands.optionalrepo = optionalrepo
+            commands.inferrepo = inferrepo
         cmdtable = commands.table.copy()
         addaliases(lui, cmdtable)
     else: