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

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

From: Daniel Näslund <daniel_at_longitudo.com>
Date: Tue, 2 Feb 2010 20:48:43 +0100

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.

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()?

A piece of code from match_hunk() where I've inserted debug statements
and changed the eol_str argument of translate_cstring2().

[[[
const char *hunk_line_translated;
const char *eol_str;

svn_pool_clear(iterpool);

SVN_ERR(svn_stream_readline_detect_eol(hunk->original_text,
                            &hunk_line, &eol_str,
                            &hunk_eof, iterpool));
/* Contract keywords, if any, before matching. */
SVN_ERR(svn_subst_translate_cstring2(hunk_line->data,
                                     &hunk_line_translated,
                                     "\r\n, FALSE,
                                     target->keywords, FALSE,
                                     iterpool));
lines_read++;
SVN_ERR(read_line(target, &target_line, iterpool, iterpool));

if (strstr(hunk_line_translated, "\r\n"))
  SVN_DBG(("hunk has \\r\\n \n"));

if (strstr(target_line, "\r\n"))
  SVN_DBG(("target has \\r\\n \n"));
]]]

A piece of the output. No '\r\n' endings found for hunk_line_translated.
[[[
DBG: patch.c: 629: target has \r\n
DBG: patch.c: 629: target has \r\n
DBG: patch.c: 629: target has \r\n
C svn-test-work/working_copies/patch_tests-9/A/mu
> rejected hunk @@ -1,1 +1,3 @@
]]]

Do you have any clues to this?

Daniel
Received on 2010-02-02 20:49:21 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.