comparison mercurial/hg.py @ 140:30ef77113872

Minor safety checks to manifest diff
author mpm@selenic.com
date Mon, 23 May 2005 16:05:48 -0800
parents a0e57df96e96
children ea9188538222
comparison
equal deleted inserted replaced
139:17e66e1a0382 140:30ef77113872
62 self.mapcache = (node, map) 62 self.mapcache = (node, map)
63 return map 63 return map
64 64
65 def diff(self, a, b): 65 def diff(self, a, b):
66 # this is sneaky, as we're not actually using a and b 66 # this is sneaky, as we're not actually using a and b
67 if self.listcache and len(self.listcache[0]) == len(a): 67 if self.listcache and self.addlist and self.listcache[0] == a:
68 d = mdiff.diff(self.listcache[1], self.addlist, 1) 68 d = mdiff.diff(self.listcache[1], self.addlist, 1)
69 if mdiff.patch(a, d) != b: 69 if mdiff.patch(a, d) != b:
70 sys.stderr.write("*** sortdiff failed, falling back ***\n") 70 sys.stderr.write("*** sortdiff failed, falling back ***\n")
71 return mdiff.textdiff(a, b) 71 return mdiff.textdiff(a, b)
72 return d 72 return d
81 text = "".join(self.addlist) 81 text = "".join(self.addlist)
82 82
83 n = self.addrevision(text, transaction, link, p1, p2) 83 n = self.addrevision(text, transaction, link, p1, p2)
84 self.mapcache = (n, map) 84 self.mapcache = (n, map)
85 self.listcache = (text, self.addlist) 85 self.listcache = (text, self.addlist)
86 self.addlist = None
86 87
87 return n 88 return n
88 89
89 class changelog(revlog): 90 class changelog(revlog):
90 def __init__(self, opener): 91 def __init__(self, opener):