From: Shawn O. Pearce Date: Fri, 6 Jul 2007 08:03:24 +0000 (-0400) Subject: Merge branch 'maint' X-Git-Tag: v1.5.3-rc1~16^2~37 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/f8186e92e3399ddd742f2397e802467cabf2849f?hp=-c Merge branch 'maint' * maint: git-gui: Ensure windows shortcuts always have .bat extension git-gui: Include a Push action on the left toolbar git-gui: Bind M1-P to push action git-gui: Don't bind F5/M1-R in all windows Conflicts: git-gui.sh --- f8186e92e3399ddd742f2397e802467cabf2849f diff --combined git-gui.sh index 8ee680221d,c38aa067ac..0096f4913a --- a/git-gui.sh +++ b/git-gui.sh @@@ -42,24 -42,6 +42,24 @@@ if {[catch {package require Tcl 8.4} er exit 1 } +###################################################################### +## +## enable verbose loading? + +if {![catch {set _verbose $env(GITGUI_VERBOSE)}]} { + unset _verbose + rename auto_load real__auto_load + proc auto_load {name args} { + puts stderr "auto_load $name" + return [uplevel 1 real__auto_load $name $args] + } + rename source real__source + proc source {name} { + puts stderr "source $name" + uplevel 1 real__source $name + } +} + ###################################################################### ## ## configure our library @@@ -72,33 -54,26 +72,33 @@@ if {$oguirel eq {1}} } elseif {[string match @@* $oguirel]} { set oguilib [file join [file dirname [file normalize $argv0]] lib] } + set idx [file join $oguilib tclIndex] -catch { - set fd [open $idx r] - if {[gets $fd] eq {# Autogenerated by git-gui Makefile}} { - set idx [list] - while {[gets $fd n] >= 0} { - if {$n ne {} && ![string match #* $n]} { - lappend idx $n - } +if {[catch {set fd [open $idx r]} err]} { + catch {wm withdraw .} + tk_messageBox \ + -icon error \ + -type ok \ + -title "git-gui: fatal error" \ + -message $err + exit 1 +} +if {[gets $fd] eq {# Autogenerated by git-gui Makefile}} { + set idx [list] + while {[gets $fd n] >= 0} { + if {$n ne {} && ![string match #* $n]} { + lappend idx $n } - } else { - set idx {} } - close $fd +} else { + set idx {} } +close $fd + if {$idx ne {}} { set loaded [list] foreach p $idx { if {[lsearch -exact $loaded $p] >= 0} continue - puts $p source [file join $oguilib $p] lappend loaded $p } @@@ -106,7 -81,21 +106,7 @@@ } else { set auto_path [concat [list $oguilib] $auto_path] } -unset -nocomplain oguilib oguirel idx fd - -if {![catch {set _verbose $env(GITGUI_VERBOSE)}]} { - unset _verbose - rename auto_load real__auto_load - proc auto_load {name args} { - puts stderr "auto_load $name" - return [uplevel 1 real__auto_load $name $args] - } - rename source real__source - proc source {name} { - puts stderr "source $name" - uplevel 1 real__source $name - } -} +unset -nocomplain oguirel idx fd ###################################################################### ## @@@ -222,15 -211,6 +222,15 @@@ proc is_config_true {name} } } +proc get_config {name} { + global repo_config + if {[catch {set v $repo_config($name)}]} { + return {} + } else { + return $v + } +} + proc load_config {include_global} { global repo_config global_config default_config @@@ -284,17 -264,6 +284,17 @@@ proc git {args} return [eval exec git $args] } +proc current-branch {} { + set ref {} + set fd [open [gitdir HEAD] r] + if {[gets $fd ref] <16 + || ![regsub {^ref: refs/heads/} $ref {} ref]} { + set ref {} + } + close $fd + return $ref +} + auto_load tk_optionMenu rename tk_optionMenu real__tkOptionMenu proc tk_optionMenu {w varName args} { @@@ -438,7 -407,15 +438,7 @@@ proc repository_state {ctvar hdvar mhva set mh [list] - if {[catch {set current_branch [git symbolic-ref HEAD]}]} { - set current_branch {} - } else { - regsub ^refs/((heads|tags|remotes)/)? \ - $current_branch \ - {} \ - current_branch - } - + set current_branch [current-branch] if {[catch {set hd [git rev-parse --verify HEAD]}]} { set hd {} set ct initial @@@ -1256,10 -1233,6 +1256,10 @@@ foreach class {Button Checkbutton Entr } unset class +if {[is_Windows] || [is_MacOSX]} { + option add *Menu.tearOff 0 +} + if {[is_MacOSX]} { set M1B M1 set M1T Cmd @@@ -1290,13 -1263,11 +1290,13 @@@ proc apply_config {} } } +set default_config(merge.diffstat) true set default_config(merge.summary) false set default_config(merge.verbosity) 2 set default_config(user.name) {} set default_config(user.email) {} +set default_config(gui.pruneduringfetch) false set default_config(gui.trustmtime) false set default_config(gui.diffcontext) 5 set default_config(gui.newbranchtemplate) {} @@@ -1458,11 -1429,6 +1458,11 @@@ if {[is_enabled branch]} lappend disable_on_lock [list .mbar.branch entryconf \ [.mbar.branch index last] -state] + .mbar.branch add command -label {Rename...} \ + -command branch_rename::dialog + lappend disable_on_lock [list .mbar.branch entryconf \ + [.mbar.branch index last] -state] + .mbar.branch add command -label {Delete...} \ -command do_delete_branch lappend disable_on_lock [list .mbar.branch entryconf \ @@@ -1559,9 -1525,8 +1559,10 @@@ if {[is_enabled transport]} menu .mbar.push .mbar.push add command -label {Push...} \ - -command do_push_anywhere + -command do_push_anywhere \ + -accelerator $M1T-P + .mbar.push add command -label {Delete...} \ + -command remote_branch_delete::dialog } if {[is_MacOSX]} { @@@ -1678,8 -1643,14 +1679,8 @@@ switch -- $subcommand browser { set subcommand_args {rev?} switch [llength $argv] { - 0 { - set current_branch [git symbolic-ref HEAD] - regsub ^refs/((heads|tags|remotes)/)? \ - $current_branch {} current_branch - } - 1 { - set current_branch [lindex $argv 0] - } + 0 { set current_branch [current-branch] } + 1 { set current_branch [lindex $argv 0] } default usage } browser::new $current_branch @@@ -1712,7 -1683,9 +1713,7 @@@ blame unset is_path if {$head eq {}} { - set current_branch [git symbolic-ref HEAD] - regsub ^refs/((heads|tags|remotes)/)? \ - $current_branch {} current_branch + set current_branch [current-branch] } else { set current_branch $head } @@@ -1849,6 -1822,10 +1850,10 @@@ pack .vpane.lower.commarea.buttons.comm lappend disable_on_lock \ {.vpane.lower.commarea.buttons.commit conf -state} + button .vpane.lower.commarea.buttons.push -text {Push} \ + -command do_push_anywhere + pack .vpane.lower.commarea.buttons.push -side top -fill x + # -- Commit Message Buffer # frame .vpane.lower.commarea.buffer @@@ -2176,10 -2153,14 +2181,14 @@@ if {[is_enabled branch]} bind . <$M1B-Key-n> do_create_branch bind . <$M1B-Key-N> do_create_branch } + if {[is_enabled transport]} { + bind . <$M1B-Key-p> do_push_anywhere + bind . <$M1B-Key-P> do_push_anywhere + } - bind all do_rescan - bind all <$M1B-Key-r> do_rescan - bind all <$M1B-Key-R> do_rescan + bind . do_rescan + bind . <$M1B-Key-r> do_rescan + bind . <$M1B-Key-R> do_rescan bind . <$M1B-Key-s> do_signoff bind . <$M1B-Key-S> do_signoff bind . <$M1B-Key-i> do_add_all