D9389: errors: raise InputError when too few arguments given to alias

martinvonz (Martin von Zweigbergk) phabricator at mercurial-scm.org
Tue Nov 24 18:07:41 UTC 2020


martinvonz created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D9389

AFFECTED FILES
  mercurial/dispatch.py
  tests/test-alias.t

CHANGE DETAILS

diff --git a/tests/test-alias.t b/tests/test-alias.t
--- a/tests/test-alias.t
+++ b/tests/test-alias.t
@@ -357,10 +357,10 @@
 
   $ hg positional
   abort: too few arguments for command alias
-  [255]
+  [10]
   $ hg positional a
   abort: too few arguments for command alias
-  [255]
+  [10]
   $ hg positional 'node|short' rev
   0 e63c23eaa88a | 1970-01-01 00:00 +0000
 
diff --git a/mercurial/dispatch.py b/mercurial/dispatch.py
--- a/mercurial/dispatch.py
+++ b/mercurial/dispatch.py
@@ -510,7 +510,7 @@
             nums.append(num)
             if num < len(givenargs):
                 return givenargs[num]
-            raise error.Abort(_(b'too few arguments for command alias'))
+            raise error.InputError(_(b'too few arguments for command alias'))
 
         cmd = re.sub(br'\$(\d+|\$)', replacer, cmd)
         givenargs = [x for i, x in enumerate(givenargs) if i not in nums]



To: martinvonz, #hg-reviewers
Cc: mercurial-patches, mercurial-devel


More information about the Mercurial-devel mailing list