##// END OF EJS Templates
revlog.addrevision(): move computation of nodeid in addrevision()...
Benoit Boissinot -
r12023:44c22dc1 default
parent child Browse files
Show More
@@ -1137,25 +1137,25 b' class revlog(object):'
1137 p1, p2 - the parent nodeids of the revision
1137 p1, p2 - the parent nodeids of the revision
1138 cachedelta - an optional precomputed delta
1138 cachedelta - an optional precomputed delta
1139 """
1139 """
1140 node = hash(text, p1, p2)
1141 if (node in self.nodemap and
1142 (not self.flags(self.rev(node)) & REVIDX_PUNCHED_FLAG)):
1143 return node
1144
1140 dfh = None
1145 dfh = None
1141 if not self._inline:
1146 if not self._inline:
1142 dfh = self.opener(self.datafile, "a")
1147 dfh = self.opener(self.datafile, "a")
1143 ifh = self.opener(self.indexfile, "a+")
1148 ifh = self.opener(self.indexfile, "a+")
1144 try:
1149 try:
1145 return self._addrevision(text, transaction, link, p1, p2,
1150 return self._addrevision(node, text, transaction, link, p1, p2,
1146 cachedelta, ifh, dfh)
1151 cachedelta, ifh, dfh)
1147 finally:
1152 finally:
1148 if dfh:
1153 if dfh:
1149 dfh.close()
1154 dfh.close()
1150 ifh.close()
1155 ifh.close()
1151
1156
1152 def _addrevision(self, text, transaction, link, p1, p2,
1157 def _addrevision(self, node, text, transaction, link, p1, p2,
1153 cachedelta, ifh, dfh):
1158 cachedelta, ifh, dfh):
1154 node = hash(text, p1, p2)
1155 if (node in self.nodemap and
1156 (not self.flags(self.rev(node)) & REVIDX_PUNCHED_FLAG)):
1157 return node
1158
1159 curr = len(self)
1159 curr = len(self)
1160 prev = curr - 1
1160 prev = curr - 1
1161 base = curr
1161 base = curr
@@ -1360,8 +1360,8 b' class revlog(object):'
1360 else:
1360 else:
1361 text = mdiff.patches(text, [delta])
1361 text = mdiff.patches(text, [delta])
1362 del delta
1362 del delta
1363 chk = self._addrevision(text, transaction, link, p1, p2, None,
1363 chk = self._addrevision(node, text, transaction, link,
1364 ifh, dfh)
1364 p1, p2, None, ifh, dfh)
1365 if not dfh and not self._inline:
1365 if not dfh and not self._inline:
1366 # addrevision switched from inline to conventional
1366 # addrevision switched from inline to conventional
1367 # reopen the index
1367 # reopen the index
General Comments 0
You need to be logged in to leave comments. Login now