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

login
register
mail settings
Submitter phabricator
Date May 7, 2018, 10:19 p.m.
Message ID <differential-rev-PHID-DREV-bltsyt2ytfx6kzh6iu2g-req@phab.mercurial-scm.org>
Download mbox | patch
Permalink /patch/31315/
State Superseded
Headers show

Comments

phabricator - May 7, 2018, 10:19 p.m.
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




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

Patch

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@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