field newname
constructor dialog {} {
- global all_heads current_branch
+ global current_branch
make_toplevel top w
wm title $top "[appname] ([reponame]): Rename Branch"
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 \
$w.rename.newname_t icursor end
focus $w.rename.newname_t
"
- bind $w.header <Destroy> [list delete_this $this]
tkwait window $w
}
method _rename {} {
- global all_heads current_branch
+ global current_branch
if {$oldname eq {}} {
tk_messageBox \
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
}