Minor safety checks to manifest diff
authormpm@selenic.com
Mon, 23 May 2005 16:05:48 -0800
changeset 140 30ef77113872
parent 139 17e66e1a0382
child 141 5f471a75d607
Minor safety checks to manifest diff
mercurial/hg.py
--- a/mercurial/hg.py	Mon May 23 16:05:05 2005 -0800
+++ b/mercurial/hg.py	Mon May 23 16:05:48 2005 -0800
@@ -64,7 +64,7 @@
 
     def diff(self, a, b):
         # this is sneaky, as we're not actually using a and b
-        if self.listcache and len(self.listcache[0]) == len(a):
+        if self.listcache and self.addlist and self.listcache[0] == a:
             d = mdiff.diff(self.listcache[1], self.addlist, 1)
             if mdiff.patch(a, d) != b:
                 sys.stderr.write("*** sortdiff failed, falling back ***\n")
@@ -83,6 +83,7 @@
         n = self.addrevision(text, transaction, link, p1, p2)
         self.mapcache = (n, map)
         self.listcache = (text, self.addlist)
+        self.addlist = None
 
         return n