##// END OF EJS Templates
revlog._addrevision(): make the parent of the cached delta explicit
Benoit Boissinot -
r11962:5f7ee3db default
parent child Browse files
Show More
@@ -188,11 +188,7 b' class manifest(revlog.revlog):'
188 if dstart != None:
188 if dstart != None:
189 delta.append([dstart, dend, "".join(dline)])
189 delta.append([dstart, dend, "".join(dline)])
190 # apply the delta to the addlist, and get a delta for addrevision
190 # apply the delta to the addlist, and get a delta for addrevision
191 cachedelta = addlistdelta(addlist, delta)
191 cachedelta = (self.rev(p1), addlistdelta(addlist, delta))
192
193 # the delta is only valid if we've been processing the tip revision
194 if p1 != self.tip():
195 cachedelta = None
196 arraytext = addlist
192 arraytext = addlist
197 text = buffer(arraytext)
193 text = buffer(arraytext)
198
194
@@ -1142,7 +1142,7 b' class revlog(object):'
1142 tr.replace(self.indexfile, trindex * self._io.size)
1142 tr.replace(self.indexfile, trindex * self._io.size)
1143 self._chunkclear()
1143 self._chunkclear()
1144
1144
1145 def addrevision(self, text, transaction, link, p1, p2, d=None):
1145 def addrevision(self, text, transaction, link, p1, p2, cachedelta=None):
1146 """add a revision to the log
1146 """add a revision to the log
1147
1147
1148 text - the revision data to add
1148 text - the revision data to add
@@ -1156,13 +1156,15 b' class revlog(object):'
1156 dfh = self.opener(self.datafile, "a")
1156 dfh = self.opener(self.datafile, "a")
1157 ifh = self.opener(self.indexfile, "a+")
1157 ifh = self.opener(self.indexfile, "a+")
1158 try:
1158 try:
1159 return self._addrevision(text, transaction, link, p1, p2, d, ifh, dfh)
1159 return self._addrevision(text, transaction, link, p1, p2,
1160 cachedelta, ifh, dfh)
1160 finally:
1161 finally:
1161 if dfh:
1162 if dfh:
1162 dfh.close()
1163 dfh.close()
1163 ifh.close()
1164 ifh.close()
1164
1165
1165 def _addrevision(self, text, transaction, link, p1, p2, d, ifh, dfh):
1166 def _addrevision(self, text, transaction, link, p1, p2,
1167 cachedelta, ifh, dfh):
1166 node = hash(text, p1, p2)
1168 node = hash(text, p1, p2)
1167 if node in self.nodemap:
1169 if node in self.nodemap:
1168 return node
1170 return node
@@ -1172,8 +1174,14 b' class revlog(object):'
1172 base = self.base(prev)
1174 base = self.base(prev)
1173 offset = self.end(prev)
1175 offset = self.end(prev)
1174 flags = 0
1176 flags = 0
1177 d = None
1175
1178
1176 if curr:
1179 if curr:
1180 # can we use the cached delta?
1181 if cachedelta:
1182 cacherev, d = cachedelta
1183 if cacherev != prev:
1184 d = None
1177 if not d:
1185 if not d:
1178 if self._parentdelta:
1186 if self._parentdelta:
1179 ptext = self.revision(p1)
1187 ptext = self.revision(p1)
General Comments 0
You need to be logged in to leave comments. Login now