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

Bug 425242

Summary: For Gerrit review workflow we need a way to push only a branch excluding tags
Product: [ECD] Orion Reporter: Matthias Sohn <matthias.sohn>
Component: GitAssignee: Maciej Bendkowski <maciej.bendkowski>
Status: RESOLVED FIXED QA Contact:
Severity: enhancement    
Priority: P3 CC: maciej.bendkowski
Version: 4.0   
Target Milestone: 5.0 RC1   
Hardware: All   
OS: All   
Whiteboard:
Bug Depends on:    
Bug Blocks: 425233    

Description Matthias Sohn CLA 2014-01-09 19:01:07 EST
“Push All” currently pushes tags, which is bad in the Gerrit use case. This should be fixed by splitting "Push All" into "Push Branch" and "Push Tags" or by adding a new button "Push Branch" and maybe also "Push Tags".
Comment 1 Maciej Bendkowski CLA 2014-01-27 13:07:05 EST
In my opinion, having both commands simultaneously isn't a good solution. Most users will not use any other push but the default 'push all'. We should be using two repository 'flavors' - a Gerrit one and a default one. Then, we might properly decorate git responses and use the 'visible' option to sort unnecessary git commands out.
Comment 2 Matthias Sohn CLA 2014-01-28 05:03:10 EST
(In reply to Maciej Bendkowski from comment #1)
> In my opinion, having both commands simultaneously isn't a good solution.
> Most users will not use any other push but the default 'push all'. We should
> be using two repository 'flavors' - a Gerrit one and a default one. Then, we
> might properly decorate git responses and use the 'visible' option to sort
> unnecessary git commands out.

how would you then differentiate pushing a branch or a tag ?
Comment 3 Maciej Bendkowski CLA 2014-01-29 08:04:36 EST
(In reply to Matthias Sohn from comment #2)
> how would you then differentiate pushing a branch or a tag ?

Ideally, we should have some kind of a context menu framework for commands, so you could easily change the subtype of any given command at invocation time. Consider a submenu for the 'Push' button, here you decide whether it should morph to 'Push All', 'Push tags', etc. Unfortunately, we do not have the time resources to have it for 5.0. For that reason, I suggest we have multiple command buttons, but show them only for Gerrit repositories. This way typical non-Gerrit users will still have only one command - 'Push All'. After 5.0 we should move towards the subcommand framework approach. What do you think, Matthias?
Comment 4 Maciej Bendkowski CLA 2014-01-30 07:32:42 EST
asd
Comment 5 Maciej Bendkowski CLA 2014-01-30 07:33:45 EST
(In reply to Maciej Bendkowski from comment #4)
> asd

Sorry, missclick. Assigning to myself.
Comment 6 Maciej Bendkowski CLA 2014-01-30 13:34:50 EST
http://git.eclipse.org/c/orion/org.eclipse.orion.client.git/commit/?id=47988cc2e0430d60021c8cedb6ec1c04439ee860

As described before, I used the submenu command framework to push and fetch, so now it's possible to choose a particular subcommand from the dropdown menu. The next part would be to provide 'push tags' and 'push branch' commands both on the client and server side.
Comment 7 Matthias Sohn CLA 2014-01-30 17:10:36 EST
(In reply to Maciej Bendkowski from comment #3)
> (In reply to Matthias Sohn from comment #2)
> > how would you then differentiate pushing a branch or a tag ?
> 
> Ideally, we should have some kind of a context menu framework for commands,
> so you could easily change the subtype of any given command at invocation
> time. Consider a submenu for the 'Push' button, here you decide whether it
> should morph to 'Push All', 'Push tags', etc. Unfortunately, we do not have
> the time resources to have it for 5.0. For that reason, I suggest we have
> multiple command buttons, but show them only for Gerrit repositories. This
> way typical non-Gerrit users will still have only one command - 'Push All'.
> After 5.0 we should move towards the subcommand framework approach. What do
> you think, Matthias?

sounds good, we can look for refspecs refs/for and the configuration option gerrit.createchangeid to detect if a repo uses gerrit, we could also add a config wizard to help configure that similar to egit
Comment 8 Maciej Bendkowski CLA 2014-02-03 06:02:34 EST
(In reply to Matthias Sohn from comment #7)
> sounds good, we can look for refspecs refs/for and the configuration option
> gerrit.createchangeid to detect if a repo uses gerrit, we could also add a
> config wizard to help configure that similar to egit

With the new UI and submenus for commands, I think we can implement 'Push branch', 'Push tags' and incorporate them into the 'Push' command group. Distinguishing between regular repositories and Gerrit could be used to limit the visibility of certain push subtypes, e. g. push tags. Afterwards we might use custom user preferences to decide whether to show push subcommands for regular repositories.
Comment 9 Maciej Bendkowski CLA 2014-02-03 09:15:12 EST
Fixed with: http://git.eclipse.org/c/orion/org.eclipse.orion.client.git/commit/?id=b93e0026b73e6edf3e0b81961eb2da1ef953b7c8

1. Added 'Push Branch' - pushes refs without the refs/tags
2. Added 'Force Push Branch' - same as above with the --force flag enabled (visible on the git-log page).

On a related note: Although quite uncommon, one may want to push arbitrary refs/* to the remote, e. g. push only refs/tags without any commits. Or even combine that with the --force flag enabled. We have to figure out a clean way to manipulate command arguments and combine them, so 'Force Push' becomes just an parameter to the 'Push' command - not a different command. 

Since the initial problem was fixed, I'm closing this bug. For specific sub-issues, we should open separate bugs.