##// END OF EJS Templates
treemanifests: extract _loaddifflazy from _diff, use in _filesnotin...
spectral -
r40074:906c9507 default
parent child Browse files
Show More
@@ -724,6 +724,28 b' class treemanifest(object):'
724 loadlazy(k + '/')
724 loadlazy(k + '/')
725 return visit
725 return visit
726
726
727 def _loaddifflazy(self, t1, t2):
728 """load items in t1 and t2 if they're needed for diffing.
729
730 The criteria currently is:
731 - if it's not present in _lazydirs in either t1 or t2, load it in the
732 other (it may already be loaded or it may not exist, doesn't matter)
733 - if it's present in _lazydirs in both, compare the nodeid; if it
734 differs, load it in both
735 """
736 toloadlazy = []
737 for d, v1 in t1._lazydirs.iteritems():
738 v2 = t2._lazydirs.get(d)
739 if not v2 or v2[1] != v1[1]:
740 toloadlazy.append(d)
741 for d, v1 in t2._lazydirs.iteritems():
742 if d not in t1._lazydirs:
743 toloadlazy.append(d)
744
745 for d in toloadlazy:
746 t1._loadlazy(d)
747 t2._loadlazy(d)
748
727 def __len__(self):
749 def __len__(self):
728 self._load()
750 self._load()
729 size = len(self._files)
751 size = len(self._files)
@@ -957,8 +979,7 b' class treemanifest(object):'
957 return
979 return
958 t1._load()
980 t1._load()
959 t2._load()
981 t2._load()
960 t1._loadalllazy()
982 self._loaddifflazy(t1, t2)
961 t2._loadalllazy()
962 for d, m1 in t1._dirs.iteritems():
983 for d, m1 in t1._dirs.iteritems():
963 if d in t2._dirs:
984 if d in t2._dirs:
964 m2 = t2._dirs[d]
985 m2 = t2._dirs[d]
@@ -1113,18 +1134,7 b' class treemanifest(object):'
1113 return
1134 return
1114 t1._load()
1135 t1._load()
1115 t2._load()
1136 t2._load()
1116 toloadlazy = []
1137 self._loaddifflazy(t1, t2)
1117 for d, v1 in t1._lazydirs.iteritems():
1118 v2 = t2._lazydirs.get(d)
1119 if not v2 or v2[1] != v1[1]:
1120 toloadlazy.append(d)
1121 for d, v1 in t2._lazydirs.iteritems():
1122 if d not in t1._lazydirs:
1123 toloadlazy.append(d)
1124
1125 for d in toloadlazy:
1126 t1._loadlazy(d)
1127 t2._loadlazy(d)
1128
1138
1129 for d, m1 in t1._dirs.iteritems():
1139 for d, m1 in t1._dirs.iteritems():
1130 m2 = t2._dirs.get(d, emptytree)
1140 m2 = t2._dirs.get(d, emptytree)
General Comments 0
You need to be logged in to leave comments. Login now