mirror of
https://github.com/git/git
synced 2024-08-27 19:49:21 +00:00
![Junio C Hamano](/assets/img/avatar_default.png)
-----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAABCAAGBQJYCJqmAAoJEDn3Aot9nM55uKQP/11BTzhOr9K3SLzwCr01ylGP 94AOA511vx3fIX5aWQ29S96tGbluo73RdbVsWFKKJcKSErpFPscFEiRkyjeMXE2T yWWOPOg08tm28ppZNp0Kqjb8VykUUKuG6gVT59DNFUZUqHYQbiQy+t8nwT+Qow3U dvo6lksovfSaW2FORWIi5KF5gD4v2F9qsbFgr725a8UoBrOmF0SWaCG4/ZYj0WxF 0rq8LjpvmMuQqd06DAoGMIsHa71R61En2QWfJ4YoE5+QRq8wQl37FmX+ojiA1rzY CG/vJO2Tw4v54wHKK1TCXG7LR4JhTcQZOa6zd8HHsPRn+viGDCMVUG9uMewfxH+m F47EVMxiKf0subm3fUhycqkvso0r6mOAddhz47RKT7tqU4XOnhPyGw0x6m7evawg Sz2+fOK3wwX2Qec5o3vBZKaEcOftSrLuZmbi5/j43crvcf+OAs9s/jdq/Ulpkks2 JI2i0DLzHABTbDn6QsuysEZnituks8T8Fdm5NOldritgBNVY81ifatekFscxt6Ct OrT9eGJk6iZiX1RvS+R7wykKJCBkxiyHqM8vSj5tPWjApgtnopPMudzNX41geaL9 ADeb8LVMTTNL/md8KED0deypilcPNnPbW035rAbyCpAsKbtgO3zdfzdzxsQ+dIvc MQpCDP5QPPr3toRVdNmb =VyhL -----END PGP SIGNATURE----- Merge tag 'gitgui-0.21.0' of git://repo.or.cz/git-gui git-gui 0.21.0 * tag 'gitgui-0.21.0' of git://repo.or.cz/git-gui: (22 commits) git-gui: set version 0.21 git-gui: Mark 'All' in remote.tcl for translation git-gui i18n: Updated Bulgarian translation (565,0f,0u) git-gui: avoid persisting modified author identity git-gui: handle the encoding of Git's output correctly git-gui: unicode file name support on windows git-gui: Update Russian translation git-gui: maintain backwards compatibility for merge syntax git-gui i18n: mark string in lib/error.tcl for translation git-gui: fix incorrect use of Tcl append command git-gui i18n: mark "usage:" strings for translation git-gui i18n: internationalize use of colon punctuation git-gui: ensure the file in the diff pane is in the list of selected files git-gui: support for $FILENAMES in tool definitions git-gui: fix initial git gui message encoding git-gui/po/glossary/txt-to-pot.sh: use the $( ... ) construct for command substitution git-gui (Windows): use git-gui.exe in `Create Desktop Shortcut` git-gui: fix detection of Cygwin Amend tab ordering and text widget border and highlighting. Allow keyboard control to work in the staging widgets. ...
94 lines
2.2 KiB
Tcl
94 lines
2.2 KiB
Tcl
# git-gui branch checkout support
|
|
# Copyright (C) 2007 Shawn Pearce
|
|
|
|
class branch_checkout {
|
|
|
|
field w ; # widget path
|
|
field w_rev ; # mega-widget to pick the initial revision
|
|
|
|
field opt_fetch 1; # refetch tracking branch if used?
|
|
field opt_detach 0; # force a detached head case?
|
|
|
|
constructor dialog {} {
|
|
global use_ttk NS
|
|
make_dialog top w
|
|
wm withdraw $w
|
|
wm title $top [mc "%s (%s): Checkout Branch" [appname] [reponame]]
|
|
if {$top ne {.}} {
|
|
wm geometry $top "+[winfo rootx .]+[winfo rooty .]"
|
|
}
|
|
|
|
${NS}::label $w.header -text [mc "Checkout Branch"] \
|
|
-font font_uibold -anchor center
|
|
pack $w.header -side top -fill x
|
|
|
|
${NS}::frame $w.buttons
|
|
${NS}::button $w.buttons.create -text [mc Checkout] \
|
|
-default active \
|
|
-command [cb _checkout]
|
|
pack $w.buttons.create -side right
|
|
${NS}::button $w.buttons.cancel -text [mc Cancel] \
|
|
-command [list destroy $w]
|
|
pack $w.buttons.cancel -side right -padx 5
|
|
pack $w.buttons -side bottom -fill x -pady 10 -padx 10
|
|
|
|
set w_rev [::choose_rev::new $w.rev [mc Revision]]
|
|
$w_rev bind_listbox <Double-Button-1> [cb _checkout]
|
|
pack $w.rev -anchor nw -fill both -expand 1 -pady 5 -padx 5
|
|
|
|
${NS}::labelframe $w.options -text [mc Options]
|
|
|
|
${NS}::checkbutton $w.options.fetch \
|
|
-text [mc "Fetch Tracking Branch"] \
|
|
-variable @opt_fetch
|
|
pack $w.options.fetch -anchor nw
|
|
|
|
${NS}::checkbutton $w.options.detach \
|
|
-text [mc "Detach From Local Branch"] \
|
|
-variable @opt_detach
|
|
pack $w.options.detach -anchor nw
|
|
|
|
pack $w.options -anchor nw -fill x -pady 5 -padx 5
|
|
|
|
bind $w <Visibility> [cb _visible]
|
|
bind $w <Key-Escape> [list destroy $w]
|
|
bind $w <Key-Return> [cb _checkout]\;break
|
|
wm deiconify $w
|
|
tkwait window $w
|
|
}
|
|
|
|
method _checkout {} {
|
|
set spec [$w_rev get_tracking_branch]
|
|
if {$spec ne {} && $opt_fetch} {
|
|
set new {}
|
|
} elseif {[catch {set new [$w_rev commit_or_die]}]} {
|
|
return
|
|
}
|
|
|
|
if {$opt_detach} {
|
|
set ref {}
|
|
} else {
|
|
set ref [$w_rev get_local_branch]
|
|
}
|
|
|
|
set co [::checkout_op::new [$w_rev get] $new $ref]
|
|
$co parent $w
|
|
$co enable_checkout 1
|
|
if {$spec ne {} && $opt_fetch} {
|
|
$co enable_fetch $spec
|
|
}
|
|
|
|
if {[$co run]} {
|
|
destroy $w
|
|
} else {
|
|
$w_rev focus_filter
|
|
}
|
|
}
|
|
|
|
method _visible {} {
|
|
grab $w
|
|
$w_rev focus_filter
|
|
}
|
|
|
|
}
|