summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 9adccb0)
raw | patch | inline | side by side (parent: 9adccb0)
author | Shawn O. Pearce <spearce@spearce.org> | |
Fri, 1 Jun 2007 03:58:55 +0000 (23:58 -0400) | ||
committer | Shawn O. Pearce <spearce@spearce.org> | |
Wed, 6 Jun 2007 05:26:42 +0000 (01:26 -0400) |
We now show the first 4 digits of each commit in the left most
column of our blame viewer, before the line numbers. These are
drawn as the data becomes available from git-blame --incremental,
and helps the user to visually group lines together.
I'm using only the first 4 digits because within a given cluster
of lines its unlikely that two neighboring commits will have the
same 4 digit prefix.
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
column of our blame viewer, before the line numbers. These are
drawn as the data becomes available from git-blame --incremental,
and helps the user to visually group lines together.
I'm using only the first 4 digits because within a given cluster
of lines its unlikely that two neighboring commits will have the
same 4 digit prefix.
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
lib/blame.tcl | patch | blob | history |
diff --git a/lib/blame.tcl b/lib/blame.tcl
index 8b032d959011f111c052fb4eee8be02aa6d45dd9..155bbe37f04e74bc5706f5dd808b0b4eb6a5d478 100644 (file)
--- a/lib/blame.tcl
+++ b/lib/blame.tcl
field w
field w_line
+field w_cgrp
field w_load
field w_file
field w_cmit
-font font_diff
$w.out.linenumber_t tag conf linenumber -justify right
+ text $w.out.commit_t \
+ -background white -borderwidth 0 \
+ -state disabled \
+ -wrap none \
+ -height 40 \
+ -width 4 \
+ -font font_diff
+
text $w.out.file_t \
-background white -borderwidth 0 \
-state disabled \
-command [list scrollbar2many [list \
$w.out.loaded_t \
$w.out.linenumber_t \
+ $w.out.commit_t \
$w.out.file_t \
] yview]
grid \
+ $w.out.commit_t \
$w.out.linenumber_t \
$w.out.loaded_t \
$w.out.file_t \
$w.out.sby \
-sticky nsew
- grid conf $w.out.sbx -column 2 -sticky we
- grid columnconfigure $w.out 2 -weight 1
+ grid conf $w.out.sbx -column 3 -sticky we
+ grid columnconfigure $w.out 3 -weight 1
grid rowconfigure $w.out 0 -weight 1
pack $w.out -fill both -expand 1
-command [cb _copycommit]
set w_line $w.out.linenumber_t
+ set w_cgrp $w.out.commit_t
set w_load $w.out.loaded_t
set w_file $w.out.file_t
set w_cmit $w.cm.t
foreach i [list \
+ $w.out.commit_t \
$w.out.loaded_t \
$w.out.linenumber_t \
$w.out.file_t] {
-foreground [$i cget -background]
$i conf -yscrollcommand \
[list many2scrollbar [list \
+ $w.out.commit_t \
$w.out.loaded_t \
$w.out.linenumber_t \
$w.out.file_t \
}
foreach i [list \
+ $w.out.commit_t \
$w.out.loaded_t \
$w.out.linenumber_t \
$w.out.file_t \
method _read_file {fd} {
$w_load conf -state normal
+ $w_cgrp conf -state normal
$w_line conf -state normal
$w_file conf -state normal
while {[gets $fd line] >= 0} {
regsub "\r\$" $line {} line
incr total_lines
+
$w_load insert end "\n"
+ $w_cgrp insert end "\n"
$w_line insert end "$total_lines\n" linenumber
$w_file insert end "$line\n"
}
$w_load conf -state disabled
+ $w_cgrp conf -state disabled
$w_line conf -state disabled
$w_file conf -state disabled
} ifdeleted { catch {close $fd} }
method _read_blame {fd} {
+ $w_cgrp conf -state normal
while {[gets $fd line] >= 0} {
if {[regexp {^([a-z0-9]{40}) (\d+) (\d+) (\d+)$} $line line \
cmit original_line final_line line_count]} {
set r_line_count $line_count
if {[catch {set g $order($cmit)}]} {
+ $w_cgrp tag conf g$cmit
$w_line tag conf g$cmit
$w_file tag conf g$cmit
+
+ $w_cgrp tag raise in_sel
$w_line tag raise in_sel
$w_file tag raise in_sel
+
$w_file tag raise sel
set order($cmit) $commit_count
incr commit_count
set n $r_line_count
set lno $r_final_line
set cmit $r_commit
+ set abbr [string range $cmit 0 4]
while {$n > 0} {
set lno_e "$lno.0 lineend + 1c"
if {[catch {set g g$line_commit($lno)}]} {
$w_load tag add annotated $lno.0 $lno_e
} else {
+ $w_cgrp tag remove g$g $lno.0 $lno_e
$w_line tag remove g$g $lno.0 $lno_e
$w_file tag remove g$g $lno.0 $lno_e
}
set line_commit($lno) $cmit
set line_file($lno) $file
+
+ $w_cgrp delete $lno.0 $lno_e
+ $w_cgrp insert $lno.0 "$abbr\n"
+
+ $w_cgrp tag add g$cmit $lno.0 $lno_e
$w_line tag add g$cmit $lno.0 $lno_e
$w_file tag add g$cmit $lno.0 $lno_e
set header($r_commit,$key) $data
}
}
+ $w_cgrp conf -state disabled
if {[eof $fd]} {
close $fd
if {$lno eq {}} return
set lno_e "$lno.0 + 1 line"
+
+ $w_cgrp tag remove in_sel 0.0 end
$w_line tag remove in_sel 0.0 end
$w_file tag remove in_sel 0.0 end
+
+ $w_cgrp tag add in_sel $lno.0 $lno_e
$w_line tag add in_sel $lno.0 $lno_e
$w_file tag add in_sel $lno.0 $lno_e
set i 0
foreach c $blame_colors {
set h [lindex $commit_list [expr {$idx - 1 + $i}]]
+ $w_cgrp tag conf g$h -background white
$w_line tag conf g$h -background white
$w_file tag conf g$h -background white
incr i
set i 0
foreach c $blame_colors {
set h [lindex $commit_list [expr {$idx - 1 + $i}]]
+ $w_cgrp tag conf g$h -background $c
$w_line tag conf g$h -background $c
$w_file tag conf g$h -background $c
incr i