git-gui: Display original filename and line number in blame.
When we annotate a file and show its line data, we're already asking for copy and movement detection (-M -C). This costs extra time, but gives extra data. Since we are asking for the extra data we really should show it to the user. Now the blame UI has two additional columns, one for the original filename (in the case of a move/copy between files) and one for the original line number of the current line of code. Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Shawn O. Pearce committed
Jan 29, 2007 at 05:33 UTC
915616e4ebaedc486a2dd235e70f25ceb39b4515
1 file changed
+33
-1
git-gui.sh
+33
-1
@@ -3190,6 +3190,25 @@ proc show_blame {commit path} {
3190
$w.out add $w.out.date
3191
lappend texts $w.out.date
3192
3193
+ text $w.out.filename -background white -borderwidth 0 \
3194
+ -state disabled \
3195
+ -wrap none \
3196
+ -height 40 \
3197
+ -width 20 \
3198
+ -font font_diff
3199
+ $w.out add $w.out.filename
3200
+ lappend texts $w.out.filename
3201
+
3202
+ text $w.out.origlinenumber -background white -borderwidth 0 \
3203
+ -state disabled \
3204
+ -wrap none \
3205
+ -height 40 \
3206
+ -width 5 \
3207
+ -font font_diff
3208
+ $w.out.origlinenumber tag conf linenumber -justify right
3209
+ $w.out add $w.out.origlinenumber
3210
+ lappend texts $w.out.origlinenumber
3211
+
3212
text $w.out.linenumber -background white -borderwidth 0 \
3213
-state disabled \
3214
-wrap none \
@@ -3286,7 +3305,9 @@ proc read_blame_catfile {fd w commit path texts w_lno w_file} {
3305
}
3306
}
3307
3289
-proc read_blame_incremental {fd w w_commit w_author w_date w_lno w_file} {
3308
+proc read_blame_incremental {fd w
3309
+ w_commit w_author w_date w_filename w_olno
3310
+ w_lno w_file} {
3311
global blame_status blame_data
3312
3313
if {![winfo exists $w_commit]} {
@@ -3297,6 +3318,8 @@ proc read_blame_incremental {fd w w_commit w_author w_date w_lno w_file} {
3318
$w_commit conf -state normal
3319
$w_author conf -state normal
3320
$w_date conf -state normal
3321
+ $w_filename conf -state normal
3322
+ $w_olno conf -state normal
3323
3324
while {[gets $fd line] >= 0} {
3325
if {[regexp {^([a-z0-9]{40}) (\d+) (\d+) (\d+)$} $line line \
@@ -3308,6 +3331,7 @@ proc read_blame_incremental {fd w w_commit w_author w_date w_lno w_file} {
3331
} elseif {[string match {filename *} $line]} {
3332
set n $blame_data($w,line_count)
3333
set lno $blame_data($w,final_line)
3334
+ set ol $blame_data($w,original_line)
3335
set file [string range $line 9 end]
3336
set commit $blame_data($w,commit)
3337
set abbrev [string range $commit 0 8]
@@ -3327,14 +3351,20 @@ proc read_blame_incremental {fd w w_commit w_author w_date w_lno w_file} {
3351
$w_commit delete $lno.0 "$lno.0 lineend"
3352
$w_author delete $lno.0 "$lno.0 lineend"
3353
$w_date delete $lno.0 "$lno.0 lineend"
3354
+ $w_filename delete $lno.0 "$lno.0 lineend"
3355
+ $w_olno delete $lno.0 "$lno.0 lineend"
3356
3357
$w_commit insert $lno.0 $abbrev
3358
$w_author insert $lno.0 $author
3359
$w_date insert $lno.0 $atime
3360
+ $w_filename insert $lno.0 $file
3361
+ $w_olno insert $lno.0 $ol linenumber
3362
+
3363
set blame_data($w,line$lno,commit) $commit
3364
3365
incr n -1
3366
incr lno
3367
+ incr ol
3368
}
3369
} elseif {[regexp {^([a-z-]+) (.*)$} $line line header data]} {
3370
set blame_data($w,$blame_data($w,commit),$header) $data
@@ -3344,6 +3374,8 @@ proc read_blame_incremental {fd w w_commit w_author w_date w_lno w_file} {
3374
$w_commit conf -state disabled
3375
$w_author conf -state disabled
3376
$w_date conf -state disabled
3377
+ $w_filename conf -state disabled
3378
+ $w_olno conf -state disabled
3379
3380
if {[eof $fd]} {
3381
close $fd