Patchwork D7317: revlog: access the nodemap through the index

login
register
mail settings
Submitter phabricator
Date Nov. 8, 2019, 9:31 a.m.
Message ID <differential-rev-PHID-DREV-fswmmadb3iz3dtwv7as2-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/42915/
State Superseded
Headers show

Comments

phabricator - Nov. 8, 2019, 9:31 a.m.
marmoute created this revision.
Herald added a reviewer: indygreg.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  The `revlog.rev` method now access the nodemap through `self.index.nodemap`,
  instead of using the `_nodecache` attribute that we are trying to remove.
  
  This work is part of a refactoring to unify the revlog index and the nodemap.
  This unification prepare the use of a persistent nodemap.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  mercurial/revlog.py

CHANGE DETAILS




To: marmoute, indygreg, #hg-reviewers
Cc: mercurial-devel
phabricator - Nov. 8, 2019, 7:34 p.m.
This revision is now accepted and ready to land.
indygreg added a comment.
indygreg accepted this revision.


  Note that this adds an extra lookup to calls to `rev()`, which is often used in tight loops. But I think things may be fine. And we can always reintroduce the property if it shows up in perf tests.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D7317/new/

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

To: marmoute, 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
@@ -661,7 +661,7 @@ 
 
     def rev(self, node):
         try:
-            return self._nodecache[node]
+            return self.index.nodemap[node]
         except TypeError:
             raise
         except error.RevlogError: