summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 560eddc)
raw | patch | inline | side by side (parent: 560eddc)
author | Shawn O. Pearce <spearce@spearce.org> | |
Thu, 5 Jul 2007 05:07:06 +0000 (01:07 -0400) | ||
committer | Shawn O. Pearce <spearce@spearce.org> | |
Mon, 9 Jul 2007 01:12:54 +0000 (21:12 -0400) |
In some workflows users will want to almost always just create a new
local branch that matches a remote branch. In this type of workflow
it is handy to have the new branch dialog default to "Match Tracking
Branch" and "Starting Revision"-Tracking Branch", with the focus in
the branch filter field. This can save users working on this type
of workflow at least two mouse clicks every time they create a new
local branch or switch to one with a fast-forward.
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
local branch that matches a remote branch. In this type of workflow
it is handy to have the new branch dialog default to "Match Tracking
Branch" and "Starting Revision"-Tracking Branch", with the focus in
the branch filter field. This can save users working on this type
of workflow at least two mouse clicks every time they create a new
local branch or switch to one with a fast-forward.
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
git-gui.sh | patch | blob | history | |
lib/branch_create.tcl | patch | blob | history | |
lib/choose_rev.tcl | patch | blob | history | |
lib/option.tcl | patch | blob | history |
diff --git a/git-gui.sh b/git-gui.sh
index 63b2045d96b87b414edfe04dd5f0d951c1f7b233..99df2d94804609d4cff3c1e6e586b262752aaf93 100755 (executable)
--- a/git-gui.sh
+++ b/git-gui.sh
set default_config(user.name) {}
set default_config(user.email) {}
+set default_config(gui.matchtrackingbranch) false
set default_config(gui.pruneduringfetch) false
set default_config(gui.trustmtime) false
set default_config(gui.diffcontext) 5
diff --git a/lib/branch_create.tcl b/lib/branch_create.tcl
index 375f575eaf4884d735e21bcb34ab36a75d28f512..df3f435e11a13e6d1e812909bc0277ac6e1add2f 100644 (file)
--- a/lib/branch_create.tcl
+++ b/lib/branch_create.tcl
pack $w.options.checkout -anchor nw
pack $w.options -anchor nw -fill x -pady 5 -padx 5
+ trace add variable @name_type write [cb _select]
+
set name $repo_config(gui.newbranchtemplate)
+ if {[is_config_true gui.matchtrackingbranch]} {
+ set name_type match
+ }
- bind $w <Visibility> "
- grab $w
- $w_name icursor end
- focus $w_name
- "
+ bind $w <Visibility> [cb _visible]
bind $w <Key-Escape> [list destroy $w]
bind $w <Key-Return> [cb _create]\;break
tkwait window $w
return 1
}
+method _select {args} {
+ if {$name_type eq {match}} {
+ $w_rev pick_tracking_branch
+ }
+}
+
+method _visible {} {
+ grab $w
+ if {$name_type eq {user}} {
+ $w_name icursor end
+ focus $w_name
+ }
+}
+
}
diff --git a/lib/choose_rev.tcl b/lib/choose_rev.tcl
index f19da0f633bf4bba35655b700ce120b5be322f7c..e6af07359551abe1b585326137e987cc73fdab43 100644 (file)
--- a/lib/choose_rev.tcl
+++ b/lib/choose_rev.tcl
}
}
+method pick_tracking_branch {} {
+ set revtype trck
+}
+
method get_tracking_branch {} {
set i [$w_list curselection]
if {$i eq {} || $revtype ne {trck}} {
diff --git a/lib/option.tcl b/lib/option.tcl
index ae19a8f9cf3901a808c85f0c028fbf44813d30b5..743304269b90ec7f16d489e36dfdd3b2e948253e 100644 (file)
--- a/lib/option.tcl
+++ b/lib/option.tcl
{b gui.trustmtime {Trust File Modification Timestamps}}
{b gui.pruneduringfetch {Prune Tracking Branches During Fetch}}
+ {b gui.matchtrackingbranch {Match Tracking Branches}}
{i-0..99 gui.diffcontext {Number of Diff Context Lines}}
{t gui.newbranchtemplate {New Branch Name Template}}
} {