Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to apply diff made by windows SVN on linux?

On windows i created a multi-file diff with:

svn diff > mydiff.diff

Then moved it to linux machine (with the same version of the same repo, no changes). How cai i apply it? After executing

 patch -p0 < mydiff.diff

I get the following output:

patching file licstat/test/unittest/test_licstatactioncontainers.cpp
File licstat/test/unittest/test_licstatactioncontainers.cpp is not empty after patch, as expected
patching file licstat/test/unittest/test_licstatactions.cpp
Hunk #1 FAILED at 99.
1 out of 1 hunk FAILED -- saving rejects to file licstat/test/unittest/test_licstatactions.cpp.rej
can't find file to patch at input line 295
Perhaps you used the wrong -p or --strip option?
The text leading up to this was:
--------------------------
|Index: licstat/test/unittest/test_licenseserverusagemap.cpp
|===================================================================
|--- licstat/test/unittest/test_licenseserverusagemap.cpp       (revision 6767)
|+++ licstat/test/unittest/test_licenseserverusagemap.cpp       (working copy)
--------------------------
File to patch: 

And the last line is prompt waiting for my action.

How should I create/apply the patch to make it work?

(edit) Now I see, that the file was missing and diff didn't create it. After creating the file manually I get errors like this:

patching file licstat/misc/generic/mysql/stored_procedures.sql
Hunk #1 FAILED at 220.
Hunk #2 FAILED at 245.
Hunk #3 FAILED at 622.
Hunk #4 FAILED at 661.
Hunk #5 FAILED at 810.
Hunk #6 FAILED at 822.
Hunk #7 FAILED at 868.
Hunk #8 FAILED at 999.
8 out of 8 hunks FAILED -- saving rejects to file licstat/misc/generic/mysql/stored_procedures.sql.rej
like image 968
ssobczak Avatar asked Jul 02 '10 08:07

ssobczak


1 Answers

Using "dos2unix" will not help if you have CR+LF line feed in your files on Linux.

This command should do the job with any combination of line feeds:

patch -p0 -l --binary < patch.diff
like image 153
Sergey Galin Avatar answered Oct 15 '22 07:10

Sergey Galin