]> asedeno.scripts.mit.edu Git - git.git/blobdiff - git-gui.sh
git-gui: Make the tree browser also use lightgray selection
[git.git] / git-gui.sh
index b3d447e598019eefc3f3d27029b18017a934f724..2d7a2a82ca371edd0f965aea8a82c801f6fc19dd 100755 (executable)
@@ -10,7 +10,7 @@
 
 set appvers {@@GITGUI_VERSION@@}
 set copyright {
-Copyright © 2006, 2007 Shawn Pearce, et. al.
+Copyright Â© 2006, 2007 Shawn Pearce, et. al.
 
 This program is free software; you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
@@ -37,11 +37,13 @@ if {[catch {package require Tcl 8.4} err]
        tk_messageBox \
                -icon error \
                -type ok \
-               -title "git-gui: fatal error" \
+               -title [mc "git-gui: fatal error"] \
                -message $err
        exit 1
 }
 
+catch {rename send {}} ; # What an evil concept...
+
 ######################################################################
 ##
 ## locate our library
@@ -84,7 +86,16 @@ if {![catch {set _verbose $env(GITGUI_VERBOSE)}]} {
 ## http://www.gnu.org/software/gettext/manual/html_node/Tcl.html
 
 package require msgcat
-namespace import ::msgcat::mc
+
+proc mc {fmt args} {
+       set fmt [::msgcat::mc $fmt]
+       set cmk [string first @@ $fmt]
+       if {$cmk > 0} {
+               set fmt [string range $fmt 0 [expr {$cmk - 1}]]
+       }
+       return [eval [list format $fmt] $args]
+}
+
 ::msgcat::mcload $oguimsg
 unset oguimsg
 
@@ -515,7 +526,7 @@ if {[catch {set _git_version [git --version]} err]} {
        tk_messageBox \
                -icon error \
                -type ok \
-               -title "git-gui: fatal error" \
+               -title [mc "git-gui: fatal error"] \
                -message "Cannot determine Git version:
 
 $err
@@ -528,7 +539,7 @@ if {![regsub {^git version } $_git_version {} _git_version]} {
        tk_messageBox \
                -icon error \
                -type ok \
-               -title "git-gui: fatal error" \
+               -title [mc "git-gui: fatal error"] \
                -message [append [mc "Cannot parse Git version string:"] "\n\n$_git_version"]
        exit 1
 }
@@ -610,7 +621,7 @@ if {[git-version < 1.5]} {
        tk_messageBox \
                -icon error \
                -type ok \
-               -title "git-gui: fatal error" \
+               -title [mc "git-gui: fatal error"] \
                -message "[appname] requires Git 1.5.0 or later.
 
 You are using [git-version]:
@@ -629,7 +640,7 @@ if {[catch {set fd [open $idx r]} err]} {
        tk_messageBox \
                -icon error \
                -type ok \
-               -title "git-gui: fatal error" \
+               -title [mc "git-gui: fatal error"] \
                -message $err
        exit 1
 }
@@ -726,7 +737,7 @@ if {$_prefix ne {}} {
        regsub -all {[^/]+/} $_prefix ../ cdup
        if {[catch {cd $cdup} err]} {
                catch {wm withdraw .}
-               error_popup "Cannot move to top of working directory:\n\n$err"
+               error_popup [append [mc "Cannot move to top of working directory:"] "\n\n$err"]
                exit 1
        }
        unset cdup
@@ -1027,7 +1038,11 @@ proc read_ls_others {fd after} {
        set pck [split $buf_rlo "\0"]
        set buf_rlo [lindex $pck end]
        foreach p [lrange $pck 0 end-1] {
-               merge_state [encoding convertfrom $p] ?O
+               set p [encoding convertfrom $p]
+               if {[string index $p end] eq {/}} {
+                       set p [string range $p 0 end-1]
+               }
+               merge_state $p ?O
        }
        rescan_done $fd buf_rlo $after
 }
@@ -1689,7 +1704,7 @@ if {[is_enabled branch]} {
        .mbar add cascade -label [mc Branch] -menu .mbar.branch
 }
 if {[is_enabled multicommit] || [is_enabled singlecommit]} {
-       .mbar add cascade -label [mc Commit] -menu .mbar.commit
+       .mbar add cascade -label [mc Commit@@noun] -menu .mbar.commit
 }
 if {[is_enabled transport]} {
        .mbar add cascade -label [mc Merge] -menu .mbar.merge
@@ -1876,7 +1891,7 @@ if {[is_enabled multicommit] || [is_enabled singlecommit]} {
                -command do_signoff \
                -accelerator $M1T-S
 
-       .mbar.commit add command -label [mc Commit] \
+       .mbar.commit add command -label [mc Commit@@verb] \
                -command do_commit \
                -accelerator $M1T-Return
        lappend disable_on_lock \
@@ -2062,7 +2077,7 @@ blame {
        }
        blame   {
                if {$head eq {} && ![file exists $path]} {
-                       puts stderr "fatal: cannot stat path $path: No such file or directory"
+                       puts stderr [mc "fatal: cannot stat path %s: No such file or directory" $path]
                        exit 1
                }
                blame::new $head $path
@@ -2192,7 +2207,7 @@ button .vpane.lower.commarea.buttons.signoff -text [mc "Sign Off"] \
        -command do_signoff
 pack .vpane.lower.commarea.buttons.signoff -side top -fill x
 
-button .vpane.lower.commarea.buttons.commit -text [mc Commit] \
+button .vpane.lower.commarea.buttons.commit -text [mc Commit@@verb] \
        -command do_commit
 pack .vpane.lower.commarea.buttons.commit -side top -fill x
 lappend disable_on_lock \
@@ -2573,13 +2588,13 @@ focus -force $ui_comm
 if {[is_Cygwin]} {
        set ignored_env 0
        set suggest_user {}
-       set msg "Possible environment issues exist.
+       set msg [mc "Possible environment issues exist.
 
 The following environment variables are probably
 going to be ignored by any Git subprocess run
-by [appname]:
+by %s:
 
-"
+" [appname]]
        foreach name [array names env] {
                switch -regexp -- $name {
                {^GIT_INDEX_FILE$} -
@@ -2603,18 +2618,18 @@ by [appname]:
                }
        }
        if {$ignored_env > 0} {
-               append msg "
+               append msg [mc "
 This is due to a known issue with the
-Tcl binary distributed by Cygwin."
+Tcl binary distributed by Cygwin."]
 
                if {$suggest_user ne {}} {
-                       append msg "
+                       append msg [mc "
 
-A good replacement for $suggest_user
+A good replacement for %s
 is placing values for the user.name and
 user.email settings into your personal
 ~/.gitconfig file.
-"
+" $suggest_user]
                }
                warn_popup $msg
        }