Bug 267195 - [Patch] Some refactorings required in Local Diff
Summary: [Patch] Some refactorings required in Local Diff
Status: RESOLVED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: Compare (show other bugs)
Version: 3.5   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Platform-Compare-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 71374
  Show dependency tree
 
Reported: 2009-03-05 08:48 EST by Tomasz Zarna CLA
Modified: 2009-03-30 11:54 EDT (History)
4 users (show)

See Also:


Attachments
Patch v1 (104.99 KB, patch)
2009-03-12 10:07 EDT, Krzysztof Pog這dzi雟ki CLA
no flags Details | Diff
Tests_Patch v1 (1.03 KB, patch)
2009-03-12 10:10 EDT, Krzysztof Pog這dzi雟ki CLA
no flags Details | Diff
Patch v2 (89.37 KB, patch)
2009-03-23 10:54 EDT, Kacper Zdanowicz CLA
no flags Details | Diff
Patch v3 (90.93 KB, patch)
2009-03-30 11:10 EDT, Kacper Zdanowicz CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Tomasz Zarna CLA 2009-03-05 08:48:34 EST
branch_20090126_LocalDiff

Couple of things that would be good to have done before merging the code from branch_20090126_LocalDiff to HEAD:

1. UnifiedDiffFormater: create a constant that indicates that we're not using strict unix format when creating local diffs
2. UnifiedDiffFormater: remove the last argument from UDF's constructor, I guess passing docs and paths in a particular order could do the job here, ie: when in "left-to-right" mode pass the left doc as first, when in "right-to-left" pass the right one first
3. UnifiedDiffFormater: instead of passing the whole DocumentMerger you could just provide a list of all changes when creating the UDF
4. GenerateDiffFileWizard: the isRightToLeft() method is not clear to me, it checks whether the LEFT_OPTION is selected which could indicate that the patch contain changes contributed from left to right... but I may be wrong here. Why don't put a short javadoc there to make things crystal clear
5. TextMergeViewer: removing extra whitespaces was a bad idea, my fault. Please revert that change, this will make merging much easier
6. In case we would like to use patches generated by CVS to test the ones generated locally you would need to ignore other markers that could be found in such a patch eg. PatchReader.MULTIPROJECTPATCH_HEADER
Comment 1 Krzysztof Pog這dzi雟ki CLA 2009-03-12 10:07:41 EDT
Created attachment 128554 [details]
Patch v1

About Your requests, Tomasz:
1.
Done.

2. and 3.
We changed formatter constructor, to:

public UnifiedDiffFormatter(DocumentMerger merger, String oldPath, String newPath, boolean rightToLeft)

We're passing the whole merger, because now we take leftDoc, rightDoc and allDiffs from it, so it's reasonable to pass one merger instead of three other parameters.

We also left rightToLeft parameter, because it is essential to interpret diffs from merger in a proper way.

The merger, (taken from comapre editor), produceed diffs using left and right side of comaprison from editor.
So if we change the contributing side using wizard, we have to somhow notify about it the formatter, so it may process the diffs in right order. 

4.
We explaind in javadoc what this method does exactly.

5.
Done.

6.
It was done already. Method getContentFromLines(..) is responsible for that.
Comment 2 Krzysztof Pog這dzi雟ki CLA 2009-03-12 10:10:48 EDT
Created attachment 128555 [details]
Tests_Patch v1

Due to Patch v1 changes, minor change in tests wes required.
Comment 3 Tomasz Zarna CLA 2009-03-18 08:01:39 EDT
Krzysztof I've just updated the branch with all the changes from HEAD. The problem is that it made the patch not appliable (conflicts in TextMergeViewer), could you update it please?
Comment 4 Kacper Zdanowicz CLA 2009-03-18 13:08:13 EDT
Tomasz, the only changes made to TextMergeViewer in patch to this bug, were corrected whitespaces (nr 5 in the bug description).

Since you have already moved all the changes from head to branch, we don't need these changes of whitspaces anymore, is that correct ?
Comment 5 Tomasz Zarna CLA 2009-03-19 05:03:25 EDT
(In reply to comment #4)
> Tomasz, the only changes made to TextMergeViewer in patch to this bug, were
> corrected whitespaces (nr 5 in the bug description).

This is not quite true, in the patch I can see that you commented out contributeChangeEncodingAction(MergeSourceViewer) method body and did the same for getTextEditorAdapter(). Could you explain what's the meaning of this? Or did this happen by accident?
 
> Since you have already moved all the changes from head to branch, we don't need
> these changes of whitspaces anymore, is that correct ?

No, if you had looked at the code you would have seen that I moved only logical changes.
Comment 6 Kacper Zdanowicz CLA 2009-03-23 10:54:21 EDT
Created attachment 129604 [details]
Patch v2

Patch is now appliable to current version of branch LocalDiff.

> This is not quite true, in the patch I can see that you commented out
> contributeChangeEncodingAction(MergeSourceViewer) method body and did the same
> for getTextEditorAdapter(). Could you explain what's the meaning of this? Or
> did this happen by accident?

That's our fault, it got there by accident, sorry.
Comment 7 Tomasz Zarna CLA 2009-03-30 06:46:10 EDT
Patch v2 is not applyable i.e. there are conflicts in TMV and GDFW. Guys, could you update it? Thanks.
Comment 8 Kacper Zdanowicz CLA 2009-03-30 07:07:38 EDT
(In reply to comment #7)
> Patch v2 is not applyable i.e. there are conflicts in TMV and GDFW. Guys, could
> you update it? Thanks.
> 

Tomasz, I've just checked the Patch v2 on the verion straight from the branch (no other changes made by other patches) and it applied without any conflicts. 

Could you please check if your project have any other changes, before applying Patch v2 ? Thank you.
Comment 9 Tomasz Zarna CLA 2009-03-30 08:37:13 EDT
My fault, missed the fact that Szymon made some changes on the branch in the meantime.

The patch applies smoothly now, but still I've got two questions:
1. Didn't we agree that STRICT_UNIX_FORMAT constant should be documented? This way, you could remove the info about how the current implementation differs from the GNU one.
2. You didn't mention that you commented out a line in TMV. To be more precise, the one that set Command ID the Find action. This is unrelated to this bug, you should touch it.
Comment 10 Kacper Zdanowicz CLA 2009-03-30 11:10:14 EDT
Created attachment 130252 [details]
Patch v3

> 1. Didn't we agree that STRICT_UNIX_FORMAT constant should be documented? This
> way, you could remove the info about how the current implementation differs
> from the GNU one.

all comments on implementation differences moved to javadoc of STRICT_UNIX_FORMAT constant.


> 2. You didn't mention that you commented out a line in TMV. To be more precise,
> the one that set Command ID the Find action. This is unrelated to this bug, you
> should touch it.

Sorry, our fault, it shouldn't be commented out, fixed.
Comment 11 Tomasz Zarna CLA 2009-03-30 11:54:15 EDT
Both patches released to the branch. I removed few more whitespace differences from TMV.