X-Git-Url: https://asedeno.scripts.mit.edu/gitweb/?a=blobdiff_plain;f=lib%2Fblame.tcl;h=352aa19421034033968f6a311b1e8948ac01e25f;hb=66c75a5c9f7434d857d836440dc1c3046c59b5f3;hp=4bdb9a27a3dbcc60957f1a4eaed123faf3952bac;hpb=0b81261622afad691501ee51d7811048cf4a5fce;p=git.git diff --git a/lib/blame.tcl b/lib/blame.tcl index 4bdb9a27a..352aa1942 100644 --- a/lib/blame.tcl +++ b/lib/blame.tcl @@ -74,11 +74,11 @@ constructor new {i_commit i_path} { set path $i_path make_toplevel top w - wm title $top "[appname] ([reponame]): File Viewer" + wm title $top [append "[appname] ([reponame]): " [mc "File Viewer"]] frame $w.header -background gold label $w.header.commit_l \ - -text {Commit:} \ + -text [mc "Commit:"] \ -background gold \ -anchor w \ -justify left @@ -101,7 +101,7 @@ constructor new {i_commit i_path} { -anchor w \ -justify left label $w.header.path_l \ - -text {File:} \ + -text [mc "File:"] \ -background gold \ -anchor w \ -justify left @@ -246,7 +246,7 @@ constructor new {i_commit i_path} { menu $w.ctxm -tearoff 0 $w.ctxm add command \ - -label "Copy Commit" \ + -label [mc "Copy Commit"] \ -command [cb _copycommit] foreach i $w_columns { @@ -366,10 +366,11 @@ method _load {jump} { set amov_data [list [list]] set asim_data [list [list]] - $status show "Reading $commit:[escape_path $path]..." + $status show [mc "Reading %s..." "$commit:[escape_path $path]"] $w_path conf -text [escape_path $path] if {$commit eq {}} { set fd [open $path r] + fconfigure $fd -eofchar {} } else { set fd [git_read cat-file blob "$commit:$path"] } @@ -742,20 +743,14 @@ method _showcommit {cur_w lno} { set author_time {} catch {set author_name $header($cmit,author)} catch {set author_email $header($cmit,author-mail)} - catch {set author_time [clock format \ - $header($cmit,author-time) \ - -format {%Y-%m-%d %H:%M:%S} - ]} + catch {set author_time [format_date $header($cmit,author-time)]} set committer_name {} set committer_email {} set committer_time {} catch {set committer_name $header($cmit,committer)} catch {set committer_email $header($cmit,committer-mail)} - catch {set committer_time [clock format \ - $header($cmit,committer-time) \ - -format {%Y-%m-%d %H:%M:%S} - ]} + catch {set committer_time [format_date $header($cmit,committer-time)]} if {[catch {set msg $header($cmit,message)}]} { set msg {} @@ -770,15 +765,20 @@ method _showcommit {cur_w lno} { set enc [string tolower [string range $line 9 end]] } } - set msg [encoding convertfrom $enc [read $fd]] - set msg [string trim $msg] + set msg [read $fd] close $fd - set author_name [encoding convertfrom $enc $author_name] - set committer_name [encoding convertfrom $enc $committer_name] - - set header($cmit,author) $author_name - set header($cmit,committer) $committer_name + set enc [tcl_encoding $enc] + if {$enc ne {}} { + set msg [encoding convertfrom $enc $msg] + set author_name [encoding convertfrom $enc $author_name] + set committer_name [encoding convertfrom $enc $committer_name] + set header($cmit,author) $author_name + set header($cmit,committer) $committer_name + set header($cmit,summary) \ + [encoding convertfrom $enc $header($cmit,summary)] + } + set msg [string trim $msg] } set header($cmit,message) $msg } @@ -873,6 +873,11 @@ method _open_tooltip {cur_w} { set org [lindex $amov_data $lno] } + if {$dat eq {}} { + _hide_tooltip $this + return + } + set cmit [lindex $dat 0] set tooltip_commit [list $cmit] @@ -881,10 +886,7 @@ method _open_tooltip {cur_w} { set author_time {} catch {set author_name $header($cmit,author)} catch {set summary $header($cmit,summary)} - catch {set author_time [clock format \ - $header($cmit,author-time) \ - -format {%Y-%m-%d %H:%M:%S} - ]} + catch {set author_time [format_date $header($cmit,author-time)]} $tooltip_t insert end "commit $cmit\n" $tooltip_t insert end "$author_name $author_time\n" @@ -903,10 +905,7 @@ method _open_tooltip {cur_w} { set author_time {} catch {set author_name $header($cmit,author)} catch {set summary $header($cmit,summary)} - catch {set author_time [clock format \ - $header($cmit,author-time) \ - -format {%Y-%m-%d %H:%M:%S} - ]} + catch {set author_time [foramt_date $header($cmit,author-time)]} $tooltip_t insert end "Originally By:\n" section_header $tooltip_t insert end "commit $cmit\n"