revset: make id() an empty set for ambiguous nodeid (BC)
As Yuya pointed out in the review of D3311, id() (and rev()) does not
raise an error when the input is an unknown identifier, so it doesn't
make sense for it to do that when the input is ambiguous with a
filtered node. However, it turned out that it already does raise an
error when the input is ambiguous among the visible nodes. So let's
start by fixing that.
Differential Revision: https://phab.mercurial-scm.org/D3462
--- a/mercurial/revset.py Sat May 05 00:16:43 2018 -0700
+++ b/mercurial/revset.py Mon May 07 14:32:43 2018 -0700
@@ -1336,6 +1336,8 @@
pm = repo.changelog._partialmatch(n)
if pm is not None:
rn = repo.changelog.rev(pm)
+ except LookupError:
+ pass
except error.WdirUnsupported:
rn = node.wdirrev
--- a/tests/test-revset.t Sat May 05 00:16:43 2018 -0700
+++ b/tests/test-revset.t Mon May 07 14:32:43 2018 -0700
@@ -1713,8 +1713,6 @@
Test hexadecimal revision
$ log 'id(2)'
- abort: 00changelog.i@2: ambiguous identifier!
- [255]
$ log 'id(23268)'
4
$ log 'id(2785f51eece)'