summaryrefslogtreecommitdiff
path: root/lib/branch_rename.tcl
diff options
context:
space:
mode:
authorShawn O. Pearce <spearce@spearce.org>2007-07-08 18:40:56 -0400
committerShawn O. Pearce <spearce@spearce.org>2007-07-08 22:34:46 -0400
commitd41b43eb4c73044d0fff2057211fc78e4e7b2094 (patch)
treeebab56d146f4cafef1b1adf740949403329f71ea /lib/branch_rename.tcl
parent699d5601f59938d62ec2506f319c25a656a403da (diff)
downloadgit-d41b43eb4c73044d0fff2057211fc78e4e7b2094.tar.gz
git-gui: Refactor branch switch to support detached head
This is a major rewrite of the way we perform switching between branches and the subsequent update of the working directory. Like core Git we now use a single code path to perform all changes: our new checkout_op class. We also use it for branch creation/update as it integrates the tracking branch fetch process along with a very basic merge (fast-forward and reset only currently). Because some users have literally hundreds of local branches we use the standard revision picker (with its branch filtering tool) to select the local branch, rather than keeping all of the local branches in the Branch menu. The branch menu listing out all of the available branches is simply not sane for those types of huge repositories. Users can now checkout a detached head by ticking off the option in the checkout dialog. This option is off by default for the obvious reason, but it can be easily enabled for any local branch by simply checking it. We also detach the head if any non local branch was selected, or if a revision expression was entered. Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Diffstat (limited to 'lib/branch_rename.tcl')
-rw-r--r--lib/branch_rename.tcl14
1 files changed, 3 insertions, 11 deletions
diff --git a/lib/branch_rename.tcl b/lib/branch_rename.tcl
index 405101637f..1cadc31d20 100644
--- a/lib/branch_rename.tcl
+++ b/lib/branch_rename.tcl
@@ -8,7 +8,7 @@ field oldname
field newname
constructor dialog {} {
- global all_heads current_branch
+ global current_branch
make_toplevel top w
wm title $top "[appname] ([reponame]): Rename Branch"
@@ -34,7 +34,7 @@ constructor dialog {} {
frame $w.rename
label $w.rename.oldname_l -text {Branch:}
- eval tk_optionMenu $w.rename.oldname_m @oldname $all_heads
+ eval tk_optionMenu $w.rename.oldname_m @oldname [load_all_heads]
label $w.rename.newname_l -text {New Name:}
entry $w.rename.newname_t \
@@ -64,7 +64,7 @@ constructor dialog {} {
}
method _rename {} {
- global all_heads current_branch
+ global current_branch
if {$oldname eq {}} {
tk_messageBox \
@@ -118,14 +118,6 @@ method _rename {} {
return
}
- set oldidx [lsearch -exact -sorted $all_heads $oldname]
- if {$oldidx >= 0} {
- set all_heads [lreplace $all_heads $oldidx $oldidx]
- }
- lappend all_heads $newname
- set all_heads [lsort $all_heads]
- populate_branch_menu
-
if {$current_branch eq $oldname} {
set current_branch $newname
}