@matheusbsbs / matheus-bagliano / commits / fc816d7b85
Fork 0

git-gui: Rename fields in blame viewer to better descriptions

Calling the commit message pane $w_cmit is a tad confusing when we also have the $w_cgrp column that shows the abbreviated SHA-1s. So w_cmit -> w_cviewer, as it is the "commit viewer"; and w_cgrp -> w_amov as it is the "annotated commit + move tracking" column. Also changed line_data -> amov_data, as that list is exactly the results shown in w_amov. Why call the column "move tracking"? Because this column holds data from "git blame -M -C". I'm considering adding an additional column that holds the data from "git blame" without -M/-C, showing who did the copy/move, and when they did it. Signed-off-by: Shawn O. Pearce <spearce@spearce.org>

Shawn O. Pearce committed Jun 2, 2007 at 23:26 UTC fc816d7b857a5033982b421a384f7b2d932f57e6
1 file changed +58 -58
lib/blame.tcl
+58 -58
@@ -17,9 +17,9 @@ field w_back ; # our back button
17 field w_path ; # label showing the current file path
18 field w_columns ; # list of all column widgets in the viewer
19 field w_line ; # text column: all line numbers
20 -field w_cgrp ; # text column: abbreviated commit SHA-1s
20 +field w_amov ; # text column: annotations + move tracking
21 field w_file ; # text column: actual file data
22 -field w_cmit ; # pane showing commit message
22 +field w_cviewer ; # pane showing commit message
23 field status ; # text variable bound to status bar
24 field old_height ; # last known height of $w.file_pane
25
@@ -45,7 +45,7 @@ field old_bgcolor {} ; # background of current selection
45 field total_lines 0 ; # total length of file
46 field blame_lines 0 ; # number of lines computed
47 field have_commit ; # array commit -> 1
48 -field line_data ; # list of {commit origfile origline}
48 +field amov_data ; # list of {commit origfile origline}
49
50 field r_commit ; # commit currently being parsed
51 field r_orig_line ; # original line number
@@ -133,8 +133,8 @@ constructor new {i_commit i_path} {
133 -font font_diff
134 $w_line tag conf linenumber -justify right -rmargin 5
135
136 - set w_cgrp $w.file_pane.out.commit_t
137 - text $w_cgrp \
136 + set w_amov $w.file_pane.out.amove_t
137 + text $w_amov \
138 -takefocus 0 \
139 -highlightthickness 0 \
140 -padx 0 -pady 0 \
@@ -144,11 +144,11 @@ constructor new {i_commit i_path} {
144 -height 40 \
145 -width 4 \
146 -font font_diff
147 - $w_cgrp tag conf curr_commit
148 - $w_cgrp tag conf prior_commit \
147 + $w_amov tag conf curr_commit
148 + $w_amov tag conf prior_commit \
149 -foreground blue \
150 -underline 1
151 - $w_cgrp tag bind prior_commit \
151 + $w_amov tag bind prior_commit \
152 <Button-1> \
153 "[cb _load_commit @%x,%y];break"
154
@@ -165,7 +165,7 @@ constructor new {i_commit i_path} {
165 -xscrollcommand [list $w.file_pane.out.sbx set] \
166 -font font_diff
167
168 - set w_columns [list $w_cgrp $w_line $w_file]
168 + set w_columns [list $w_amov $w_line $w_file]
169
170 scrollbar $w.file_pane.out.sbx \
171 -orient h \
@@ -184,8 +184,8 @@ constructor new {i_commit i_path} {
184 -weight 1
185 grid rowconfigure $w.file_pane.out 0 -weight 1
186
187 - set w_cmit $w.file_pane.cm.t
188 - text $w_cmit \
187 + set w_cviewer $w.file_pane.cm.t
188 + text $w_cviewer \
189 -background white -borderwidth 0 \
190 -state disabled \
191 -wrap none \
@@ -194,23 +194,23 @@ constructor new {i_commit i_path} {
194 -xscrollcommand [list $w.file_pane.cm.sbx set] \
195 -yscrollcommand [list $w.file_pane.cm.sby set] \
196 -font font_diff
197 - $w_cmit tag conf header_key \
197 + $w_cviewer tag conf header_key \
198 -tabs {3c} \
199 -background $active_color \
200 -font font_uibold
201 - $w_cmit tag conf header_val \
201 + $w_cviewer tag conf header_val \
202 -background $active_color \
203 -font font_ui
204 - $w_cmit tag raise sel
204 + $w_cviewer tag raise sel
205 scrollbar $w.file_pane.cm.sbx \
206 -orient h \
207 - -command [list $w_cmit xview]
207 + -command [list $w_cviewer xview]
208 scrollbar $w.file_pane.cm.sby \
209 -orient v \
210 - -command [list $w_cmit yview]
210 + -command [list $w_cviewer yview]
211 pack $w.file_pane.cm.sby -side right -fill y
212 pack $w.file_pane.cm.sbx -side bottom -fill x
213 - pack $w_cmit -expand 1 -fill both
213 + pack $w_cviewer -expand 1 -fill both
214
215 frame $w.status \
216 -borderwidth 1 \
@@ -247,7 +247,7 @@ constructor new {i_commit i_path} {
247 "
248 }
249
250 - foreach i [concat $w_columns $w_cmit] {
250 + foreach i [concat $w_columns $w_cviewer] {
251 bind $i <Key-Up> {catch {%W yview scroll -1 units};break}
252 bind $i <Key-Down> {catch {%W yview scroll 1 units};break}
253 bind $i <Key-Left> {catch {%W xview scroll -1 units};break}
@@ -260,7 +260,7 @@ constructor new {i_commit i_path} {
260 bind $i <Control-Key-f> {catch {%W yview scroll 1 pages};break}
261 }
262
263 - bind $w_cmit <Button-1> [list focus $w_cmit]
263 + bind $w_cviewer <Button-1> [list focus $w_cviewer]
264 bind $top <Visibility> [list focus $top]
265 bind $w_file <Destroy> [list delete_this $this]
266
@@ -339,7 +339,7 @@ method _load {} {
339 # we use only 1 based lines, as that matches both with
340 # git-blame output and with Tk's text widget.
341 #
342 - set line_data [list [list]]
342 + set amov_data [list [list]]
343
344 set status "Loading $commit:[escape_path $path]..."
345 $w_path conf -text [escape_path $path]
@@ -406,7 +406,7 @@ method _read_file {fd} {
406 while {[gets $fd line] >= 0} {
407 regsub "\r\$" $line {} line
408 incr total_lines
409 - lappend line_data {}
409 + lappend amov_data {}
410
411 if {$total_lines > 1} {
412 foreach i $w_columns {$i insert end "\n"}
@@ -447,7 +447,7 @@ method _read_blame {fd} {
447 return
448 }
449
450 - $w_cgrp conf -state normal
450 + $w_amov conf -state normal
451 while {[gets $fd line] >= 0} {
452 if {[regexp {^([a-z0-9]{40}) (\d+) (\d+) (\d+)$} $line line \
453 cmit original_line final_line line_count]} {
@@ -506,29 +506,29 @@ method _read_blame {fd} {
506 set first_lno $lno
507 while {
508 $first_lno > 1
509 - && $cmit eq [lindex $line_data [expr {$first_lno - 1}] 0]
510 - && $file eq [lindex $line_data [expr {$first_lno - 1}] 1]
509 + && $cmit eq [lindex $amov_data [expr {$first_lno - 1}] 0]
510 + && $file eq [lindex $amov_data [expr {$first_lno - 1}] 1]
511 } {
512 incr first_lno -1
513 }
514
515 while {$n > 0} {
516 set lno_e "$lno.0 lineend + 1c"
517 - if {[lindex $line_data $lno] ne {}} {
518 - set g [lindex $line_data $lno 0]
517 + if {[lindex $amov_data $lno] ne {}} {
518 + set g [lindex $amov_data $lno 0]
519 foreach i $w_columns {
520 $i tag remove g$g $lno.0 $lno_e
521 }
522 }
523 - lset line_data $lno [list $cmit $file]
523 + lset amov_data $lno [list $cmit $file]
524
525 - $w_cgrp delete $lno.0 "$lno.0 lineend"
525 + $w_amov delete $lno.0 "$lno.0 lineend"
526 if {$lno == $first_lno} {
527 - $w_cgrp insert $lno.0 $commit_abbr $commit_type
527 + $w_amov insert $lno.0 $commit_abbr $commit_type
528 } elseif {$lno == [expr {$first_lno + 1}]} {
529 - $w_cgrp insert $lno.0 $author_abbr
529 + $w_amov insert $lno.0 $author_abbr
530 } else {
531 - $w_cgrp insert $lno.0 { |}
531 + $w_amov insert $lno.0 { |}
532 }
533
534 foreach i $w_columns {
@@ -550,17 +550,17 @@ method _read_blame {fd} {
550 }
551
552 while {
553 - $cmit eq [lindex $line_data $lno 0]
554 - && $file eq [lindex $line_data $lno 1]
553 + $cmit eq [lindex $amov_data $lno 0]
554 + && $file eq [lindex $amov_data $lno 1]
555 } {
556 - $w_cgrp delete $lno.0 "$lno.0 lineend"
556 + $w_amov delete $lno.0 "$lno.0 lineend"
557
558 if {$lno == $first_lno} {
559 - $w_cgrp insert $lno.0 $commit_abbr $commit_type
559 + $w_amov insert $lno.0 $commit_abbr $commit_type
560 } elseif {$lno == [expr {$first_lno + 1}]} {
561 - $w_cgrp insert $lno.0 $author_abbr
561 + $w_amov insert $lno.0 $author_abbr
562 } else {
563 - $w_cgrp insert $lno.0 { |}
563 + $w_amov insert $lno.0 { |}
564 }
565 incr lno
566 }
@@ -569,7 +569,7 @@ method _read_blame {fd} {
569 set header($r_commit,$key) $data
570 }
571 }
572 - $w_cgrp conf -state disabled
572 + $w_amov conf -state disabled
573
574 if {[eof $fd]} {
575 close $fd
@@ -600,8 +600,8 @@ method _click {cur_w pos} {
600 }
601
602 method _load_commit {pos} {
603 - set lno [lindex [split [$w_cgrp index $pos] .] 0]
604 - set dat [lindex $line_data $lno]
603 + set lno [lindex [split [$w_amov index $pos] .] 0]
604 + set dat [lindex $amov_data $lno]
605 if {$dat ne {}} {
606 set commit [lindex $dat 0]
607 set path [lindex $dat 1]
@@ -618,13 +618,13 @@ method _showcommit {lno} {
618 }
619 }
620
621 - $w_cmit conf -state normal
622 - $w_cmit delete 0.0 end
621 + $w_cviewer conf -state normal
622 + $w_cviewer delete 0.0 end
623
624 - set dat [lindex $line_data $lno]
624 + set dat [lindex $amov_data $lno]
625 if {$dat eq {}} {
626 set cmit {}
627 - $w_cmit insert end "Loading annotation..."
627 + $w_cviewer insert end "Loading annotation..."
628 } else {
629 set cmit [lindex $dat 0]
630 set file [lindex $dat 1]
@@ -680,23 +680,23 @@ method _showcommit {lno} {
680 set header($cmit,message) $msg
681 }
682
683 - $w_cmit insert end "commit $cmit\n" header_key
684 - $w_cmit insert end "Author:\t" header_key
685 - $w_cmit insert end "$author_name $author_email" header_val
686 - $w_cmit insert end "$author_time\n" header_val
683 + $w_cviewer insert end "commit $cmit\n" header_key
684 + $w_cviewer insert end "Author:\t" header_key
685 + $w_cviewer insert end "$author_name $author_email" header_val
686 + $w_cviewer insert end " $author_time\n" header_val
687
688 - $w_cmit insert end "Committer:\t" header_key
689 - $w_cmit insert end "$committer_name $committer_email" header_val
690 - $w_cmit insert end "$committer_time\n" header_val
688 + $w_cviewer insert end "Committer:\t" header_key
689 + $w_cviewer insert end "$committer_name $committer_email" header_val
690 + $w_cviewer insert end " $committer_time\n" header_val
691
692 if {$file ne $path} {
693 - $w_cmit insert end "Original File:\t" header_key
694 - $w_cmit insert end "[escape_path $file]\n" header_val
693 + $w_cviewer insert end "Original File:\t" header_key
694 + $w_cviewer insert end "[escape_path $file]\n" header_val
695 }
696
697 - $w_cmit insert end "\n$msg"
697 + $w_cviewer insert end "\n$msg"
698 }
699 - $w_cmit conf -state disabled
699 + $w_cviewer conf -state disabled
700
701 set highlight_line $lno
702 set highlight_commit $cmit
@@ -709,7 +709,7 @@ method _showcommit {lno} {
709 method _copycommit {} {
710 set pos @$::cursorX,$::cursorY
711 set lno [lindex [split [$::cursorW index $pos] .] 0]
712 - set dat [lindex $line_data $lno]
712 + set dat [lindex $amov_data $lno]
713 if {$dat ne {}} {
714 clipboard clear
715 clipboard append \
@@ -721,7 +721,7 @@ method _copycommit {} {
721
722 method _show_tooltip {cur_w pos} {
723 set lno [lindex [split [$cur_w index $pos] .] 0]
724 - set dat [lindex $line_data $lno]
724 + set dat [lindex $amov_data $lno]
725 if {$dat eq {}} {
726 _hide_tooltip $this
727 return
@@ -755,7 +755,7 @@ method _open_tooltip {cur_w} {
755 [expr {$pos_x - [winfo rootx $cur_w]}] \
756 [expr {$pos_y - [winfo rooty $cur_w]}]] ,]
757 set lno [lindex [split [$cur_w index $pos] .] 0]
758 - set dat [lindex $line_data $lno]
758 + set dat [lindex $amov_data $lno]
759 set cmit [lindex $dat 0]
760 set file [lindex $dat 1]
761