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