From: Joergen Edelbo <jed@napatech.com>
To: git@vger.kernel.org
Cc: j.sixt@viscovery.net, gitster@pobox.com, hvoigt@hvoigt.net,
patthoyts@gmail.com, jed@napatech.com
Subject: [PATCH] git-gui: Modify push dialog to support Gerrit review
Date: Fri, 6 Sep 2013 12:30:15 +0200 [thread overview]
Message-ID: <20130906105022.0718C12156D@jed-dev-01.labnet> (raw)
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 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.
---
Hi all,
This is a second attempt to support Gerrit review. It is fully backwards
compatible as the Gerrit option is an addition only. It is also better
than the first approach as it supports pushing more local branches to
Gerrit - each having their own topic branch there.
Further improvement could be to make the Gerrit branch specification a
drop down list, but I would like to have this first simple approach
evaluated first.
BR Joergen
lib/transport.tcl | 30 +++++++++++++++++++++++++++++-
1 file changed, 29 insertions(+), 1 deletion(-)
diff --git a/lib/transport.tcl b/lib/transport.tcl
index e5d211e..adf2bbb 100644
--- a/lib/transport.tcl
+++ b/lib/transport.tcl
@@ -61,6 +61,7 @@ proc push_to {remote} {
proc start_push_anywhere_action {w} {
global push_urltype push_remote push_url push_thin push_tags
+ global gerrit_review gerrit_branch
global push_force
global repo_config
@@ -95,7 +96,15 @@ proc start_push_anywhere_action {w} {
set cnt 0
foreach i [$w.source.l curselection] {
set b [$w.source.l get $i]
- lappend cmd "refs/heads/$b:refs/heads/$b"
+ if {$gerrit_review && $gerrit_branch ne {}} {
+ if {$gerrit_branch eq $b} {
+ lappend cmd "refs/heads/$b:refs/for/$b"
+ } else {
+ lappend cmd "refs/heads/$b:refs/for/$gerrit_branch/$b"
+ }
+ } else {
+ lappend cmd "refs/heads/$b:refs/heads/$b"
+ }
incr cnt
}
if {$cnt == 0} {
@@ -120,6 +129,7 @@ trace add variable push_remote write \
proc do_push_anywhere {} {
global all_remotes current_branch
global push_urltype push_remote push_url push_thin push_tags
+ global gerrit_review gerrit_branch
global push_force use_ttk NS
set w .push_setup
@@ -215,6 +225,24 @@ proc do_push_anywhere {} {
-text [mc "Include tags"] \
-variable push_tags
grid $w.options.tags -columnspan 2 -sticky w
+ ${NS}::checkbutton $w.options.gerrit \
+ -text [mc "Gerrit review. Branch: "] \
+ -variable gerrit_review
+ ${NS}::entry $w.options.gerrit_br \
+ -width 50 \
+ -textvariable gerrit_branch \
+ -validate key \
+ -validatecommand {
+ if {%d == 1 && [regexp {\s} %S]} {return 0}
+ if {%d == 1 && [string length %S] > 0} {
+ set gerrit_review 1
+ }
+ if {[string length %P] == 0} {
+ set gerrit_review 0
+ }
+ return 1
+ }
+ grid $w.options.gerrit $w.options.gerrit_br -sticky we -padx {0 5}
grid columnconfigure $w.options 1 -weight 1
pack $w.options -anchor nw -fill x -pady 5 -padx 5
--
1.7.9.5
next reply other threads:[~2013-09-06 10:50 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-09-06 10:30 Joergen Edelbo [this message]
2013-09-06 21:49 ` [PATCH] git-gui: Modify push dialog to support Gerrit review Phil Hord
2013-09-07 17:03 ` Jørgen Edelbo
-- strict thread matches above, loose matches on Subject: below --
2013-09-12 9:21 Joergen Edelbo
2013-09-02 8:54 Joergen Edelbo
2013-09-05 6:20 ` Heiko Voigt
2013-09-05 6:42 ` Johannes Sixt
2013-09-05 8:29 ` Jørgen Edelbo
2013-09-05 8:57 ` Johannes Sixt
2013-09-05 9:18 ` Jørgen Edelbo
2013-09-05 9:31 ` Johannes Sixt
2013-09-05 17:34 ` Junio C Hamano
2013-09-06 8:17 ` Jørgen Edelbo
2013-09-05 18:19 ` Junio C Hamano
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20130906105022.0718C12156D@jed-dev-01.labnet \
--to=jed@napatech.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=hvoigt@hvoigt.net \
--cc=j.sixt@viscovery.net \
--cc=patthoyts@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).