diff mercurial/revset.py @ 46115:be3d8178251e

errors: raise InputError if an ambiguous revision id prefix is used It's long bothered me that we include the "00changelog.i" part in a message to the user. This fixes that along with the exit code. Differential Revision: https://phab.mercurial-scm.org/D9600
author Martin von Zweigbergk <martinvonz@google.com>
date Wed, 09 Dec 2020 20:22:25 -0800
parents 59fa3890d40a
children a4c19a162615
line wrap: on
line diff
--- a/mercurial/revset.py	Thu Dec 10 01:18:15 2020 -0800
+++ b/mercurial/revset.py	Wed Dec 09 20:22:25 2020 -0800
@@ -2691,7 +2691,15 @@
 
 
 def lookupfn(repo):
-    return lambda symbol: scmutil.isrevsymbol(repo, symbol)
+    def fn(symbol):
+        try:
+            return scmutil.isrevsymbol(repo, symbol)
+        except error.AmbiguousPrefixLookupError:
+            raise error.InputError(
+                b'ambiguous revision identifier: %s' % symbol
+            )
+
+    return fn
 
 
 def match(ui, spec, lookup=None):