Gmane
Gravatar
From: Adam Monsen <haircut@...>
Subject: applying patches created on Windows to a Linux/Mac working copy
Newsgroups: gmane.comp.finance.mifos.devel
Date: 2008-03-13 18:09:09 GMT (1 year, 16 weeks, 13 hours and 31 minutes ago)
Sometimes I run into problems trying to apply patches for Mifos
created on Windows. I'm using Ubuntu, and as you might have heard,
Linux distributions have different end-of-line characters than
Windows. If this is news to you, read all about it here:
http://en.wikipedia.org/wiki/Newline and then shake your head in awe
at how silly it is that this fundamental difference still exists.

Both the "patch" program and Eclipse get confused when the line
endings can't be resolved. Here are a couple of workarounds if you
find you cannot apply patches:

1. let Subversion manage the line endings for you
 a. set the "svn:eol-style" property to "native" on the command line
or in Eclipse
2. change the line endings of the file(s) to be patched from CR+LF to LF
 a. on the command line, use "dos2unix"
 b. in Vim, use ":set ff=unix"
 c. apply the patch

I prefer the first option because
* Subversion seems to do a fine job of managing line endings
* patches "just work" more often than not
* resultant diffs are easier to read since they only contain actual changes
* if you manually override the line endings every time, subversion
thinks the entire file changed

For existing files, we can set the svn:eol-style property after the
fact to initiate Subversion end-of-line management. For new .java,
.xml, .jsp, .sql, .properties, and .txt files, we can use a feature on
the client side called "auto-props".

For svn command-line users, place the following data in the Subversion
config file:
http://www.apache.org/dev/svn-eol-style.txt

For TortoiseSVN users,
1. Right click on any Windows folder
2. Select TortoiseSVN->Setting
3. Click on the 'Edit' for Subversion configuration file
4. paste in the text from http://www.apache.org/dev/svn-eol-style.txt

(I copied the Windows instructions
from
http://www.mail-archive.com/dev-NV/pVVO+l3dd/SJB6HiN2Ni2O/JbrIOy <at> public.gmane.org/msg10022.html --
hopefully they're correct)

Hope this helps!

-- 
Adam Monsen

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/