D4873: treemanifests: extract _loaddifflazy from _diff, use in _filesnotin
spectral (Kyle Lippincott)
phabricator at mercurial-scm.org
Thu Oct 4 08:31:27 EDT 2018
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG906c95073ff7: treemanifests: extract _loaddifflazy from _diff, use in _filesnotin (authored by spectral, committed by ).
REPOSITORY
rHG Mercurial
CHANGES SINCE LAST UPDATE
https://phab.mercurial-scm.org/D4873?vs=11657&id=11671
REVISION DETAIL
https://phab.mercurial-scm.org/D4873
AFFECTED FILES
mercurial/manifest.py
CHANGE DETAILS
diff --git a/mercurial/manifest.py b/mercurial/manifest.py
--- a/mercurial/manifest.py
+++ b/mercurial/manifest.py
@@ -724,6 +724,28 @@
loadlazy(k + '/')
return visit
+ def _loaddifflazy(self, t1, t2):
+ """load items in t1 and t2 if they're needed for diffing.
+
+ The criteria currently is:
+ - if it's not present in _lazydirs in either t1 or t2, load it in the
+ other (it may already be loaded or it may not exist, doesn't matter)
+ - if it's present in _lazydirs in both, compare the nodeid; if it
+ differs, load it in both
+ """
+ toloadlazy = []
+ for d, v1 in t1._lazydirs.iteritems():
+ v2 = t2._lazydirs.get(d)
+ if not v2 or v2[1] != v1[1]:
+ toloadlazy.append(d)
+ for d, v1 in t2._lazydirs.iteritems():
+ if d not in t1._lazydirs:
+ toloadlazy.append(d)
+
+ for d in toloadlazy:
+ t1._loadlazy(d)
+ t2._loadlazy(d)
+
def __len__(self):
self._load()
size = len(self._files)
@@ -957,8 +979,7 @@
return
t1._load()
t2._load()
- t1._loadalllazy()
- t2._loadalllazy()
+ self._loaddifflazy(t1, t2)
for d, m1 in t1._dirs.iteritems():
if d in t2._dirs:
m2 = t2._dirs[d]
@@ -1113,18 +1134,7 @@
return
t1._load()
t2._load()
- toloadlazy = []
- for d, v1 in t1._lazydirs.iteritems():
- v2 = t2._lazydirs.get(d)
- if not v2 or v2[1] != v1[1]:
- toloadlazy.append(d)
- for d, v1 in t2._lazydirs.iteritems():
- if d not in t1._lazydirs:
- toloadlazy.append(d)
-
- for d in toloadlazy:
- t1._loadlazy(d)
- t2._loadlazy(d)
+ self._loaddifflazy(t1, t2)
for d, m1 in t1._dirs.iteritems():
m2 = t2._dirs.get(d, emptytree)
To: spectral, #hg-reviewers
Cc: mercurial-devel
More information about the Mercurial-devel
mailing list