History | Log In     View a printable version of the current page.  
Issue Details (XML | Word | Printable)

Key: IDEA-16591
Type: Usability Problem Usability Problem
Status: Open Open
Assignee: Dmitry Jemerov
Reporter: Björn Kautler
Votes: 0
Watchers: 1
Operations

If you were logged in you would be able to see more operations.
IDEA: Feedback

Apply Patch and Unshelve Changes Behaviour if context has changed

Created: 04 Dec 07 12:58   Updated: 04 Dec 07 13:26
Component/s: Diff/Merge

Environment: Windows XP SP2

Build: 7,364
Severity: High


 Description  « Hide
If you try to apply a patch, or to unshelve changes, this fails if the context that is stored in the patch/shelf has changed in the original file. Additionally if this is for one file in the patch/shelf, some files get changed, and some stay how they were. It would be very helpful to solve this in another way. I suggest 1. to try to find the matching position with less context if it cannot be found with three lines of context, like the --fuzz option to GNU patch being set to 2 or 3 and apply the patch there if the position is still unambiguous. And 2. if no matching position is found even with fuzzing context, there should be an option to manually merge the files like if there is a conflict when updating from VCS and not only a message "Context has changed".

 All   Comments   Work Log   Change History      Sort Order:
Dmitry Jemerov - 04 Dec 07 13:03
Actually the manual 3-way merge is provided if the patch contains a reference to the original version against which the patch was created (which is true if you are using SVN and the patch was created with IntelliJ IDEA or SVN itself). Otherwise there is no meaningful way to get the 3 versions to show in the merge dialog.

Björn Kautler - 04 Dec 07 13:26
Even if there is no reference there should be some way to solve the problem other than opening the patch file in a text editor and applying the changes manually by copy and paste.
Besides that should still the --fuzz option be used.
And even if there is a reference, it doesn't show any merge dialog. Do the following:
  • open a file
  • change one line (lets assume it is line 10)
  • go to "Local Changes" and Shelve the Change
  • change either line 7 or 8
  • try to unshelve the change and you get the message "Failed to apply patch for file <filename>: couldn't find context"
  • undo the changes in line 7 and 8
  • change line 9, 11, 12 or 13
  • try to unshelve the change and you get the message
    Failed to apply patch for file <filename>: Context mismatch. Expected line:
        <first mismatching line from patch file>
    Found line:
        <first mismatching line from original file>
  • undo the changes in line 9, 11, 12 and 13
  • change line 10
  • try to unshelve the change and you get the message
    Failed to apply patch for file <filename>: Context mismatch. Expected line:
        <line 11 from patch file>
    Found line:
        <line 10 from original file>