diff mercurial/patch.py @ 4092:4ced663bebf0

git patches: handle renames of binary files
author Alexis S. L. Carvalho <alexis@cecm.usp.br>
date Fri, 16 Feb 2007 04:54:46 -0200
parents 2b3175acb653
children 49237d6ae97d ed46895aa38c
line wrap: on
line diff
--- a/mercurial/patch.py	Thu Feb 15 08:49:20 2007 -0200
+++ b/mercurial/patch.py	Fri Feb 16 04:54:46 2007 -0200
@@ -412,6 +412,8 @@
             yield text[i:i+csize]
             i += csize
 
+    if to == tn:
+        return
     # TODO: deltas
     l = len(tn)
     fp.write('index %s..%s\nGIT binary patch\nliteral %s\n' %
@@ -593,8 +595,8 @@
                     to = getfile(a).read(arev)
                 else:
                     header.append('new file mode %s\n' % mode)
-                    if util.binary(tn):
-                        dodiff = 'binary'
+                if util.binary(tn):
+                    dodiff = 'binary'
             elif f in removed:
                 if f in srcs:
                     dodiff = False