D3462: revset: make id() an empty set for ambiguous nodeid (BC)

martinvonz (Martin von Zweigbergk) phabricator at mercurial-scm.org
Mon May 7 22:19:12 UTC 2018


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

REVISION SUMMARY
  As Yuya pointed out in the review of https://phab.mercurial-scm.org/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.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  mercurial/revset.py
  tests/test-revset.t

CHANGE DETAILS

diff --git a/tests/test-revset.t b/tests/test-revset.t
--- a/tests/test-revset.t
+++ b/tests/test-revset.t
@@ -1713,8 +1713,6 @@
 
 Test hexadecimal revision
   $ log 'id(2)'
-  abort: 00changelog.i at 2: ambiguous identifier!
-  [255]
   $ log 'id(23268)'
   4
   $ log 'id(2785f51eece)'
diff --git a/mercurial/revset.py b/mercurial/revset.py
--- a/mercurial/revset.py
+++ b/mercurial/revset.py
@@ -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
 



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


More information about the Mercurial-devel mailing list