diff --git a/mercurial/revset.py b/mercurial/revset.py --- a/mercurial/revset.py +++ b/mercurial/revset.py @@ -2690,7 +2690,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): diff --git a/mercurial/scmutil.py b/mercurial/scmutil.py --- a/mercurial/scmutil.py +++ b/mercurial/scmutil.py @@ -1798,7 +1798,7 @@ k = encoding.tolocal(k) try: data[revsingle(repo, k).rev()] = encoding.tolocal(v) - except (error.LookupError, error.RepoLookupError): + except (error.LookupError, error.RepoLookupError, error.InputError): pass # we ignore data for nodes that don't exist locally finally: if proc: diff --git a/tests/test-revisions.t b/tests/test-revisions.t --- a/tests/test-revisions.t +++ b/tests/test-revisions.t @@ -36,8 +36,8 @@ 1:9 7 was ambiguous and still is $ hg l -r 7 - abort: 00changelog.i@7: ambiguous identifier - [255] + abort: ambiguous revision identifier: 7 + [10] 7b is no longer ambiguous $ hg l -r 7b 3:7b diff --git a/tests/test-revset.t b/tests/test-revset.t --- a/tests/test-revset.t +++ b/tests/test-revset.t @@ -1873,8 +1873,8 @@ 3 $ hg log --template '{rev}\n' -r 'id(x)' $ hg log --template '{rev}\n' -r 'x' - abort: 00changelog.i@: ambiguous identifier - [255] + abort: ambiguous revision identifier: x + [10] $ log 'id(23268)' 4 $ log 'id(2785f51eece)' @@ -2040,14 +2040,14 @@ obsoleted 1 changesets $ hg debugrevspec 'fff' - abort: 00changelog.i@fff: ambiguous identifier - [255] + abort: ambiguous revision identifier: fff + [10] $ hg debugrevspec 'ffff' - abort: 00changelog.i@ffff: ambiguous identifier - [255] + abort: ambiguous revision identifier: ffff + [10] $ hg debugrevspec 'fffb' - abort: 00changelog.i@fffb: ambiguous identifier - [255] + abort: ambiguous revision identifier: fffb + [10] BROKEN should be '2' (node lookup uses unfiltered repo) $ hg debugrevspec 'id(fffb)' BROKEN should be '2' (node lookup uses unfiltered repo)