Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [egit-dev] Logical model support in EGit

On Wed, Apr 17, 2013 at 10:31 AM, Laurent Goubet <laurent.goubet@xxxxxxx> wrote:
Hi,

Continuing on this effort, a number of patches that make progress in this direction have been contributed and merged. For the most part, they were patches I made as preparative work : take ancestor into account, use accurate revision instead of local data for the "left" side... I have now started to work on the real need; using the models when comparing. This requires me to modify all of the comparison action handlers ... and there are a lot.

All of the things that can launch a comparison (action handlers, history view, commit viewer...) use a different code to launch the comparison. I plan on factorizing all of this into a single entry point, removing duplicated code in the process. However, I have some trouble with the comparisons "with index" (either as left or right side of the comparison). I just pushed a draft version of this work on https://git.eclipse.org/r/11966 . This is not in a state where it can be properly reviewed (some actions are not yet refactored... and the tests need to be changed to take the new behavior into account), but I'd like some input on two points in particular :

CompareUtils (https://git.eclipse.org/r/#/c/11966/1/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/CompareUtils.java) line 554 :
I placed a TODO there... since I really don't know : is there a point in trying to find a common ancestor between "Index" and .... something? The two comparison actions we have is "compare Index with HEAD" and "Compare with Index". So the two only things we can get there with are HEAD or the working tree. IIUC, there is no real meaning in trying to find a common ancestor there, which would be either HEAD (compare index with HEAD) or the Index (compare with Index)... since the common ancestor is equal to one of the two compared versions, there are no possible conflicts, and thus no reason to use 3-way rather than 2-way comparison. Am I right in these assumptions?

I think these assumptions are correct
 
GitModelSynchronize (https://git.eclipse.org/r/#/c/11966/1/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/synchronize/GitModelSynchronize.java) line 110 :
This one has been much more of a headache... How could I make it possible to launch a synchronization between "Index" and any other revision? Synchronization uses a GitSynchronizeData as input. The GitSynchronizeData uses RevCommits to describe the revisions to compare. However... there are no RevCommit or commit ID corresponding to the index version. In CompareUtils I have used GitFileRevision.INDEX as the "magic" string to use in order to compare with the index (though that in itself is a problem since the user could have a branch named "Index"... CompareTreeView.INDEX_VERSION is probably a better choice), but that isn't an option in the GitSynchronizeData. What would be the better approach? Add a "useIndex" boolean such as GitSynchronizeData.includeLocal and change every place that uses the GitSynchronizeData?  Or is there a less intrusive way? Am I even right in assuming that there is no RevCommit or special identifier that corresponds to the index and could be used?

there is no RevCommit representing the Git index, it's represented by DirCache. See GitCompareEditorInput.buildDiffContainer(RevCommit baseCommit,
RevCommit compareCommit, IProgressMonitor monitor) for an example how to use a TreeWalk to compare index with something.

Maybe Dariusz has some more hints here ?

--
Matthias 

Back to the top