diff mercurial/patch.py @ 12574:77600d697d0e stable

patch: fix rename text to binary file (issue2400)
author Patrick Mezard <pmezard@gmail.com>
date Mon, 27 Sep 2010 22:47:10 +0200
parents b6173aee4a47
children 9b3913baba0c
line wrap: on
line diff
--- a/mercurial/patch.py	Mon Sep 27 10:48:21 2010 -0500
+++ b/mercurial/patch.py	Mon Sep 27 22:47:10 2010 +0200
@@ -1184,7 +1184,9 @@
                 gp.path = pathstrip(gp.path, strip - 1)[1]
                 if gp.oldpath:
                     gp.oldpath = pathstrip(gp.oldpath, strip - 1)[1]
-                if gp.op in ('COPY', 'RENAME'):
+                # 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:
                     copyfn(gp.oldpath, gp.path, cwd)
                 changed[gp.path] = gp
         else: