summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 0a25f93)
raw | patch | inline | side by side (parent: 0a25f93)
author | Shawn O. Pearce <spearce@spearce.org> | |
Sun, 21 Jan 2007 07:27:26 +0000 (02:27 -0500) | ||
committer | Shawn O. Pearce <spearce@spearce.org> | |
Sun, 21 Jan 2007 07:54:26 +0000 (02:54 -0500) |
Sometimes you want to create a branch from a remote tracking branch.
Needing to enter it in the revision expression field is very annoying,
so instead let the user select it from a list of known tracking branches.
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Needing to enter it in the revision expression field is very annoying,
so instead let the user select it from a list of known tracking branches.
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 85be9833a020f72f7836492d90535b39d24d5c07..c187e9bbc2cc2a0f3beda3982798101130b027eb 100755 (executable)
--- a/git-gui.sh
+++ b/git-gui.sh
proc do_create_branch_action {w} {
global all_heads null_sha1
- global create_branch_checkout create_branch_revtype create_branch_head
+ global create_branch_checkout create_branch_revtype
+ global create_branch_head create_branch_trackinghead
set newbranch [string trim [$w.name.t get 0.0 end]]
if {![catch {exec git show-ref --verify -- "refs/heads/$newbranch"}]} {
set rev {}
switch -- $create_branch_revtype {
head {set rev $create_branch_head}
+ tracking {set rev $create_branch_trackinghead}
expression {set rev [string trim [$w.from.exp.t get 0.0 end]]}
}
if {[catch {set cmt [exec git rev-parse --verify "${rev}^0"]}]} {
}
proc do_create_branch {} {
- global all_heads current_branch
- global create_branch_checkout create_branch_revtype create_branch_head
+ global all_heads current_branch tracking_branches
+ global create_branch_checkout create_branch_revtype
+ global create_branch_head create_branch_trackinghead
set create_branch_checkout true
set create_branch_revtype head
set create_branch_head $current_branch
+ set create_branch_trackinghead {}
set w .branch_editor
toplevel $w
pack $w.name.t -side left -fill x -expand 1
pack $w.name -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
eval tk_optionMenu $w.from.head.m create_branch_head $all_heads
pack $w.from.head.r -side left
pack $w.from.head.m -side left
+ frame $w.from.tracking
+ 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
+ pack $w.from.tracking.r -side left
+ pack $w.from.tracking.m -side left
frame $w.from.exp
radiobutton $w.from.exp.r \
-text {Revision Expression:} \
pack $w.from.exp.r -side left
pack $w.from.exp.t -side left -fill x -expand 1
pack $w.from.head -padx 5 -fill x -expand 1
+ pack $w.from.tracking -padx 5 -fill x -expand 1
pack $w.from.exp -padx 5 -fill x -expand 1
pack $w.from -anchor nw -fill x -pady 5 -padx 5