summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 3c23697)
raw | patch | inline | side by side (parent: 3c23697)
author | Shawn O. Pearce <spearce@spearce.org> | |
Sun, 21 Jan 2007 20:38:09 +0000 (15:38 -0500) | ||
committer | Shawn O. Pearce <spearce@spearce.org> | |
Mon, 22 Jan 2007 03:47:57 +0000 (22:47 -0500) |
I refactored the common code related to tracking branch listing into
a new procedure all_tracking_branches. This saves a few lines and
should make the create and delete dialogs easier to maintain.
We now don't offer a radio button to create from a tracking branch
or merge-check a tracking branch if there are no tracking branches
known to git-gui. This prevents us from creating an empty option
list and letting the user try to shoot themselves in the foot by
asking us to work against an empty initial revision.
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
a new procedure all_tracking_branches. This saves a few lines and
should make the create and delete dialogs easier to maintain.
We now don't offer a radio button to create from a tracking branch
or merge-check a tracking branch if there are no tracking branches
known to git-gui. This prevents us from creating an empty option
list and letting the user try to shoot themselves in the foot by
asking us to work against an empty initial revision.
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
git-gui.sh | patch | blob | history |
diff --git a/git-gui.sh b/git-gui.sh
index a0c87e5ab45f0c03ed8ee6eff5c2c959f0918e06..c4ab824b9d860d06e0fe9239671cf2653cc4e396 100755 (executable)
--- a/git-gui.sh
+++ b/git-gui.sh
}
}
+proc all_tracking_branches {} {
+ global tracking_branches
+
+ set all_trackings [list]
+ foreach b [array names tracking_branches] {
+ regsub ^refs/(heads|remotes)/ $b {} b
+ lappend all_trackings $b
+ }
+ return [lsort -unique $all_trackings]
+}
+
proc do_create_branch_action {w} {
global all_heads null_sha1
global create_branch_checkout create_branch_revtype
}
proc do_create_branch {} {
- global all_heads current_branch tracking_branches
+ global all_heads current_branch
global create_branch_checkout create_branch_revtype
global create_branch_head create_branch_trackinghead
grid columnconfigure $w.desc 1 -weight 1
pack $w.desc -anchor nw -fill x -pady 5 -padx 5
- set all_trackings [list]
- foreach b [array names tracking_branches] {
- regsub ^refs/(heads|remotes)/ $b {} b
- lappend all_trackings $b
- }
- set all_trackings [lsort -unique $all_trackings]
- if {$all_trackings ne {}} {
- set create_branch_trackinghead [lindex $all_trackings 0]
- }
-
labelframe $w.from \
-text {Starting Revision} \
-font font_ui
-font font_ui
eval tk_optionMenu $w.from.head_m create_branch_head $all_heads
grid $w.from.head_r $w.from.head_m -sticky w
- radiobutton $w.from.tracking_r \
- -text {Tracking Branch:} \
- -value tracking \
- -variable create_branch_revtype \
- -font font_ui
- eval tk_optionMenu $w.from.tracking_m \
- create_branch_trackinghead \
- $all_trackings
- grid $w.from.tracking_r $w.from.tracking_m -sticky w
+ set all_trackings [all_tracking_branches]
+ if {$all_trackings ne {}} {
+ set create_branch_trackinghead [lindex $all_trackings 0]
+ radiobutton $w.from.tracking_r \
+ -text {Tracking Branch:} \
+ -value tracking \
+ -variable create_branch_revtype \
+ -font font_ui
+ eval tk_optionMenu $w.from.tracking_m \
+ create_branch_trackinghead \
+ $all_trackings
+ grid $w.from.tracking_r $w.from.tracking_m -sticky w
+ }
radiobutton $w.from.exp_r \
-text {Revision Expression:} \
-value expression \
pack $w.list.l -fill both -pady 5 -padx 5
pack $w.list -fill both -pady 5 -padx 5
- set all_trackings [list]
- foreach b [array names tracking_branches] {
- regsub ^refs/(heads|remotes)/ $b {} b
- lappend all_trackings $b
- }
- set all_trackings [lsort -unique $all_trackings]
- if {$all_trackings ne {} && $delete_branch_trackinghead eq {}} {
- set delete_branch_trackinghead [lindex $all_trackings 0]
- }
-
labelframe $w.validate \
-text {Delete Only If} \
-font font_ui
-font font_ui
eval tk_optionMenu $w.validate.head_m delete_branch_head $all_heads
grid $w.validate.head_r $w.validate.head_m -sticky w
- radiobutton $w.validate.tracking_r \
- -text {Merged Into Tracking Branch:} \
- -value tracking \
- -variable delete_branch_checktype \
- -font font_ui
- eval tk_optionMenu $w.validate.tracking_m \
- delete_branch_trackinghead \
- $all_trackings
- grid $w.validate.tracking_r $w.validate.tracking_m -sticky w
+ set all_trackings [all_tracking_branches]
+ if {$all_trackings ne {}} {
+ set delete_branch_trackinghead [lindex $all_trackings 0]
+ radiobutton $w.validate.tracking_r \
+ -text {Merged Into Tracking Branch:} \
+ -value tracking \
+ -variable delete_branch_checktype \
+ -font font_ui
+ eval tk_optionMenu $w.validate.tracking_m \
+ delete_branch_trackinghead \
+ $all_trackings
+ grid $w.validate.tracking_r $w.validate.tracking_m -sticky w
+ }
radiobutton $w.validate.always_r \
-text {Always (Do not perform merge checks)} \
-value always \