Mercurial > hg
changeset 6871:13fe85fe396b
mdiff: compare content of binary files directly
A plain Python string comparison stops when the first mismatch is
found, whereas the call to md5 would need to compute the hash over the
entire string and only then do the comparison.
author | Martin Geisler <mg@daimi.au.dk> |
---|---|
date | Sat, 09 Aug 2008 02:10:22 +0200 |
parents | 974f5263f546 |
children | c7cc40fd74f6 |
files | mercurial/mdiff.py |
diffstat | 1 files changed, 1 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/mdiff.py Fri Aug 08 18:49:55 2008 +0200 +++ b/mercurial/mdiff.py Sat Aug 09 02:10:22 2008 +0200 @@ -78,10 +78,7 @@ 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 util.md5(v).digest() - if a and b and len(a) == len(b) and h(a) == h(b): + if a and b and len(a) == len(b) and a == b: return "" l = ['Binary file %s has changed\n' % fn1] elif not a: