Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 322489

Summary: Source for Synchronize should only be current working dir.
Product: [Technology] EGit Reporter: Stefan Lay <stefan.lay>
Component: UIAssignee: Project Inbox <egit.ui-inbox>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: dariusz.luksza, jamesblackburn+eclipse
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: All   
Whiteboard:

Description Stefan Lay CLA 2010-08-12 05:24:08 EDT
If you select Team -> Synchronize a dialog opens where you can choose both a source ref and a destination ref. 

This does not comply with the Synchronize API. In many places it is assumed that the source is the local workspace:

e.g. SyncInfo(IResource local, IResourceVariant base, IResourceVariant remote, IResourceVariantComparator comparator)

or

IResourceVariantComparator.compare(IResource local, IResourceVariant remote)

When another branch is selected as source the compare editor still shows the local workspace version.

I think that we should only allow to select the remote version
Comment 1 James Blackburn CLA 2010-08-20 13:16:09 EDT
This certainly confused me.

The label states:
"Select which branch or tag should be treated as source:"
which to me suggests the branch which contains the changes I want to pull.  If I synchronize using a remote as the source I get no changes where as I get a whole lot if I synchronize using the local HEAD as the source.

git diff both ways shows diffs in the appropriate direction.
Comment 2 Stefan Lay CLA 2010-09-06 07:19:27 EDT
I understood that synchronizing two arbitrary branches works fine for the Git changeset model.

But it does not work for the workspace model. This uses the local workspace as one side of the comparison. Is it possible to disable the workspace model in case of comparing two branches where none of them represents the workspace?
Comment 3 Stefan Lay CLA 2010-09-06 07:30:00 EDT
The workspace model is not suited for the case of comparing arbitrary branches and not the workspace with a remote. There are many places in the API where "IResource local" is the input. The compare view always shows the local state on the left side. 

On the other hand it would be useful to have an analogous view which compares two branches. How can we achieve that?
Comment 4 Dariusz Luksza CLA 2010-09-06 15:21:54 EDT
(In reply to comment #2)
> Is it possible to disable the workspace model in
> case of comparing two branches where none of them represents the workspace?

I think that this is possible and we can /for now/ do that (but this could be misleading for users). But in feature it will be useful if we could workaround somehow Team API limitations. With change 1512[1] we are able to disconnect SyncInfo from workspace state. 

I think that it is also possible to hook somehow proper data providers for Compare view in Workspace model so that it will present proper data.

Furthermore it will be a cool feature if we could present not only proper ChangeSet model for arbitrary branches but also a Workspace model. But having this feature will require more investigations in Team framework and some "hacking" on it.

I think that we can merge change 1512 and continue hacking on this topic.

[1] http://egit.eclipse.org/r/#change,1512
Comment 5 Stefan Lay CLA 2010-10-21 03:38:41 EDT
This works well now.

For arbitrary branches now the compare editor shows the content of the branches and not the content of the workspace version. When synchronizing with the workspace the labels are not correct in the workspace editor. I opened Bug 328316 for this.