I have a patchfile like this:
Index: dir/file.xml
===================================================================
--- dir/file.xml (revision 178)
+++ dir/file.xml (working copy)
@@ -7,7 +7,7 @@
<markup>
- <markup />
+ <markup></markup>
<markup>
<markup>
@@ -20,6 +20,7 @@
<markup>
<markup>
+ <tag>
<markup>
To apply it to the SVN working copy, I branched it using:
$ svn copy -r 178 trunk/component/dir branches/mybranch
Then I tried
$ cd branches/mybranch
$ ls -R
./dir:
file.xml
$ patch -p0 -i ~/patchfile.patch
but SVN's output is
(Stripping trailing CRs from patch.)
patching file dir/file.xml
Hunk #1 FAILED at 7.
Hunk #2 FAILED at 20.
2 out of 2 hunks FAILED -- saving rejects to file dir/file.xml.rej
for every file?
What could cause SVN to reject the patch? I am on a UNIX machine but patch and repository have Windows line-endings...
Thanks for help!
The dos2unix
tip was not bad but did not solve the problem as suggested.
What I did to actually patch all the files:
$ cd branches/mybranch
$ sudo apt-get install tofrodos
$ fromdos ~/patchfile.patch
$ fromdos */*
$ patch -p0 -i ~/patchfile.patch
$ todos */*
So basically patch
seems to have a problem handling CR/LF
lines under Unix. Converting it to LF
, then patch and convert it back after patching helped.
Credits to Stefan.
you could try the dos2unix tool on the patch file. That will convert the line endings.
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