##// END OF EJS Templates
patch: create file even if source is not /dev/null...
Brendan Cully -
r9328:648d6a1a default
parent child Browse files
Show More
@@ -793,6 +793,17 b' def selectfile(afile_orig, bfile_orig, h'
793 793 if reverse:
794 794 createfunc = hunk.rmfile
795 795 missing = not goodb and not gooda and not createfunc()
796
797 # some diff programs apparently produce create patches where the
798 # afile is not /dev/null, but rather the same name as the bfile
799 if missing and afile == bfile:
800 # this isn't very pretty
801 hunk.create = True
802 if createfunc():
803 missing = False
804 else:
805 hunk.create = False
806
796 807 # If afile is "a/b/foo" and bfile is "a/b/foo.orig" we assume the
797 808 # diff is between a file and its backup. In this case, the original
798 809 # file should be patched (see original mpatch code).
@@ -332,3 +332,16 b' new file mode 100644'
332 332 EOF
333 333 hg import --no-commit a.patch
334 334 cd ..
335
336 echo '% create file when source is not /dev/null'
337 cat > create.patch <<EOF
338 diff -Naur proj-orig/foo proj-new/foo
339 --- proj-orig/foo 1969-12-31 16:00:00.000000000 -0800
340 +++ proj-new/foo 2009-07-17 16:50:45.801368000 -0700
341 @@ -0,0 +1,1 @@
342 +a
343 EOF
344 hg init oddcreate
345 cd oddcreate
346 hg import --no-commit ../create.patch
347 cat foo
@@ -292,3 +292,6 b' R a'
292 292 % add empty file from the end of patch (issue 1495)
293 293 adding a
294 294 applying a.patch
295 % create file when source is not /dev/null
296 applying ../create.patch
297 a
General Comments 0
You need to be logged in to leave comments. Login now