DESCRIPTION

[DRAFT] Show compare editor for non-workspace files

Bug: 335560
Change-Id: Id9a61b875d5302ed93587b4865f2d5dd78959181
Signed-off-by: Leslie Stephenson xxx@xxx.xxx


COMMENTS

author: Leslie Stephenson
date: 2011-01-29 12:41:50.000000000

Patch Set 1: Do not submit



-------------------------------------
author: Leslie Stephenson
date: 2011-01-29 12:49:50.000000000

Patch Set 1: (1 inline comment)

It is almost ready change. There is only one thing that should be fixed. The left hand side editor in compare view is always empty for non-workspace files that wasn't staged already.

I'm testing it on egit project with changed master pom file. This file is listed in egit change set but when you launch compare editor for it the left hand side editor is empty.

From my investigations appears that when we create an IFile resource using IWorkspace.getFile() the exist() method called on this new instance will return false with seams to be a problem here, also getLocation() method returns null, please see inline comment in GitLocalCompareInput

Line:57, org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/synchronize/compare/GitLocalCompareInput.java -> When we create IFile object for non-workspace file method exist() returns false. Can we somehow bypass this?

-------------------------------------
author: Mylie Brown
date: 2011-01-29 20:17:58.000000000

Patch Set 1:

Hi Dariusz,
I don't know much about the synchronize API.  You can use IContainer getFile / getFolder to get IFile's for non-existent resources (but what does this mean in the context of a compare?).  get*ForLocation does a translation, only if the resource exists...  If the resource really doesn't exist on the left, perhaps you can return null?

As an aside the key thing is what the synchronize view is trying to do.  I guess you're trying to synchronize just IResources visible under the workspace model?  The alternative is to synchronize all filesystem changes between the two refs. 
For example CVS does the former, while clearcase does the latter.  In some sense git is more like clearcase -- the location of the repository root doesn't necessarily correspond with the location of the project or workspace root, and the local repo may contain many resources not all within eclipse.
I think I noticed that synchronizing one project included other projects in the same repo -- so it seems that the synch. action is somewhere between the two? 

If you're just trying to synchronize workspace IResources, then you do also need to be careful to handle groups (virtual folders) and linked resources.  Try creating a new file/folder, press advanced and link to another resource in the filesystem.

Sorry I can't give your better advice.
Cheers,
James

-------------------------------------
author: Leslie Stephenson
date: 2011-01-29 20:52:04.000000000

Patch Set 1:

Thank you James for hints, I think that I've found solution for this problem ;>

-------------------------------------
