[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: Why non matching eols in patch and target. (svn patch related)

From: Stefan Sperling <stsp_at_elego.de>
Date: Tue, 2 Feb 2010 21:11:52 +0100

On Tue, Feb 02, 2010 at 08:48:43PM +0100, Daniel Näslund wrote:
> Hi Stefan!
>
> In match_hunk() we try to match lines from the context of the patch with
> lines in the target. Earlier, in init_patch_target() we detect the eol
> of the target and open streams to read from the target and to write the
> patched result. Those streams does translation of keywords and eols.
>
> In match_hunk we read a line from original_text and translate it. But we
> don't get any translation of the eols in hunk_line_translated.

svn patch only repairs EOLs if the svn:eol-style enforces a fixed
value (such as CR or CRLF). Try setting svn:eol-style to 'CRLF' on
the patch target. Then you'll see dos-style newlines in the patched result.

Admittedly, we may want to repair EOLs in more scenarios (such as
eol-style = native).

> I've set the eol_str argument in svn_subst_translate_cstring2() to
> "\r\n" for testing but it still doesn't use "\r\n" for eol. Can there be
> an error in svn_subst_translate_cstring2()?

No, it's working as expected.

> /* Contract keywords, if any, before matching. */
> SVN_ERR(svn_subst_translate_cstring2(hunk_line->data,
> &hunk_line_translated,
> "\r\n, FALSE,

Try passing TRUE for the 'repair' parameter:

                                       "\r\n", TRUE,

Stefan

> target->keywords, FALSE,
> iterpool));
Received on 2010-02-02 21:12:35 CET

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.