changeset 14369:f8932d540088

patch: handle binary copies as regular ones This introduces a performance regression for large files, as they will be copied just to be clobbered afterwards since binary patching does not use deltas. But it simplifies the code and the previous optimization will be reintroduced later in a better way.
author Patrick Mezard <pmezard@gmail.com>
date Wed, 18 May 2011 23:48:13 +0200
parents baf2807b9a7d
children 17cea10c343e
files mercurial/patch.py
diffstat 1 files changed, 2 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/patch.py	Wed May 18 23:48:13 2011 +0200
+++ b/mercurial/patch.py	Wed May 18 23:48:13 2011 +0200
@@ -923,7 +923,7 @@
         self.hunk = ['GIT binary patch\n']
 
     def createfile(self):
-        return self.gitpatch.op in ('ADD', 'RENAME', 'COPY')
+        return self.gitpatch.op == 'ADD'
 
     def rmfile(self):
         return self.gitpatch.op == 'DELETE'
@@ -1209,9 +1209,7 @@
                 gp.path = pathstrip(gp.path, strip - 1)[1]
                 if gp.oldpath:
                     gp.oldpath = pathstrip(gp.oldpath, strip - 1)[1]
-                # Binary patches really overwrite target files, copying them
-                # will just make it fails with "target file exists"
-                if gp.op in ('COPY', 'RENAME') and not gp.binary:
+                if gp.op in ('COPY', 'RENAME'):
                     backend.copy(gp.oldpath, gp.path)
                 changed[gp.path] = gp
         else: