On Tue, Feb 23, 2010 at 09:27:34PM +0100, Stefan Sperling wrote:
> On Tue, Feb 23, 2010 at 08:57:26PM +0100, Daniel Näslund wrote:
> > On Tue, Feb 02, 2010 at 09:11:52PM +0100, Stefan Sperling wrote:
> > > 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 have a test where the target uses '\r\n' and the patch uses '\r' . The
> > eols are consistent within each file but we get a failure saying:
> > [[[
> > subversion/svn/patch-cmd.c:81: (apr_err=135000)
> > subversion/libsvn_client/patch.c:1463: (apr_err=135000)
> > subversion/libsvn_client/patch.c:1410: (apr_err=135000)
> > subversion/libsvn_client/patch.c:1100: (apr_err=135000)
> > subversion/libsvn_client/patch.c:830: (apr_err=135000)
> > subversion/libsvn_client/patch.c:799: (apr_err=135000)
> > subversion/libsvn_subr/subst.c:876: (apr_err=135000)
> > subversion/libsvn_subr/subst.c:643: (apr_err=135000)
> > svn: Inconsistent line ending style
> > ]]]
> Where and how?
It happens when we've written all our hunks and we want to copy the
remaining lines. Here's a piece of apply_one_patch(). It's the call to
copy_lines_to_target() that throws the error.
/* Apply or reject hunks. */
for (i = 0; i < target->hunks->nelts; i++)
hi = APR_ARRAY_IDX(target->hunks, i, hunk_info_t *);
SVN_ERR(reject_hunk(target, hi, iterpool));
SVN_ERR(apply_hunk(target, hi, iterpool));
if (target->kind == svn_node_file)
/* Copy any remaining lines to target. */
SVN_ERR(copy_lines_to_target(target, 0, scratch_pool));
if (! target->eof)
/* We could not copy the entire target file to the temporary file,
* and would truncate the target if we copied the temporary file
* on top of it. Skip this target. */
target->skipped = TRUE;
The test has one line after the last hunk. If I remove that line, the
Received on 2010-02-23 22:06:45 CET