Mercurial > public > mercurial-scm > hg
comparison mercurial/hg.py @ 98:3dde7c87e36d
Add paranoia to diff code
author | mpm@selenic.com |
---|---|
date | Wed, 18 May 2005 16:59:54 -0800 |
parents | fce47326677c |
children | 707a7481a861 |
comparison
equal
deleted
inserted
replaced
97:7a2abee6b0c2 | 98:3dde7c87e36d |
---|---|
76 return map | 76 return map |
77 | 77 |
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 |
85 def add(self, map, transaction, link, p1=None, p2=None): | 89 def add(self, map, transaction, link, p1=None, p2=None): |
86 files = map.keys() | 90 files = map.keys() |