D3158: histedit: look up partial nodeid as partial nodeid

martinvonz (Martin von Zweigbergk) phabricator at mercurial-scm.org
Fri Apr 6 16:55:02 UTC 2018


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

REVISION SUMMARY
  I'm about to remove support for repo[<partial hex nodeid>]. In the
  verify() method, we know that self.node is always a partial or full
  binary nodeid, so the most correct way to look up the revision is by
  using changelog._partialmatch(), so let's do that. (It's closer to the
  current code to do scmutil.revsymbol(), but that's less correct
  because it will match a bookmark or tag that happens to have the same
  prefix as the node.)

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  hgext/histedit.py

CHANGE DETAILS

diff --git a/hgext/histedit.py b/hgext/histedit.py
--- a/hgext/histedit.py
+++ b/hgext/histedit.py
@@ -443,11 +443,9 @@
         """ Verifies semantic correctness of the rule"""
         repo = self.repo
         ha = node.hex(self.node)
-        try:
-            self.node = repo[ha].node()
-        except error.RepoError:
-            raise error.ParseError(_('unknown changeset %s listed')
-                              % ha[:12])
+        self.node = repo.unfiltered().changelog._partialmatch(ha)
+        if self.node is None:
+            raise error.ParseError(_('unknown changeset %s listed') % ha[:12])
         self._verifynodeconstraints(prev, expected, seen)
 
     def _verifynodeconstraints(self, prev, expected, seen):



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


More information about the Mercurial-devel mailing list