Mercurial > hg > mercurial-crew-with-dirclash
diff mercurial/mdiff.py @ 4107:226df1808f16
merge with crew-stable
author | Thomas Arendsen Hein <thomas@intevation.de> |
---|---|
date | Tue, 20 Feb 2007 20:55:23 +0100 |
parents | abaee83ce0a6 544838cc1158 |
children | 99c853a1408c |
line wrap: on
line diff
--- a/mercurial/mdiff.py +++ b/mercurial/mdiff.py @@ -5,7 +5,7 @@ # This software may be used and distributed according to the terms # of the GNU General Public License, incorporated herein by reference. -import bdiff, mpatch, re, struct, util +import bdiff, mpatch, re, struct, util, md5 def splitnewlines(text): '''like str.splitlines, but only split on newlines.''' @@ -57,6 +57,11 @@ def unidiff(a, ad, b, bd, fn, r=None, op epoch = util.datestr((0, 0)) if not opts.text and (util.binary(a) or util.binary(b)): + def h(v): + # md5 is used instead of sha1 because md5 is supposedly faster + return md5.new(v).digest() + if a and b and len(a) == len(b) and h(a) == h(b): + return "" l = ['Binary file %s has changed\n' % fn] elif not a: b = splitnewlines(b)