changeset 16277:1c2aaf05f7d7 stable

aliases: use empty string for missing position parameters (issue3331)
author Matt Mackall <mpm@selenic.com>
date Thu, 22 Mar 2012 17:07:39 -0500
parents 6b16ded5c810
children 900eee0778d1
files mercurial/dispatch.py
diffstat 1 files changed, 3 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- 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]