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

Bug 339722

Summary: [client] Add UI for Push, Fetch and Merge
Product: [ECD] Orion Reporter: Szymon Brandys <Szymon.Brandys>
Component: ClientAssignee: Szymon Brandys <Szymon.Brandys>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: bokowski, john.arthorne, libingw, malgorzata.tomczyk, susan, tomasz.zarna
Version: 0.2   
Target Milestone: 0.2   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Bug Depends on: 334120, 339111, 339115, 342575, 342731, 342736, 342844, 343151, 343240    
Bug Blocks: 336116    
Attachments:
Description Flags
Illustration none

Description Szymon Brandys CLA 2011-03-11 12:03:37 EST
We had a discussion today about the UI for Git push , fetch and merge. They are together a separate task that needs its own UI. I imagine that we will go to this UI from Git Status UI to perform. 

In the future this UI will allow to do a checkout, add/remove remotes maybe.
Comment 1 Boris Bokowski CLA 2011-03-11 12:22:06 EST
How do you imagine this UI to look like? Do you have a rough sketch or could produce one? (ASCII art or hand-drawn would be appropriate)
Comment 2 libing wang CLA 2011-03-11 13:57:46 EST
We may also want to think about making the UIs (exisitng and future) handle server response generically by services.
So the GIT implementation is just one of the service providers.
Comment 3 Boris Bokowski CLA 2011-03-11 15:36:40 EST
I don't believe the Git UI should be used for other SCM systems, other than reusing common components like the compare viewer/editor.
Comment 4 Szymon Brandys CLA 2011-03-30 10:29:00 EDT
*** Bug 339564 has been marked as a duplicate of this bug. ***
Comment 5 libing wang CLA 2011-03-31 11:36:57 EDT
Hi ,Szymon ,  do you have any insight on how pull will detect a conflict?
Comment 6 libing wang CLA 2011-04-08 09:11:01 EDT
Boris and I sat down together and played around with test case 1 in the description of bug 342044.
Regarding the temporary file generated by git pull in case of merge , with content shown as below:
line one
<<<<<<< HEAD
line two by repo2
=======
line two by repo1
>>>>>>> 3cb9a690f9f6f9d95ee979045ffd4d48f7a0237c
line three
line four

The default git/diff will just use the file as it is to compare against index.
Although there is information  in the diff indicating what has been changed on both side against the  common ancestor , it is not user friendly. If there are complicated conflicts , user will have no idea how to merge.
We considered that a better approach is to provide a 3-way compare editor , where user can understand easily why the conflicts happened.
In the example above , one of the possible the 3-way compare editor layout would be :
1.LEFT : An editor representing HEAD.
2.RIGHT : A viewer representing 3cb9a690f9f6f9d95ee979045ffd4d48f7a0237c.
3.MIDDLE : A viewer representing the common ancestor.

In order to achieve this , we may want server side to support something like /git/3way-diff/diffURI. The response will provide (by the example above):

3 fileURIs representing the 3 files.
diff : HEAD VS common ancestor 
diff : 3cb9a690f9f6f9d95ee979045ffd4d48f7a0237c VS common ancestor.

Szymon/Tomasz/John : Please provide your comments , once we have a solid agreement and prototype of server support , I will start some JS unit tests.
Comment 7 Szymon Brandys CLA 2011-04-11 07:27:09 EDT
I think that a natural way of resolving conflicts for Git users is to just open unresolved conflicts in an editor, resolve them there, then add and commit. Why can't we address it first. It is small, but good enough before we start working on 3-way compare. 

I wonder if we could add markers showing conflicts in our editor?
Comment 8 Szymon Brandys CLA 2011-04-11 10:30:15 EDT
Boris, during our offline conversation I was referring to Bug 339045:

Had a conversation with Szymon today.
The work flow he suggested is :

1. you have Navigator UI, Status UI, Push/Pull UI
2. you do changes in Navigator UI, then go to Status UI to stage changes and commit
3. then go to Push/Pull UI to push them
4. now, you use Pull on the Push/Pull UI
5. some changes are automatically merged, some need your attention
6. files that need a merge should be flagged somehow, so when go back to Navigator UI, we can find them and merge manually
7. when we do this, we go back to Status UI, and we know which files need a manual merge.
8. do manual merge by 3-way editor (UI design not yet determined)
9 . we stage merged files and we are done.

