Skip to contentSkip to conversation

git-gui: Modify push dialog to support Gerrit review

PATCH New Joergen Edelbo 1 participant 1 message Jun 15, 2016 Library code

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 git-gui: Modify push dialog to support Gerrit review

Problem: It is not possible to push for Gerrit review as you will always try to push to "refs/heads/..." on the remote.

Changes done:

Add an option in the Push dialog to select "Gerrit review" and a corresponding entry for a branch name. If this option is selected, push the changes to "refs/for/<gerrit-branch>/<local branch>". In this way the local branch names will be used as topic branches on Gerrit.

If you are on a detached HEAD, then add a "HEAD" entry in the branch selection list. If this is selected, push HEAD:HEAD in the normal case and HEAD:refs/for/<gerrit_branch> in the Gerrit case.

The Gerrit branch to push to is controlled by gerrit.reviewbranch configuration option.
---
Hi again,

Seems like this discussion has died out. Is there no perspective in changing git-gui to support Gerrit better?

Anyway here is what I consider my final shot at a solution. Compared to the last one, this commit can handle the case when you work on a detached HEAD, and the Gerrit branch to push to is handled by a configuration option.

BR Jørgen Edelbo

 git-gui.sh        |    1 +
 lib/option.tcl    |    1 +
 lib/transport.tcl |   48 +++++++++++++++++++++++++++++++++++++++++++++---
 3 files changed, 47 insertions(+), 3 deletions(-)
git-gui.sh +1 -0
index b62ae4a..3228654 100755
@@ -901,6 +901,7 @@ set default_config(gui.diffcontext) 5
 set default_config(gui.diffopts) {}
 set default_config(gui.commitmsgwidth) 75
 set default_config(gui.newbranchtemplate) {}
+set default_config(gerrit.reviewbranch) {}
 set default_config(gui.spellingdictionary) {}
 set default_config(gui.fontui) [font configure font_ui]
 set default_config(gui.fontdiff) [font configure font_diff]
lib/option.tcl +1 -0
index 23c9ae7..ffa4226 100644
@@ -157,6 +157,7 @@ proc do_options {} {
 		{t gui.diffopts {mc "Additional Diff Parameters"}}
 		{i-0..99 gui.commitmsgwidth {mc "Commit Message Text Width"}}
 		{t gui.newbranchtemplate {mc "New Branch Name Template"}}
+		{t gerrit.reviewbranch {mc "Gerrit Review Branch"}}
 		{c gui.encoding {mc "Default File Contents Encoding"}}
 		{b gui.warndetachedcommit {mc "Warn before committing to a detached head"}}
 		{s gui.stageuntracked {mc "Staging of untracked files"} {list "yes" "no" "ask"}}
lib/transport.tcl +45 -3

86 lines not on this page · raw message

Signature · 1 line
1.7.9.5