Bug 283327

Summary: [Apply Patch] Wizard should warn about fuzz factor >= available context lines count
Product: [Eclipse Project] Platform Reporter: Markus Keller <markus.kell.r>
Component: CompareAssignee: Platform-Compare-Inbox <platform-compare-inbox>
Status: ASSIGNED --- QA Contact:
Severity: enhancement    
Priority: P3    
Version: 3.5   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard:

Description Markus Keller CLA 2009-07-13 12:30:10 EDT
I had org.eclipse.jdt.ui and org.eclipse.jdt.ui.tests.refactoring from HEAD (with /org.eclipse.jdt.ui.tests.refactoring/test cases/org/eclipse/jdt/ui/tests/refactoring/ExtractMethodTests.java 1.86).

Then I tried to apply the patch from bug 213519. When I clicked 'Guess', the fuzz factor stayed 0 and there was error on ExtractMethodTests.java. When I manually set it to 3, the patch was applied correctly.
Comment 1 Tomasz Zarna CLA 2009-07-14 04:42:19 EDT
The logic used when guessing the fuzz factor is very simple: it iterates the factor from 0 to 2 trying to shift a hunk up and down each iteration. Most of the times 3 is the number of context lines accompanying a hunk, ignoring all of them (using the factor equal 3) would be a quite risky approach. See bug 211750 for more details. If this makes sense to you I guess we could change this report to a documentation bug, since the doc isn't not saying anything about the fact that the iteration ends at 2 (and why). What do you think?  
Comment 2 Markus Keller CLA 2009-07-14 07:05:23 EDT
Hmm, I didn't actually think about how the fuzz factor works. My patch indeed just had 3 context lines, and I was just lucky that it still worked only considering exact line numbers. I agree that Guess should not guess up to 3.

But for ignorant people like me who just raise the factor until it "works", it would be good to show a warning in cases where none of the context lines is actually used when the patch is applied. Turning this bug into an enhancement request.

Doc update would also be good (even better if it was available right in the dialog, see bug 233710;-).
Comment 3 Tomasz Zarna CLA 2009-07-14 08:27:06 EDT
(In reply to comment #2)
> (...) it would be good to show a warning in cases where none of the context lines is
> actually used when the patch is applied.

This could be addressed on bug 217076.
Comment 4 Eclipse Webmaster CLA 2019-09-06 16:12:26 EDT
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.