Bug 16270 - Can't compare with patch
Summary: Can't compare with patch
Status: RESOLVED DUPLICATE of bug 13190
Alias: None
Product: Platform
Classification: Eclipse Project
Component: Compare (show other bugs)
Version: 2.0   Edit
Hardware: PC Linux-Motif
: P1 normal (vote)
Target Milestone: ---   Edit
Assignee: Andre Weinand CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2002-05-17 11:50 EDT by Jared Burns CLA
Modified: 2002-05-28 08:14 EDT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jared Burns CLA 2002-05-17 11:50:33 EDT
Build 20020515
Linux-Motif

Importing patches appears to be totally busted.

1. Change a file, save, right click, and choose "Team->Create patch"
2. Select "Save in filesystem" and choose a location for the patch file.
3. In another workspace (optional?) right click on the file from step 1 and 
choose "Compare With->Patch"
4. Select the location of the exported patch file and choose next. The tree 
in the "Verify Patch" page shows the patch file with an error that says 
"(file doesn''t exist)" (Yes, it has double '' in doesn't). "Next" and 
"Finish" are disabled.
5. Try to select the checkbox for the "non-existant" patch. You can't. 
Expand the node of the non-existant patch, however, and you can select (not 
check) the sub-nodes and see the comparison in the compare viewer below.
Comment 1 Erich Gamma CLA 2002-05-19 19:07:04 EDT
need to investigate
Comment 2 Andre Weinand CLA 2002-05-21 05:17:37 EDT
Jared, please attach the patch file to this PR so that I can investigate better.

And now some tips how patch works:

- the patch wizard helps you in finding the correct arguments to apply a patch 
sucessfully. You cannot use the wizard to 'force' application of a patch that 
does not match anything in your workspace. So the checkboxes can only be used 
if a whole patch (or just a hunk) already matches but you decide that you don't 
want to take it.

- so the main goal of using the patch wizard is to maximize the number of 
matches (and minimize the number of errors) by tweaking the available options.
(in this respect the patch wizard is similar to using the 'real' patch: you 
have to find the right arguments to successfully apply a patch).

- If an error message says: "(file doesn't exist)" this means that the patch 
file has 'hunks' for a file that should be there but isn't. Typically this 
means that the patch was created relative to one directory, but applied 
relative to another directory. In Eclipse patch files are created relative to a 
project, so they must be applied to projects as well.

- If the path names stored in a patch doesn't match the pathnames in you 
current workspace, you can 'ignore leading pathname segments'.

- if you could get rid of the '(file doesn't exist)' error message but still 
cannot get a single matching hunk then enable the 'ignore whitespace' option. 
In Eclipse we have the problem that patch files created for files that are 
stored in the repository in binary mode won't match to text files in workspace 
because of different line separators. The 'ignore whitespace' should allow 
these lines to match.

- if still not all hunks match try adjust the 'fuzz' factor. 
It determines how far from its original line a hunk is allowed to match.
The default is two. So if a hunk does not match at the line given in the patch 
file, I try to match the hunk 'fuzz' number of lines before or after the 
position. 

Please note: If you select a hunk the compare viewer shows only the content of 
the hunk side-by-side, it *does not* show you how this hunk would be applied to 
your current workspace! So the left hand side shows the repository contents, 
the right hand side shows the workspace contents both at the time the patch 
file has been created.

BTW: you don't have to apply a patch to a workspace that was used to create the 
same patch, just use the 'reverse' option. It reverts the direction of all 
hunks within a patch and can be used to 'undo' all changes.
Comment 3 Veronika Irvine CLA 2002-05-22 14:01:28 EDT
I have the same problem as Jared.  The problem is that the patch tool can not 
handle files.  If you select the folder for the file (be it the source folder 
or a package folder) then the patch tool works (as long as you check off Ignore 
Whitespace and select the exact same folder in the both cases).

I do not understand why the patch tool can not cope with files - if neccessary 
it could just grab the parent folder of the file and acts as if the patch 
commands were applied to that folder.

I am attaching my patch that shows the problem.
Comment 4 Andre Weinand CLA 2002-05-28 08:14:06 EDT

*** This bug has been marked as a duplicate of 13190 ***