##// END OF EJS Templates
context: avoid extra parents lookups...
Gregory Szorc -
r27064:a29db426 default
parent child Browse files
Show More
@@ -221,9 +221,10 class basectx(object):
221 return self._parents[0]
221 return self._parents[0]
222
222
223 def p2(self):
223 def p2(self):
224 if len(self._parents) == 2:
224 parents = self._parents
225 return self._parents[1]
225 if len(parents) == 2:
226 return changectx(self._repo, -1)
226 return parents[1]
227 return changectx(self._repo, nullrev)
227
228
228 def _fileinfo(self, path):
229 def _fileinfo(self, path):
229 if '_manifest' in self.__dict__:
230 if '_manifest' in self.__dict__:
@@ -1152,17 +1153,17 class committablectx(basectx):
1152 # filesystem doesn't support them
1153 # filesystem doesn't support them
1153
1154
1154 copiesget = self._repo.dirstate.copies().get
1155 copiesget = self._repo.dirstate.copies().get
1155
1156 parents = self.parents()
1156 if len(self._parents) < 2:
1157 if len(parents) < 2:
1157 # when we have one parent, it's easy: copy from parent
1158 # when we have one parent, it's easy: copy from parent
1158 man = self._parents[0].manifest()
1159 man = parents[0].manifest()
1159 def func(f):
1160 def func(f):
1160 f = copiesget(f, f)
1161 f = copiesget(f, f)
1161 return man.flags(f)
1162 return man.flags(f)
1162 else:
1163 else:
1163 # merges are tricky: we try to reconstruct the unstored
1164 # merges are tricky: we try to reconstruct the unstored
1164 # result from the merge (issue1802)
1165 # result from the merge (issue1802)
1165 p1, p2 = self._parents
1166 p1, p2 = parents
1166 pa = p1.ancestor(p2)
1167 pa = p1.ancestor(p2)
1167 m1, m2, ma = p1.manifest(), p2.manifest(), pa.manifest()
1168 m1, m2, ma = p1.manifest(), p2.manifest(), pa.manifest()
1168
1169
@@ -1192,10 +1193,11 class committablectx(basectx):
1192 an extra 'a'. This is used by manifests merge to see that files
1193 an extra 'a'. This is used by manifests merge to see that files
1193 are different and by update logic to avoid deleting newly added files.
1194 are different and by update logic to avoid deleting newly added files.
1194 """
1195 """
1196 parents = self.parents()
1195
1197
1196 man1 = self._parents[0].manifest()
1198 man1 = parents[0].manifest()
1197 man = man1.copy()
1199 man = man1.copy()
1198 if len(self._parents) > 1:
1200 if len(parents) > 1:
1199 man2 = self.p2().manifest()
1201 man2 = self.p2().manifest()
1200 def getman(f):
1202 def getman(f):
1201 if f in man1:
1203 if f in man1:
General Comments 0
You need to be logged in to leave comments. Login now