Patchwork D1438: revlog: use "partialmatch" on the nodemap object

login
register
mail settings
Submitter phabricator
Date Nov. 16, 2017, 11:10 p.m.
Message ID <differential-rev-PHID-DREV-gpt4s7zqntwbybncx4ik-req@phab.mercurial-scm.org>
Download mbox | patch
Permalink /patch/25612/
State Superseded
Headers show

Comments

phabricator - Nov. 16, 2017, 11:10 p.m.
quark created this revision.
Herald added a reviewer: indygreg.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  Previously, `partialmatch` belongs to the `index` object. The `index` is
  more about converting rev to node: `index[rev] -> node`. The `nodemap`
  object is to convert node to rev: `nodemap[node] -> rev`. Since
  `partialmatch` is to convert a prefix of node to rev, it's more related to
  the `nodemap` object. So let's move it there logically.
  
  This allows external code to try an alternative `nodemap` (and partialmatch)
  implementation without touching the index object.
  
  Since the C implementation uses a same object for both `index` and
  `nodemap`, this change does not need to change any of the C code.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  mercurial/revlog.py

CHANGE DETAILS




To: quark, indygreg, #hg-reviewers
Cc: mercurial-devel
phabricator - Nov. 17, 2017, 9:08 a.m.
quark abandoned this revision.
quark added a comment.


  Actually it is hex -> node. So does not really belong to nodemap.

REPOSITORY
  rHG Mercurial

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

To: quark, indygreg, #hg-reviewers
Cc: mercurial-devel

Patch

diff --git a/mercurial/revlog.py b/mercurial/revlog.py
--- a/mercurial/revlog.py
+++ b/mercurial/revlog.py
@@ -1180,7 +1180,7 @@ 
     def _partialmatch(self, id):
         maybewdir = wdirhex.startswith(id)
         try:
-            partial = self.index.partialmatch(id)
+            partial = self.nodemap.partialmatch(id)
             if partial and self.hasnode(partial):
                 if maybewdir:
                     # single 'ff...' match in radix tree, ambiguous with wdir