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

login
register
mail settings
Submitter phabricator
Date Nov. 24, 2020, 6:07 p.m.
Message ID <differential-rev-PHID-DREV-lsc4mn72gswpnhxuh35e-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/47668/
State Superseded
Headers show

Comments

phabricator - Nov. 24, 2020, 6:07 p.m.
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




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

Patch

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]