summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: bba0604)
raw | patch | inline | side by side (parent: bba0604)
author | Shawn O. Pearce <spearce@spearce.org> | |
Fri, 14 Sep 2007 05:50:09 +0000 (01:50 -0400) | ||
committer | Shawn O. Pearce <spearce@spearce.org> | |
Fri, 14 Sep 2007 05:51:18 +0000 (01:51 -0400) |
The Tcl expression "[append [mc Foo] Bar]" does not return the string
"FooBar" after translation; instead it is setting the variable Foo to
the value Bar, or if Foo is already defined it is appending Bar onto
the end of it. This is *not* what we wanted to have happen here.
Tcl's join function is actually the correct function but its default
joinStr argument is a single space. Unfortunately all of our call
sites do not want an extra space added to their string. So we need
a small wrapper function to make the call to join with an empty
join string. In C this is (roughly) the job of the strcat function.
Since strcat is not yet used at the global level it is a reasonable
name to use here.
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
"FooBar" after translation; instead it is setting the variable Foo to
the value Bar, or if Foo is already defined it is appending Bar onto
the end of it. This is *not* what we wanted to have happen here.
Tcl's join function is actually the correct function but its default
joinStr argument is a single space. Unfortunately all of our call
sites do not want an extra space added to their string. So we need
a small wrapper function to make the call to join with an empty
join string. In C this is (roughly) the job of the strcat function.
Since strcat is not yet used at the global level it is a reasonable
name to use here.
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
git-gui.sh | patch | blob | history | |
lib/blame.tcl | patch | blob | history | |
lib/branch_rename.tcl | patch | blob | history | |
lib/checkout_op.tcl | patch | blob | history | |
lib/choose_rev.tcl | patch | blob | history | |
lib/commit.tcl | patch | blob | history | |
lib/diff.tcl | patch | blob | history | |
lib/option.tcl | patch | blob | history | |
lib/shortcut.tcl | patch | blob | history |
diff --git a/git-gui.sh b/git-gui.sh
index 2d7a2a82ca371edd0f965aea8a82c801f6fc19dd..4682487ade27de393571e912433ece37f6816d82 100755 (executable)
--- a/git-gui.sh
+++ b/git-gui.sh
return [eval [list format $fmt] $args]
}
+proc strcat {args} {
+ return [join $args {}]
+}
+
::msgcat::mcload $oguimsg
unset oguimsg
-icon error \
-type ok \
-title [mc "git-gui: fatal error"] \
- -message [append [mc "Cannot parse Git version string:"] "\n\n$_git_version"]
+ -message [strcat [mc "Cannot parse Git version string:"] "\n\n$_git_version"]
exit 1
}
set _prefix [git rev-parse --show-prefix]
} err]} {
catch {wm withdraw .}
- error_popup [append [mc "Cannot find the git directory:"] "\n\n$err"]
+ error_popup [strcat [mc "Cannot find the git directory:"] "\n\n$err"]
exit 1
}
if {![file isdirectory $_gitdir] && [is_Cygwin]} {
}
if {![file isdirectory $_gitdir]} {
catch {wm withdraw .}
- error_popup [append [mc "Git directory not found:"] "\n\n$_gitdir"]
+ error_popup [strcat [mc "Git directory not found:"] "\n\n$_gitdir"]
exit 1
}
if {$_prefix ne {}} {
regsub -all {[^/]+/} $_prefix ../ cdup
if {[catch {cd $cdup} err]} {
catch {wm withdraw .}
- error_popup [append [mc "Cannot move to top of working directory:"] "\n\n$err"]
+ error_popup [strcat [mc "Cannot move to top of working directory:"] "\n\n$err"]
exit 1
}
unset cdup
} elseif {![is_enabled bare]} {
if {[lindex [file split $_gitdir] end] ne {.git}} {
catch {wm withdraw .}
- error_popup [append [mc "Cannot use funny .git directory:"] "\n\n$_gitdir"]
+ error_popup [strcat [mc "Cannot use funny .git directory:"] "\n\n$_gitdir"]
exit 1
}
if {[catch {cd [file dirname $_gitdir]} err]} {
catch {wm withdraw .}
- error_popup [append [mc "No working directory"] " [file dirname $_gitdir]:\n\n$err"]
+ error_popup [strcat [mc "No working directory"] " [file dirname $_gitdir]:\n\n$err"]
exit 1
}
}
font configure $font $cn $cv
}
} err]} {
- error_popup [append [mc "Invalid font specified in %s:" "gui.$name"] "\n\n$err"]
+ error_popup [strcat [mc "Invalid font specified in %s:" "gui.$name"] "\n\n$err"]
}
foreach {cn cv} [font configure $font] {
font configure ${font}bold $cn $cv
diff --git a/lib/blame.tcl b/lib/blame.tcl
index d14805e929e2791ebd130ebb4a39c4e1e99dd3fb..a911c3c77deff7a01419cccc7c4e69905d4ceb7b 100644 (file)
--- a/lib/blame.tcl
+++ b/lib/blame.tcl
}
$w_cviewer insert end "commit $cmit\n" header_key
- $w_cviewer insert end [append [mc "Author:"] "\t"] header_key
+ $w_cviewer insert end [strcat [mc "Author:"] "\t"] header_key
$w_cviewer insert end "$author_name $author_email" header_val
$w_cviewer insert end " $author_time\n" header_val
- $w_cviewer insert end [append [mc "Committer:"] "\t"] header_key
+ $w_cviewer insert end [strcat [mc "Committer:"] "\t"] header_key
$w_cviewer insert end "$committer_name $committer_email" header_val
$w_cviewer insert end " $committer_time\n" header_val
if {$file ne $path} {
- $w_cviewer insert end [append [mc "Original File:"] "\t"] header_key
+ $w_cviewer insert end [strcat [mc "Original File:"] "\t"] header_key
$w_cviewer insert end "[escape_path $file]\n" header_val
}
catch {set summary $header($cmit,summary)}
catch {set author_time [foramt_date $header($cmit,author-time)]}
- $tooltip_t insert end [append [mc "Originally By:"] "\n"] section_header
+ $tooltip_t insert end [strcat [mc "Originally By:"] "\n"] section_header
$tooltip_t insert end "commit $cmit\n"
$tooltip_t insert end "$author_name $author_time\n"
$tooltip_t insert end "$summary\n"
if {$file ne $path} {
- $tooltip_t insert end [append [mc "In File:"] " "] section_header
+ $tooltip_t insert end [strcat [mc "In File:"] " "] section_header
$tooltip_t insert end "$file\n"
}
$tooltip_t insert end "\n"
- $tooltip_t insert end [append [mc "Copied Or Moved Here By:"] "\n"] section_header
+ $tooltip_t insert end [strcat [mc "Copied Or Moved Here By:"] "\n"] section_header
$tooltip_t insert end $save
}
diff --git a/lib/branch_rename.tcl b/lib/branch_rename.tcl
index d6f040e7a24f50709174f1a62283252f5c3fe9a6..166538808f461275075e2b03c56ddc15b5813e1a 100644 (file)
--- a/lib/branch_rename.tcl
+++ b/lib/branch_rename.tcl
-type ok \
-title [wm title $w] \
-parent $w \
- -message [append [mc "Failed to rename '%s'." $oldname] "\n\n$err"]
+ -message [strcat [mc "Failed to rename '%s'." $oldname] "\n\n$err"]
return
}
diff --git a/lib/checkout_op.tcl b/lib/checkout_op.tcl
index a011044f90039e1063a90c233747bb150d24bd20..f24396692474e3da66f9502b2f06f13583a3deeb 100644 (file)
--- a/lib/checkout_op.tcl
+++ b/lib/checkout_op.tcl
if {[catch {
git update-ref -m $reflog_msg $ref $new $cur
} err]} {
- _error $this [append [mc "Failed to update '%s'." $newbranch] "\n\n$err"]
+ _error $this [strcat [mc "Failed to update '%s'." $newbranch] "\n\n$err"]
return 0
}
}
set err $readtree_d
regsub {^fatal: } $err {} err
$::main_status stop [mc "Aborted checkout of '%s' (file level merging is required)." [_name $this]]
- warn_popup [append [mc "File level merge required."] "
+ warn_popup [strcat [mc "File level merge required."] "
$err
}
method _fatal {err} {
- error_popup [append [mc "Failed to set current branch.
+ error_popup [strcat [mc "Failed to set current branch.
This working directory is only partially switched. We successfully updated your files, but failed to update an internal Git file.
diff --git a/lib/choose_rev.tcl b/lib/choose_rev.tcl
index 5e833a53764ad495f5d7753eb52673e02b73289e..a063c5bc49fc9bad58f7fd78e7446a097ce86b88 100644 (file)
--- a/lib/choose_rev.tcl
+++ b/lib/choose_rev.tcl
}
set top [winfo toplevel $w]
- set msg [append [mc "Invalid revision: %s" [get $this]] "\n\n$err"]
+ set msg [strcat [mc "Invalid revision: %s" [get $this]] "\n\n$err"]
tk_messageBox \
-icon error \
-type ok \
diff --git a/lib/commit.tcl b/lib/commit.tcl
index a037c4f7d0d9c186ba76a93731ce51a3aa169da1..7099f5c6f79a72e75b83cfdc7432249476c492cb 100644 (file)
--- a/lib/commit.tcl
+++ b/lib/commit.tcl
}
set msg [string trim $msg]
} err]} {
- error_popup [append [mc "Error loading commit data for amend:"] "\n\n$err"]
+ error_popup [strcat [mc "Error loading commit data for amend:"] "\n\n$err"]
return
}
if {$GIT_COMMITTER_IDENT eq {}} {
if {[catch {set me [git var GIT_COMMITTER_IDENT]} err]} {
- error_popup [append [mc "Unable to obtain your identity:"] "\n\n$err"]
+ error_popup [strcat [mc "Unable to obtain your identity:"] "\n\n$err"]
return {}
}
if {![regexp {^(.*) [0-9]+ [-+0-9]+$} \
$me me GIT_COMMITTER_IDENT]} {
- error_popup [append [mc "Invalid GIT_COMMITTER_IDENT:"] "\n\n$me"]
+ error_popup [strcat [mc "Invalid GIT_COMMITTER_IDENT:"] "\n\n$me"]
return {}
}
}
gets $fd_wt tree_id
if {$tree_id eq {} || [catch {close $fd_wt} err]} {
- error_popup [append [mc "write-tree failed:"] "\n\n$err"]
+ error_popup [strcat [mc "write-tree failed:"] "\n\n$err"]
ui_status {Commit failed.}
unlock_index
return
}
lappend cmd <$msg_p
if {[catch {set cmt_id [eval git $cmd]} err]} {
- error_popup [append [mc "commit-tree failed:"] "\n\n$err"]
+ error_popup [strcat [mc "commit-tree failed:"] "\n\n$err"]
ui_status {Commit failed.}
unlock_index
return
if {[catch {
git update-ref -m $reflogm HEAD $cmt_id $curHEAD
} err]} {
- error_popup [append [mc "update-ref failed:"] "\n\n$err"]
+ error_popup [strcat [mc "update-ref failed:"] "\n\n$err"]
ui_status {Commit failed.}
unlock_index
return
diff --git a/lib/diff.tcl b/lib/diff.tcl
index c2ae4555fe438c4263402485fea73396fcfd37e6..43565e412fa6c3c96487051c3997424e7d144b22 100644 (file)
--- a/lib/diff.tcl
+++ b/lib/diff.tcl
set diff_active 0
unlock_index
ui_status [mc "Unable to display %s" [escape_path $path]]
- error_popup [append [mc "Error loading file:"] "\n\n$err"]
+ error_popup [strcat [mc "Error loading file:"] "\n\n$err"]
return
}
$ui_diff conf -state normal
set diff_active 0
unlock_index
ui_status [mc "Unable to display %s" [escape_path $path]]
- error_popup [append [mc "Error loading diff:"] "\n\n$err"]
+ error_popup [strcat [mc "Error loading diff:"] "\n\n$err"]
return
}
diff --git a/lib/option.tcl b/lib/option.tcl
index 03bc08f128b5ab24d716d45b52c3480c889424b6..12e297971a01bfecd4c2007feddea5e47d2d822c 100644 (file)
--- a/lib/option.tcl
+++ b/lib/option.tcl
proc do_save_config {w} {
if {[catch {save_config} err]} {
- error_popup [append [mc "Failed to completely save options:"] "\n\n$err"]
+ error_popup [strcat [mc "Failed to completely save options:"] "\n\n$err"]
}
reshow_diff
destroy $w
diff --git a/lib/shortcut.tcl b/lib/shortcut.tcl
index d0e63a3d0e5be952fd07c77ababecf8c3a5b2aff..a7674a7aeea2e5e1be026cd6638468cc35acaf14 100644 (file)
--- a/lib/shortcut.tcl
+++ b/lib/shortcut.tcl
puts $fd " \"[file normalize $argv0]\""
close $fd
} err]} {
- error_popup [append [mc "Cannot write script:"] "\n\n$err"]
+ error_popup [strcat [mc "Cannot write script:"] "\n\n$err"]
}
}
}
puts $fd " &\""
close $fd
} err]} {
- error_popup [append [mc "Cannot write script:"] "\n\n$err"]
+ error_popup [strcat [mc "Cannot write script:"] "\n\n$err"]
}
}
}
file attributes $exe -permissions u+x,g+x,o+x
} err]} {
- error_popup [append [mc "Cannot write icon:"] "\n\n$err"]
+ error_popup [strcat [mc "Cannot write icon:"] "\n\n$err"]
}
}
}