changeset 4105:ed46895aa38c

git binary patches: use hashes to detect identical files
author Alexis S. L. Carvalho <alexis@cecm.usp.br>
date Sat, 17 Feb 2007 09:54:59 -0200
parents 0934fef871f3
children 797dbdd4d7e1
files mercurial/patch.py
diffstat 1 files changed, 4 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/patch.py	Sat Feb 17 09:54:58 2007 -0200
+++ b/mercurial/patch.py	Sat Feb 17 09:54:59 2007 -0200
@@ -412,12 +412,13 @@
             yield text[i:i+csize]
             i += csize
 
-    if to == tn:
+    tohash = gitindex(to)
+    tnhash = gitindex(tn)
+    if tohash == tnhash:
         return
     # TODO: deltas
-    l = len(tn)
     fp.write('index %s..%s\nGIT binary patch\nliteral %s\n' %
-             (gitindex(to), gitindex(tn), len(tn)))
+             (tohash, tnhash, len(tn)))
 
     tn = ''.join([fmtline(l) for l in chunk(zlib.compress(tn))])
     fp.write(tn)