I will draw a picture for 3, 4. But basically it will just show a list of commits local vs remote. So the UI will be similar to the Log UI and actions available in the toolbar will be fetch and merge.
Comment 9 Szymon Brandys CLA 2011-04-11 10:40:23 EDT
Created attachment 192933 [details]
Illustration
Comment 10 Szymon Brandys CLA 2011-04-11 10:48:57 EDT
The illustration shows only Fetch and Merge actions. We could use the left side of the UI for commits to Push and the UI could be used for pushing changes. However Fetch/Merge UI works with a a remote branch while Push UI works with a local branch. Since these are two different resource types, I would suggest to have two different UI for these operations.
Comment 11 Tomasz Zarna CLA 2011-04-11 11:58:51 EDT
(In reply to comment #7)
> I think that a natural way of resolving conflicts for Git users is to just open
> unresolved conflicts in an editor, resolve them there, then add and commit. Why
> can't we address it first. It is small, but good enough before we start working
> on 3-way compare.

+1 from me. I'm fine with resolving merge conflicts in a regular editor as well. This is how I work with git/Egit right now.
Comment 12 Szymon Brandys CLA 2011-04-11 12:39:22 EDT
Adding Susan for comments about UI.
Comment 13 Boris Bokowski CLA 2011-04-11 15:54:58 EDT
I talked to Szymon today, here are some notes:

I would suggest adding the merge/fetch/push/pull functionality to the git-log page.

Let's look at an example. I have the master branch checked out, and it has an associated remote tracking branch origin/master. I also have a local branch called "bugfix". As a result, I would expect to have three pages I can go to. git-log.html#master, git-log.html#bugfix, and git-log.html#origin/master.

(initial explanation without push/pull:)

On git-log.html#master, I would see that this is my checked out branch, and there would be a button "Merge from" and next to it a dropdown with all branches, with origin/master preselected. I would also need a link to git-log.html#origin/master so that I can look at that branch. 

On git-log.html#origin/master, I would have a button "Fetch" to fetch the latest from my remote repository. 

On git-log.html#bugfix, I would see a button "Check out" or an explanation that I cannot check out since I have changes in my working directory. 

If I click on "Merge from" on git-log.html#master with origin/master selected in the drop down, I would see new commits at the top of my list. 

If the merge couldn't be done automatically, I would see that I have changes that need to be resolved, with a link to git-status.html so that I can see what needs to be done. 

Now to add push and pull: Push would make sense to me on every page that shows a remote tracking branch, or a local branch with an associated remote tracking branch. Pull would only make sense on a local branch that is checked out, like "merge from".

One more thing, not top priority: When you are on a local branch with an associated remote tracking branch, you would want to see some information on how your current state relates to the remote tracking branch. Same if you see the remote tracking branch and there is an associated local branch. For example, highlight the commit that the other branch points at, if the other branch is behind the current branch you are looking at. If the other branch is ahead, you could display a message, something link "origin/master is ahead by six commits".
Comment 14 Susan McCourt CLA 2011-04-11 20:13:59 EDT
(In reply to comment #12)
> Adding Susan for comments about UI.

I'm not sure I follow the latest discussion (a picture would help!).
I think we should focus on the simple case first, which is push and pull. 

(In reply to comment #13)
> 
> Now to add push and pull: Push would make sense to me on every page that shows
> a remote tracking branch, or a local branch with an associated remote tracking
> branch. 

I agree that we see push on a local branch with associated remote tracking branch.  Not sure about push on a remote tracking branch. Would we only show this if we detect that there are local changes?   Seems like before I push I would want to be able to understand what the changes were.  (Mentioned below I realize)

> Pull would only make sense on a local branch that is checked out, like
> "merge from".

Agree.

> 
> One more thing, not top priority: When you are on a local branch with an
> associated remote tracking branch, you would want to see some information on
> how your current state relates to the remote tracking branch. Same if you see
> the remote tracking branch and there is an associated local branch. For
> example, highlight the commit that the other branch points at, if the other
> branch is behind the current branch you are looking at. If the other branch is
> ahead, you could display a message, something link "origin/master is ahead by
> six commits".

Even some very raw presentation of this info is important.  Without it, I think that push and pull would feel "blind."
Comment 15 Szymon Brandys CLA 2011-04-12 03:39:06 EDT
(In reply to comment #14)
> (In reply to comment #12)
> > Adding Susan for comments about UI.
> 
> I'm not sure I follow the latest discussion (a picture would help!).

There is a picture attached ;)
Comment 16 Susan McCourt CLA 2011-04-12 12:09:35 EDT
(In reply to comment #15)
> (In reply to comment #14)
> > (In reply to comment #12)
> > > Adding Susan for comments about UI.
> > 
> > I'm not sure I follow the latest discussion (a picture would help!).
> 
> There is a picture attached ;)

I saw that one, but then there was further discussion about using the existing git log page, and where push and pull would appear.  I guess I was asking Boris for a picture of his comment 13.

I use push/pull every day in my workflows.  Merge and fetch are rarely needed by me (wait til we have a maintenance branch!) so having a dedicated fetch/merge UI is less meaningful to me at the moment.

If I am looking at my local branch, I would expect to see some status text somewhere that tells me if I have commits to push, and there would be a "push" button there.  If I'm looking at my remote branch and I am behind, I would see some text and a "pull" button.  I can reload that page whenever I want to see where I stand.

In the long run, it would be kind of cool to see an arrow that showed me where I stand relative to the remote commits.  "You are here".
Comment 17 Szymon Brandys CLA 2011-04-18 08:52:58 EDT
UI for Fetch, Merge is done. The current shape of bug 339115 lets me continue working on Push UI.
Comment 18 Szymon Brandys CLA 2011-04-27 09:48:58 EDT
The UI is in place. New bugs should be raised for further work.