##// END OF EJS Templates
alias: abort on missing positional args (issue3331)
Matt Mackall -
r16294:795d591b stable
parent child Browse files
Show More
@@ -218,7 +218,7 b' def _runcatch(req):'
218
218
219 def aliasargs(fn, givenargs):
219 def aliasargs(fn, givenargs):
220 args = getattr(fn, 'args', [])
220 args = getattr(fn, 'args', [])
221 if args and givenargs:
221 if args:
222 cmd = ' '.join(map(util.shellquote, args))
222 cmd = ' '.join(map(util.shellquote, args))
223
223
224 nums = []
224 nums = []
@@ -227,7 +227,7 b' def aliasargs(fn, givenargs):'
227 nums.append(num)
227 nums.append(num)
228 if num < len(givenargs):
228 if num < len(givenargs):
229 return givenargs[num]
229 return givenargs[num]
230 return ''
230 raise util.Abort(_('too few arguments for command alias'))
231 cmd = re.sub(r'\$(\d+|\$)', replacer, cmd)
231 cmd = re.sub(r'\$(\d+|\$)', replacer, cmd)
232 givenargs = [x for i, x in enumerate(givenargs)
232 givenargs = [x for i, x in enumerate(givenargs)
233 if i not in nums]
233 if i not in nums]
@@ -134,6 +134,12 b' with opts and whitespace'
134
134
135 positional arguments
135 positional arguments
136
136
137 $ hg positional
138 abort: too few arguments for command alias
139 [255]
140 $ hg positional a
141 abort: too few arguments for command alias
142 [255]
137 $ hg positional 'node|short' rev
143 $ hg positional 'node|short' rev
138 0 e63c23eaa88a | 1970-01-01 00:00 +0000
144 0 e63c23eaa88a | 1970-01-01 00:00 +0000
139
145
General Comments 0
You need to be logged in to leave comments. Login now