Skip to content

Commit fc816d7

Browse files
committed
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 <[email protected]>
1 parent c5db65a commit fc816d7

File tree

1 file changed

+58
-58
lines changed

1 file changed

+58
-58
lines changed

lib/blame.tcl

Lines changed: 58 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@ field w_back ; # our back button
1717
field w_path ; # label showing the current file path
1818
field w_columns ; # list of all column widgets in the viewer
1919
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
2121
field w_file ; # text column: actual file data
22-
field w_cmit ; # pane showing commit message
22+
field w_cviewer ; # pane showing commit message
2323
field status ; # text variable bound to status bar
2424
field old_height ; # last known height of $w.file_pane
2525

@@ -45,7 +45,7 @@ field old_bgcolor {} ; # background of current selection
4545
field total_lines 0 ; # total length of file
4646
field blame_lines 0 ; # number of lines computed
4747
field have_commit ; # array commit -> 1
48-
field line_data ; # list of {commit origfile origline}
48+
field amov_data ; # list of {commit origfile origline}
4949

5050
field r_commit ; # commit currently being parsed
5151
field r_orig_line ; # original line number
@@ -133,8 +133,8 @@ constructor new {i_commit i_path} {
133133
-font font_diff
134134
$w_line tag conf linenumber -justify right -rmargin 5
135135

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 \
138138
-takefocus 0 \
139139
-highlightthickness 0 \
140140
-padx 0 -pady 0 \
@@ -144,11 +144,11 @@ constructor new {i_commit i_path} {
144144
-height 40 \
145145
-width 4 \
146146
-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 \
149149
-foreground blue \
150150
-underline 1
151-
$w_cgrp tag bind prior_commit \
151+
$w_amov tag bind prior_commit \
152152
<Button-1> \
153153
"[cb _load_commit @%x,%y];break"
154154

@@ -165,7 +165,7 @@ constructor new {i_commit i_path} {
165165
-xscrollcommand [list $w.file_pane.out.sbx set] \
166166
-font font_diff
167167

168-
set w_columns [list $w_cgrp $w_line $w_file]
168+
set w_columns [list $w_amov $w_line $w_file]
169169

170170
scrollbar $w.file_pane.out.sbx \
171171
-orient h \
@@ -184,8 +184,8 @@ constructor new {i_commit i_path} {
184184
-weight 1
185185
grid rowconfigure $w.file_pane.out 0 -weight 1
186186

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 \
189189
-background white -borderwidth 0 \
190190
-state disabled \
191191
-wrap none \
@@ -194,23 +194,23 @@ constructor new {i_commit i_path} {
194194
-xscrollcommand [list $w.file_pane.cm.sbx set] \
195195
-yscrollcommand [list $w.file_pane.cm.sby set] \
196196
-font font_diff
197-
$w_cmit tag conf header_key \
197+
$w_cviewer tag conf header_key \
198198
-tabs {3c} \
199199
-background $active_color \
200200
-font font_uibold
201-
$w_cmit tag conf header_val \
201+
$w_cviewer tag conf header_val \
202202
-background $active_color \
203203
-font font_ui
204-
$w_cmit tag raise sel
204+
$w_cviewer tag raise sel
205205
scrollbar $w.file_pane.cm.sbx \
206206
-orient h \
207-
-command [list $w_cmit xview]
207+
-command [list $w_cviewer xview]
208208
scrollbar $w.file_pane.cm.sby \
209209
-orient v \
210-
-command [list $w_cmit yview]
210+
-command [list $w_cviewer yview]
211211
pack $w.file_pane.cm.sby -side right -fill y
212212
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
214214

215215
frame $w.status \
216216
-borderwidth 1 \
@@ -247,7 +247,7 @@ constructor new {i_commit i_path} {
247247
"
248248
}
249249

250-
foreach i [concat $w_columns $w_cmit] {
250+
foreach i [concat $w_columns $w_cviewer] {
251251
bind $i <Key-Up> {catch {%W yview scroll -1 units};break}
252252
bind $i <Key-Down> {catch {%W yview scroll 1 units};break}
253253
bind $i <Key-Left> {catch {%W xview scroll -1 units};break}
@@ -260,7 +260,7 @@ constructor new {i_commit i_path} {
260260
bind $i <Control-Key-f> {catch {%W yview scroll 1 pages};break}
261261
}
262262

263-
bind $w_cmit <Button-1> [list focus $w_cmit]
263+
bind $w_cviewer <Button-1> [list focus $w_cviewer]
264264
bind $top <Visibility> [list focus $top]
265265
bind $w_file <Destroy> [list delete_this $this]
266266

@@ -339,7 +339,7 @@ method _load {} {
339339
# we use only 1 based lines, as that matches both with
340340
# git-blame output and with Tk's text widget.
341341
#
342-
set line_data [list [list]]
342+
set amov_data [list [list]]
343343

344344
set status "Loading $commit:[escape_path $path]..."
345345
$w_path conf -text [escape_path $path]
@@ -406,7 +406,7 @@ method _read_file {fd} {
406406
while {[gets $fd line] >= 0} {
407407
regsub "\r\$" $line {} line
408408
incr total_lines
409-
lappend line_data {}
409+
lappend amov_data {}
410410

411411
if {$total_lines > 1} {
412412
foreach i $w_columns {$i insert end "\n"}
@@ -447,7 +447,7 @@ method _read_blame {fd} {
447447
return
448448
}
449449

450-
$w_cgrp conf -state normal
450+
$w_amov conf -state normal
451451
while {[gets $fd line] >= 0} {
452452
if {[regexp {^([a-z0-9]{40}) (\d+) (\d+) (\d+)$} $line line \
453453
cmit original_line final_line line_count]} {
@@ -506,29 +506,29 @@ method _read_blame {fd} {
506506
set first_lno $lno
507507
while {
508508
$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]
511511
} {
512512
incr first_lno -1
513513
}
514514

515515
while {$n > 0} {
516516
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]
519519
foreach i $w_columns {
520520
$i tag remove g$g $lno.0 $lno_e
521521
}
522522
}
523-
lset line_data $lno [list $cmit $file]
523+
lset amov_data $lno [list $cmit $file]
524524

525-
$w_cgrp delete $lno.0 "$lno.0 lineend"
525+
$w_amov delete $lno.0 "$lno.0 lineend"
526526
if {$lno == $first_lno} {
527-
$w_cgrp insert $lno.0 $commit_abbr $commit_type
527+
$w_amov insert $lno.0 $commit_abbr $commit_type
528528
} elseif {$lno == [expr {$first_lno + 1}]} {
529-
$w_cgrp insert $lno.0 $author_abbr
529+
$w_amov insert $lno.0 $author_abbr
530530
} else {
531-
$w_cgrp insert $lno.0 { |}
531+
$w_amov insert $lno.0 { |}
532532
}
533533

534534
foreach i $w_columns {
@@ -550,17 +550,17 @@ method _read_blame {fd} {
550550
}
551551

552552
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]
555555
} {
556-
$w_cgrp delete $lno.0 "$lno.0 lineend"
556+
$w_amov delete $lno.0 "$lno.0 lineend"
557557

558558
if {$lno == $first_lno} {
559-
$w_cgrp insert $lno.0 $commit_abbr $commit_type
559+
$w_amov insert $lno.0 $commit_abbr $commit_type
560560
} elseif {$lno == [expr {$first_lno + 1}]} {
561-
$w_cgrp insert $lno.0 $author_abbr
561+
$w_amov insert $lno.0 $author_abbr
562562
} else {
563-
$w_cgrp insert $lno.0 { |}
563+
$w_amov insert $lno.0 { |}
564564
}
565565
incr lno
566566
}
@@ -569,7 +569,7 @@ method _read_blame {fd} {
569569
set header($r_commit,$key) $data
570570
}
571571
}
572-
$w_cgrp conf -state disabled
572+
$w_amov conf -state disabled
573573

574574
if {[eof $fd]} {
575575
close $fd
@@ -600,8 +600,8 @@ method _click {cur_w pos} {
600600
}
601601

602602
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]
605605
if {$dat ne {}} {
606606
set commit [lindex $dat 0]
607607
set path [lindex $dat 1]
@@ -618,13 +618,13 @@ method _showcommit {lno} {
618618
}
619619
}
620620

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
623623

624-
set dat [lindex $line_data $lno]
624+
set dat [lindex $amov_data $lno]
625625
if {$dat eq {}} {
626626
set cmit {}
627-
$w_cmit insert end "Loading annotation..."
627+
$w_cviewer insert end "Loading annotation..."
628628
} else {
629629
set cmit [lindex $dat 0]
630630
set file [lindex $dat 1]
@@ -680,23 +680,23 @@ method _showcommit {lno} {
680680
set header($cmit,message) $msg
681681
}
682682

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
687687

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
691691

692692
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
695695
}
696696

697-
$w_cmit insert end "\n$msg"
697+
$w_cviewer insert end "\n$msg"
698698
}
699-
$w_cmit conf -state disabled
699+
$w_cviewer conf -state disabled
700700

701701
set highlight_line $lno
702702
set highlight_commit $cmit
@@ -709,7 +709,7 @@ method _showcommit {lno} {
709709
method _copycommit {} {
710710
set pos @$::cursorX,$::cursorY
711711
set lno [lindex [split [$::cursorW index $pos] .] 0]
712-
set dat [lindex $line_data $lno]
712+
set dat [lindex $amov_data $lno]
713713
if {$dat ne {}} {
714714
clipboard clear
715715
clipboard append \
@@ -721,7 +721,7 @@ method _copycommit {} {
721721

722722
method _show_tooltip {cur_w pos} {
723723
set lno [lindex [split [$cur_w index $pos] .] 0]
724-
set dat [lindex $line_data $lno]
724+
set dat [lindex $amov_data $lno]
725725
if {$dat eq {}} {
726726
_hide_tooltip $this
727727
return
@@ -755,7 +755,7 @@ method _open_tooltip {cur_w} {
755755
[expr {$pos_x - [winfo rootx $cur_w]}] \
756756
[expr {$pos_y - [winfo rooty $cur_w]}]] ,]
757757
set lno [lindex [split [$cur_w index $pos] .] 0]
758-
set dat [lindex $line_data $lno]
758+
set dat [lindex $amov_data $lno]
759759
set cmit [lindex $dat 0]
760760
set file [lindex $dat 1]
761761

0 commit comments

Comments
 (0)