git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[RFC PATCH 3/8] git gui: add checkbox to launch remote branch delete after push

From
Heiko Voigt <hvoigt@hvoigt.net>
Date
Sep 21, 2009, 13:06 UTC
Message-ID
<3ee2f1d36ed3c4b716f9bdb2a8f7fcde9a5f9357.1253481338.git.hvoigt@hvoigt.net>
In-Reply-To
<711bc3257266372b0a0f01ac335fa95be7def077.1253481338.git.hvoigt@hvoigt.net>

This is useful when working with a central server and feature branches. After a reviewer merged a feature branch into the upstream branch he usually wants to delete this branch on the server after pushing the upstream branch.

Save some clicks and open the delete dialog after pushing the upstream
branch.
---
 git-gui/git-gui.sh        |    1 +
 git-gui/lib/option.tcl    |    1 +
 git-gui/lib/transport.tcl |   28 ++++++++++++++++++++++++----
 3 files changed, 26 insertions(+), 4 deletions(-)
diff --git a/git-gui/git-gui.sh b/git-gui/git-gui.sh
index dfc1652..b32b8e7 100755
--- a/git-gui/git-gui.sh
+++ b/git-gui/git-gui.sh
@@ -738,6 +738,7 @@ set default_config(gui.pruneduringfetch) false
 set default_config(gui.trustmtime) false
 set default_config(gui.fastcopyblame) false
 set default_config(gui.emailafterpush) false
+set default_config(gui.deleteafterpush) false
 set default_config(gui.upstreambranch) {master}
 set default_config(gui.copyblamethreshold) 40
 set default_config(gui.blamehistoryctx) 7
diff --git a/git-gui/lib/option.tcl b/git-gui/lib/option.tcl
index 55ecfe6..6bfe343 100644
--- a/git-gui/lib/option.tcl
+++ b/git-gui/lib/option.tcl
@@ -148,6 +148,7 @@ proc do_options {} {
 		{b gui.matchtrackingbranch {mc "Match Tracking Branches"}}
 		{b gui.fastcopyblame {mc "Blame Copy Only On Changed Files"}}
 		{b gui.emailafterpush {mc "Open Email Composer after Push of Feature Branch"}}
+		{b gui.deleteafterpush {mc "Open Remote Delete Dialog On Push of Upstream Branch"}}
 		{t gui.upstreambranch {mc "Upstream branch"}}
 		{i-20..200 gui.copyblamethreshold {mc "Minimum Letters To Blame Copy On"}}
 		{i-0..300 gui.blamehistoryctx {mc "Blame History Context Radius (days)"}}
diff --git a/git-gui/lib/transport.tcl b/git-gui/lib/transport.tcl
index 77a2f46..d717468 100644
--- a/git-gui/lib/transport.tcl
+++ b/git-gui/lib/transport.tcl
@@ -37,7 +37,7 @@ proc compose_email {to subject} {
 }
 
 proc after_push_anywhere_action {cons ok} {
-	global push_email r_url branches
+	global push_email delete_after_push r_url branches
 
 	console::done $cons $ok
 
@@ -52,13 +52,21 @@ proc after_push_anywhere_action {cons ok} {
 			set email_subject "Review%20request:%20$remote_short_name:$branches"
 			compose_email {} $email_subject
 		}
+		if {$delete_after_push} {
+			remote_branch_delete::dialog $r_url
+		}
 	}
 }
 
 proc do_push_on_change_branch {w} {
 	global upstream_branch
 
-	$w.options.email select
+	if {[is_config_true gui.emailafterpush]} {
+		$w.options.email select
+	}
+	if {[is_config_true gui.deleteafterpush]} {
+		$w.options.delete_after_push deselect
+	}
 
 	set cnt 0
 	set b {}
@@ -70,6 +78,7 @@ proc do_push_on_change_branch {w} {
 	if {$cnt != 1} {
 		$w.options.email deselect
 		$w.options.email configure -state disabled
+		$w.options.delete_after_push deselect
 		return
 	}
 
@@ -79,6 +88,9 @@ proc do_push_on_change_branch {w} {
 		if {[is_config_true gui.emailafterpush]} {
 			$w.options.email deselect
 		}
+		if {[is_config_true gui.deleteafterpush]} {
+			$w.options.delete_after_push select
+		}
 	}
 }
 
@@ -173,7 +185,8 @@ proc do_push_anywhere {} {
 		-width 70 \
 		-selectmode extended \
 		-yscrollcommand [list $w.source.sby set]
-	if {[is_config_true gui.emailafterpush]} {
+	if {[is_config_true gui.emailafterpush] \
+	    || [is_config_true gui.deleteafterpush]} {
 		bind $w.source.l <ButtonRelease-1> [list do_push_on_change_branch $w]
 	}
 	foreach h [load_all_heads] {
@@ -243,6 +256,11 @@ proc do_push_anywhere {} {
 		-variable push_email
 	grid $w.options.email -columnspan 2 -sticky w
 	$w.options.email deselect
+	checkbutton $w.options.delete_after_push \
+		-text [mc "Launch delete dialog after push"] \
+		-variable delete_after_push
+	grid $w.options.delete_after_push -columnspan 2 -sticky w
+	$w.options.delete_after_push deselect
 	grid columnconfigure $w.options 1 -weight 1
 	pack $w.options -anchor nw -fill x -pady 5 -padx 5
 
@@ -251,10 +269,12 @@ proc do_push_anywhere {} {
 	set push_thin 0
 	set push_tags 0
 	set push_email 0
+	set delete_after_push 0
 
 	set upstream_branch $repo_config(gui.upstreambranch)
 
-	if {[is_config_true gui.emailafterpush]} {
+	if {[is_config_true gui.emailafterpush] \
+	    || [is_config_true gui.deleteafterpush]} {
 		do_push_on_change_branch $w
 	}
 
-- 
1.6.5.rc1.12.gc72fe
Previous: Heiko VoigtNext: Heiko Voigt
Message 4 of 9 in “Extend git gui for better "centralized" workflow integration”
  1. 0/8 Extend git gui for better "centralized" workflow integrationHeiko Voigt, Sep 21, 2009
  2. 1/8 git gui: add a "compose review email" checkbox to push dialogHeiko Voigt, Sep 21, 2009
  3. 2/8 git gui: teach delete dialog to open with a default remoteHeiko Voigt, Sep 21, 2009
  4. 3/8 git gui: add checkbox to launch remote branch delete after pushHeiko Voigt, Sep 21, 2009
  5. 4/8 git gui: teach fetch operation to close dialog on successful completionHeiko Voigt, Sep 21, 2009
  6. 5/8 git gui: do fetch from a default remote on startupHeiko Voigt, Sep 21, 2009
  7. 6/8 git gui: add "review topic" menuitem which supports feature branch workflowHeiko Voigt, Sep 21, 2009
  8. 7/8 Add documentation for git gui variables for email and delete after pushHeiko Voigt, Sep 21, 2009
  9. 8/8 git gui: make gc hint and fetch on startup sequentialHeiko Voigt, Sep 21, 2009

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.