diff --git a/mercurial/dispatch.py b/mercurial/dispatch.py --- a/mercurial/dispatch.py +++ b/mercurial/dispatch.py @@ -218,7 +218,7 @@ def _runcatch(req): def aliasargs(fn, givenargs): args = getattr(fn, 'args', []) - if args and givenargs: + if args: cmd = ' '.join(map(util.shellquote, args)) nums = [] @@ -227,7 +227,7 @@ def aliasargs(fn, givenargs): nums.append(num) if num < len(givenargs): return givenargs[num] - return '' + raise util.Abort(_('too few arguments for command alias')) cmd = re.sub(r'\$(\d+|\$)', replacer, cmd) givenargs = [x for i, x in enumerate(givenargs) if i not in nums] diff --git a/tests/test-alias.t b/tests/test-alias.t --- a/tests/test-alias.t +++ b/tests/test-alias.t @@ -134,6 +134,12 @@ with opts and whitespace positional arguments + $ hg positional + abort: too few arguments for command alias + [255] + $ hg positional a + abort: too few arguments for command alias + [255] $ hg positional 'node|short' rev 0 e63c23eaa88a | 1970-01-01 00:00 +0000