jigs5460 / tortoisesvn

Automatically exported from code.google.com/p/tortoisesvn
0 stars 0 forks source link

Applying patch can find wrong "better" path #626

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
When applying a patch that does not match properly, TortoiseMerge automatically 
starts looking for a better path to apply the patch to.
In some situations, that 'better' path can be actually worse than the original 
path.

Reported first here on the mailing list:
http://tortoisesvn.tigris.org/ds/viewMessage.do?dsForumId=4061&dsMessageId=30747
31

Steps to reproduce:
1. Download the following patch:
http://people.apache.org/~markt/patches/2014-03-17-chunked-headers-tc6-v1.patch

It contains mergeinfo change on "." and changes to two files:
 java/org/apache/coyote/http11/filters/ChunkedInputFilter.java
 webapps/docs/changelog.xml

2. Checkout source code of the project (Apache Tomcat 6.0) from
https://svn.apache.org/repos/asf/tomcat/tc6.0.x/trunk

My wc is at r1578508 now.  Size of the wc is 17 Mb (35 Mb together
with ".svn" directory).

3. In Explorer right-click in the trunk directory, choose TortoiseSVN
> Apply patch... and apply the patch.

4.  Actual behaviour:

A dialog is displayed:
"TortoiseMerge"
Path found that matches the patch better.
The path
<skipped>\trunk
seems not to match the paths in the patchfile.
But TortoiseMerge found the path
<skipped>\trunk\java\org
matches it better. Do you want to use the suggested path instead?

with two options
a) -> "Use the found path."
"Apply the patch to <skipped>\trunk\java\org
b) -> "Use the original path."
"Apply the patch to <skipped>\trunk\

If I choose a) the patch is applied.
Changes to ChunkedInputFilter.java are applied, as it should be.
Changes to changelog.xml are rejected - that is OK, as the file has
been changed since when the patch was created.

If I choose b),
the following empty directories are created and 'added', note the
mossing "java/org" prefix:  apache/coyote/http11/filters
and both changes to ChunkedInputFilter.java and changelog.xml are rejected.

Expected behaviour
Apply the patch at the correct path (project trunk) and without such dialog.

5. SVN Command Line works correctly:

...\trunk>svn patch 2014-03-17-chunked-headers-tc6-v1.patch
Skipped missing target: '.'
U         java\org\apache\coyote\http11\filters\ChunkedInputFilter.java
C         webapps\docs\changelog.xml
>         rejected hunk @@ -44,6 +44,15 @@
Summary of conflicts:
  Text conflicts: 1
  Skipped paths: 1

...\trunk>svn st
M       java\org\apache\coyote\http11\filters\ChunkedInputFilter.java
?       webapps\docs\changelog.xml.svnpatch.rej

Note that ChunkedInputFilter.java is patched correctly and a
*.svnpatch.rej file is created for rejected hunk for changelog.xml

Original issue reported on code.google.com by tortoisesvn on 19 Mar 2014 at 7:36

GoogleCodeExporter commented 9 years ago
This issue was closed by revision r25323.

Original comment by tortoisesvn on 19 Mar 2014 at 9:14

GoogleCodeExporter commented 9 years ago
Thank you!

For an archival reference, I am attaching the patch file that was used to 
reproduce this issue. (These changes have been already applied to the project, 
so I expect that the patch file will be moved away soon).

Original comment by knst.kol...@gmail.com on 20 Mar 2014 at 2:34

Attachments: