changeset 3588:45574a225632

git patch: create empty added files
author Brendan Cully <brendan@kublai.com>
date Mon, 30 Oct 2006 16:10:58 -0800
parents c8494fcc9d39
children 1c9b6f1237e0
files mercurial/patch.py
diffstat 1 files changed, 3 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/patch.py	Mon Oct 30 00:03:04 2006 -0800
+++ b/mercurial/patch.py	Mon Oct 30 16:10:58 2006 -0800
@@ -369,6 +369,9 @@
         if gp and gp.mode:
             x = gp.mode & 0100 != 0
             dst = os.path.join(repo.root, gp.path)
+            # patch won't create empty files
+            if ctype == 'ADD' and not os.path.exists(dst):
+                repo.wwrite(gp.path, '')
             util.set_exec(dst, x)
     cmdutil.addremove(repo, cfiles, wlock=wlock)
     files = patches.keys()