##// END OF EJS Templates
Don't lie that "binary file has changed"...
tailgunner@smtp.ru -
r4103:544838cc default
parent child Browse files
Show More
@@ -7,7 +7,7 b''
7
7
8 from demandload import demandload
8 from demandload import demandload
9 import bdiff, mpatch
9 import bdiff, mpatch
10 demandload(globals(), "re struct util")
10 demandload(globals(), "re struct util md5")
11
11
12 def splitnewlines(text):
12 def splitnewlines(text):
13 '''like str.splitlines, but only split on newlines.'''
13 '''like str.splitlines, but only split on newlines.'''
@@ -59,6 +59,11 b' def unidiff(a, ad, b, bd, fn, r=None, op'
59 epoch = util.datestr((0, 0))
59 epoch = util.datestr((0, 0))
60
60
61 if not opts.text and (util.binary(a) or util.binary(b)):
61 if not opts.text and (util.binary(a) or util.binary(b)):
62 def h(v):
63 # md5 is used instead of sha1 because md5 is supposedly faster
64 return md5.new(v).digest()
65 if a and b and len(a) == len(b) and h(a) == h(b):
66 return ""
62 l = ['Binary file %s has changed\n' % fn]
67 l = ['Binary file %s has changed\n' % fn]
63 elif not a:
68 elif not a:
64 b = splitnewlines(b)
69 b = splitnewlines(b)
General Comments 0
You need to be logged in to leave comments. Login now