##// END OF EJS Templates
Add paranoia to diff code
mpm@selenic.com -
r98:3dde7c87 default
parent child Browse files
Show More
@@ -78,7 +78,11 b' class manifest(revlog):'
78 def diff(self, a, b):
78 def diff(self, a, b):
79 # this is sneaky, as we're not actually using a and b
79 # this is sneaky, as we're not actually using a and b
80 if self.listcache and len(self.listcache[0]) == len(a):
80 if self.listcache and len(self.listcache[0]) == len(a):
81 return mdiff.diff(self.listcache[1], self.addlist, 1)
81 d = mdiff.diff(self.listcache[1], self.addlist, 1)
82 if mdiff.patch(a, d) != b:
83 sys.stderr.write("*** sortdiff failed, falling back ***\n")
84 return mdiff.textdiff(a, b)
85 return d
82 else:
86 else:
83 return mdiff.textdiff(a, b)
87 return mdiff.textdiff(a, b)
84
88
@@ -190,7 +190,8 b' class revlog:'
190
190
191 (p1, p2) = self.parents(node)
191 (p1, p2) = self.parents(node)
192 if node != hash(text, p1, p2):
192 if node != hash(text, p1, p2):
193 raise "integrity check failed on %s:%d" % (self.datafile, rev)
193 raise IOError("integrity check failed on %s:%d"
194 % (self.datafile, rev))
194
195
195 self.cache = (node, rev, text)
196 self.cache = (node, rev, text)
196 return text
197 return text
@@ -210,7 +211,10 b' class revlog:'
210 start = self.start(base)
211 start = self.start(base)
211 end = self.end(t)
212 end = self.end(t)
212 prev = self.revision(self.tip())
213 prev = self.revision(self.tip())
213 data = compress(self.diff(prev, text))
214 d = self.diff(prev, text)
215 if self.patches(prev, [d]) != text:
216 raise AssertionError("diff failed")
217 data = compress(d)
214 dist = end - start + len(data)
218 dist = end - start + len(data)
215
219
216 # full versions are inserted when the needed deltas
220 # full versions are inserted when the needed deltas
General Comments 0
You need to be logged in to leave comments. Login now