changeset 140:30ef77113872

Minor safety checks to manifest diff
author mpm@selenic.com
date Mon, 23 May 2005 16:05:48 -0800
parents 17e66e1a0382
children 5f471a75d607
files mercurial/hg.py
diffstat 1 files changed, 2 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- 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