aliases: use empty string for missing position parameters (issue3331) stable
authorMatt Mackall <mpm@selenic.com>
Thu, 22 Mar 2012 17:07:39 -0500
branchstable
changeset 16277 1c2aaf05f7d7
parent 16276 6b16ded5c810
child 16278 900eee0778d1
aliases: use empty string for missing position parameters (issue3331)
mercurial/dispatch.py
--- a/mercurial/dispatch.py	Wed Mar 21 16:39:38 2012 -0500
+++ b/mercurial/dispatch.py	Thu Mar 22 17:07:39 2012 -0500
@@ -225,7 +225,9 @@
         def replacer(m):
             num = int(m.group(1)) - 1
             nums.append(num)
-            return givenargs[num]
+            if num < len(givenargs):
+                return givenargs[num]
+            return ''
         cmd = re.sub(r'\$(\d+|\$)', replacer, cmd)
         givenargs = [x for i, x in enumerate(givenargs)
                      if i not in nums]