views:

42

answers:

3

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
A: 

My immediate hunch is that you need to convert the CRLF's in the windows diff file to just LF for linux.

John Weldon
A: 

I quite regularly patch files between a windows and mac system and patch does seem to deal with the newlines correctly so I don't think that's the issue. It looks like may you've deleted test_licstatactioncontainers.cpp and the first warning is about that. The second appears to be complaining about not finding the file itself.

Could this be a filename case issue? Windows is insensitive to filename case, but linux isn't. Is the file actually called Test_LicenceServerUsageMap.cpp on linux perchance? Or the directory LicStat/Test ?

the_mandrill
Yes, I removed the file (with svn), so it should be fine.No, all directory/file names are lower-case.
ssobczak
A: 

Try converting the line endings in the patch file from DOS to Unix, using the dos2unix command.

Richard Fearn