You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by Stefan Küng <to...@gmail.com> on 2010/05/21 20:27:42 UTC
svn_client_patch not applying patch correctly
Hi,
I'm currently trying to make use of the new API svn_client_patch() in
TortoiseMerge and TSVN. I got it working already, but when I started
testing I found that it doesn't apply patches that can be applied cleanly.
In the TSVN repository, we have a few test files which show the problem.
The patch
http://code.google.com/p/tortoisesvn/source/browse/trunk/test/mergediff/patch.diff
should be applied to the folder
http://code.google.com/p/tortoisesvn/source/browse/trunk/test/mergediff/#mergediff/FilesToPatch
That patch file can be applied without any problem since the files to
patch weren't changed after the patch file was created. The original
patch implementation in TortoiseMerge can do it just fine, but
svn_client_patch can't.
The patch contains modifications to three files:
* yourShoppingCart.cfc
-> this file gets deleted by svn_client_patch, which is ok
* 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
* file1
-> this empty file should get one new line added, but instead
that hunk is rejected and the file stays empty.
Stefan
--
___
oo // \\ "De Chelonian Mobile"
(_,\/ \_/ \ TortoiseSVN
\ \_/_\_/> The coolest Interface to (Sub)Version Control
/_/ \_\ http://tortoisesvn.net
Re: svn_client_patch not applying patch correctly
Posted by Stefan Küng <to...@gmail.com>.
On 22.05.2010 00:58, 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?
I've attached them to the email. It worked ok as I can see in my 'sent'
folder, but none of the archives of the mailing list seem to have it?
Attaching them again, maybe it works better this time.
>
> This seems to be a "no newline at end of file" handling problem.
> We should look at it in detail. Please file an issue.
http://subversion.tigris.org/issues/show_bug.cgi?id=3643
I've also attached the images to the issue, just in case they vanish
again from this email.
>> * file1
>> -> this empty file should get one new line added, but instead
>> that hunk is rejected and the file stays empty.
>
> This is a bug in svn patch. Looks like it assumes the file will have content
> since it already exists (albeit it is empty). Please file a separate
> issue for this.
Done:
http://subversion.tigris.org/issues/show_bug.cgi?id=3644
Stefan
--
___
oo // \\ "De Chelonian Mobile"
(_,\/ \_/ \ TortoiseSVN
\ \_/_\_/> The coolest Interface to (Sub)Version Control
/_/ \_\ http://tortoisesvn.net
Re: svn_client_patch not applying patch correctly
Posted by Daniel Näslund <da...@longitudo.com>.
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
rejected.
Cheers,
Daniel
Re: svn_client_patch not applying patch correctly
Posted by Daniel Näslund <da...@longitudo.com>.
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
rejected.
Cheers,
Daniel
Re: svn_client_patch not applying patch correctly
Posted by Stefan Küng <to...@gmail.com>.
On 22.05.2010 00:58, 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?
I've attached them to the email. It worked ok as I can see in my 'sent'
folder, but none of the archives of the mailing list seem to have it?
Attaching them again, maybe it works better this time.
>
> This seems to be a "no newline at end of file" handling problem.
> We should look at it in detail. Please file an issue.
http://subversion.tigris.org/issues/show_bug.cgi?id=3643
I've also attached the images to the issue, just in case they vanish
again from this email.
>> * file1
>> -> this empty file should get one new line added, but instead
>> that hunk is rejected and the file stays empty.
>
> This is a bug in svn patch. Looks like it assumes the file will have content
> since it already exists (albeit it is empty). Please file a separate
> issue for this.
Done:
http://subversion.tigris.org/issues/show_bug.cgi?id=3644
Stefan
--
___
oo // \\ "De Chelonian Mobile"
(_,\/ \_/ \ TortoiseSVN
\ \_/_\_/> The coolest Interface to (Sub)Version Control
/_/ \_\ http://tortoisesvn.net
Re: svn_client_patch not applying patch correctly
Posted by Stefan Sperling <st...@elego.de>.
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.
> * file1
> -> this empty file should get one new line added, but instead
> that hunk is rejected and the file stays empty.
This is a bug in svn patch. Looks like it assumes the file will have content
since it already exists (albeit it is empty). Please file a separate
issue for this.
Thanks,
Stefan
Re: svn_client_patch not applying patch correctly
Posted by Stefan Sperling <st...@elego.de>.
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.
> * file1
> -> this empty file should get one new line added, but instead
> that hunk is rejected and the file stays empty.
This is a bug in svn patch. Looks like it assumes the file will have content
since it already exists (albeit it is empty). Please file a separate
issue for this.
Thanks,
Stefan