@matheusbsbs / matheus-bagliano / commits / 9d04278a4d
Fork 0

git-gui: always default to the last merged branch in remote delete

This is useful if you are directly working together with other developers pushing feature branches on a shared remote. You typically push feature branches to the remote so others can review. Once they are satisfied and the branch is merged into the main branch it needs to be deleted on the server. Since we did not yet have a preselected default branch in the remote delete dialog lets use the last merged branch if it is found on the server. Signed-off-by: Heiko Voigt <hvoigt@hvoigt.net> Signed-off-by: Pat Thoyts <patthoyts@users.sourceforge.net>

Heiko Voigt committed Feb 12, 2011 at 17:44 UTC 9d04278a4d0fcd784e7b9998caa94cff6cbdca8a
3 files changed +14 -1
git-gui.sh
+4
@@ -139,6 +139,10 @@ if {$_trace >= 0} {
139 set _trace 0
140 }
141
142 +# variable for the last merged branch (useful for a default when deleting
143 +# branches).
144 +set _last_merged_branch {}
145 +
146 proc shellpath {} {
147 global _shellpath env
148 if {[string match @@* $_shellpath]} {
lib/merge.tcl
+2
@@ -83,6 +83,7 @@ method _visualize {} {
83
84 method _start {} {
85 global HEAD current_branch remote_url
86 + global _last_merged_branch
87
88 set name [_rev $this]
89 if {$name eq {}} {
@@ -109,6 +110,7 @@ method _start {} {
110 regsub ^refs/heads/ $branch {} branch
111 puts $fh "$cmit\t\tbranch '$branch' of $remote"
112 close $fh
113 + set _last_merged_branch $branch
114
115 set cmd [list git]
116 lappend cmd merge
lib/remote_branch_delete.tcl
+8 -1
@@ -251,7 +251,7 @@ method _write_url {args} { set urltype url }
251 method _write_check_head {args} { set checktype head }
252
253 method _write_head_list {args} {
254 - global current_branch
254 + global current_branch _last_merged_branch
255
256 $head_m delete 0 end
257 foreach abr $head_list {
@@ -267,6 +267,13 @@ method _write_head_list {args} {
267 set check_head $current_branch
268 }
269 }
270 + set lmb [lsearch -exact -sorted $head_list $_last_merged_branch]
271 + if {$lmb >= 0} {
272 + $w.heads.l conf -state normal
273 + $w.heads.l select set $lmb
274 + $w.heads.l yview $lmb
275 + $w.heads.l conf -state disabled
276 + }
277 }
278
279 method _write_urltype {args} {