I am using CVS and win7. I need to copy some changes from the trunk to a branch, so I thought I could just use "diff -ruN" to put the changes into a file, and then use "patch -i" to apply them to the branch.
So I saw this page, and this page. I already had cygwin diff, so I got gnu patch here. I made two files
\test\mydir1\afile.txt
\test\mydir2\afile.txt
which have minor differences. Then I type
cd test
diff -ruN mydir1 mydir2 >test.patch
patch --dry-run -i test.patch
and the result is
can't find file to patch at input line 4
Perhaps you should have used the -p or --strip option?
so I tried
patch --dry-run --verbose -p1 -i test.patch
and I get the same error. I tried a lot of other things for a long time with no success. Why is this so hard?
Ok here are the two things I needed to know, but were not documented anywhere
This works...
diff -ruN mydir1 mydir2 | unix2dos > test.patch
patch -p0 -i test.patch
You must convert to DOS line endings, and you must specify -p0. Otherwise the default is -p1. I hope this will help someone else.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With