D1438: revlog: use "partialmatch" on the nodemap object
quark (Jun Wu)
phabricator at mercurial-scm.org
Thu Nov 16 23:10:20 UTC 2017
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
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
To: quark, indygreg, #hg-reviewers
Cc: mercurial-devel
More information about the Mercurial-devel
mailing list