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

Re: svn_client_patch not applying patch correctly

From: Daniel Näslund <daniel_at_longitudo.com>
Date: Sun, 23 May 2010 12:14:33 +0200

Hi Stefan Sperling

Just posting to tell I'm looking into this.

On Sat, May 22, 2010 at 12:58:42AM +0200, Stefan Sperling wrote:
> On Fri, May 21, 2010 at 10:27:42PM +0200, Stefan Küng wrote:
> > * ShellCache.h
> > -> this file results in three applied and one rejected hunk
> > the result as it *should* be is shown in image1, the result
> > from svn_client_patch is shown in image2
> Where are the images you are referring to?
> This seems to be a "no newline at end of file" handling problem.
> We should look at it in detail. Please file an issue.

Yup. I simplified the failing hunk to only have a context line at the
end and could still get a failure:

Index: ShellCache.h
--- ShellCache.h (revision 906)
+++ ShellCache.h (working copy)
@@ -193,6 +193,7 @@
  DWORD layoutticker;
  DWORD langticker;
  DWORD blockstatusticker;
+ DWORD debug;
  UINT drivetypecache[27];
  TCHAR drivetypepathcache[MAX_PATH];

What does the code do to handle missing eols?
parse_next_hunk(): Since r906588, we're including lines with missing
  newlines at end of hunk.
match_hunk(): If the target has no eol at end-of-file, we check if the
  next line of the hunk is the eof and adjust accordingly. The code
  says that we have a match.

What fails?
apply_hunk(): When seeking in the target to target->current_line +
  hunk->original_text we get the wrong line and the hunk is marked as

Received on 2010-05-24 10:02:21 CEST

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