summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: ddc1fa8)
raw | patch | inline | side by side (parent: ddc1fa8)
author | Shawn O. Pearce <spearce@spearce.org> | |
Fri, 1 Jun 2007 20:10:56 +0000 (16:10 -0400) | ||
committer | Shawn O. Pearce <spearce@spearce.org> | |
Wed, 6 Jun 2007 05:26:46 +0000 (01:26 -0400) |
Frequently when I'm looking at blocks of code in the blame
viewer I want to know who is the culprit, or who I should
be praising for a job well done. The tooltips nicely show
this if I mouse over a block, but it doesn't work to get
this detail at a glance.
Since we don't use the leftmost commit column for anything
after the first line within a commit group I'm now tossing
the author's initials into that field, right justified. It
is quite clearly not a SHA-1 number as we always show the
SHA-1 in lowercase, while we explicitly select only the
uppercase characters from an author's name field, and only
those that are following whitespace.
I'm using initials here over anything else as they are quite
commonly unique within small development teams. The leading
part of the email address field was out for some of the teams
I work with, as there the email addresses are all of the form
"Givenname.Surname@initech.com". That will never fit into the
4 characters available.
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
viewer I want to know who is the culprit, or who I should
be praising for a job well done. The tooltips nicely show
this if I mouse over a block, but it doesn't work to get
this detail at a glance.
Since we don't use the leftmost commit column for anything
after the first line within a commit group I'm now tossing
the author's initials into that field, right justified. It
is quite clearly not a SHA-1 number as we always show the
SHA-1 in lowercase, while we explicitly select only the
uppercase characters from an author's name field, and only
those that are following whitespace.
I'm using initials here over anything else as they are quite
commonly unique within small development teams. The leading
part of the email address field was out for some of the teams
I work with, as there the email addresses are all of the form
"Givenname.Surname@initech.com". That will never fit into the
4 characters available.
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 93693d099a0957bdfd9619291e00a6f48fa46ca1..02e439cbc6a2c6aec238d1eb656ce26c594cbb3f 100644 (file)
--- a/lib/blame.tcl
+++ b/lib/blame.tcl
set cmit $r_commit
if {[regexp {^0{40}$} $cmit]} {
- set abbr work
+ set commit_abbr work
} else {
- set abbr [string range $cmit 0 4]
+ set commit_abbr [string range $cmit 0 4]
}
- if {![catch {set ncmit $line_commit([expr {$lno - 1}])}]} {
- if {$ncmit eq $cmit} {
- set abbr { |}
+ set author_abbr {}
+ set a_name {}
+ catch {set a_name $header($cmit,author)}
+ while {$a_name ne {}} {
+ if {![regexp {^([[:upper:]])} $a_name _a]} break
+ append author_abbr $_a
+ unset _a
+ if {![regsub \
+ {^[[:upper:]][^\s]*\s+} \
+ $a_name {} a_name ]} break
+ }
+ if {$author_abbr eq {}} {
+ set author_abbr { |}
+ } else {
+ set author_abbr [string range $author_abbr 0 3]
+ while {[string length $author_abbr] < 4} {
+ set author_abbr " $author_abbr"
}
}
+ unset a_name
+
+ set first_lno $lno
+ while {
+ ![catch {set ncmit $line_commit([expr {$first_lno - 1}])}]
+ && $ncmit eq $cmit
+ } {
+ incr first_lno -1
+ }
while {$n > 0} {
set lno_e "$lno.0 lineend + 1c"
set line_file($lno) $file
$w_cgrp delete $lno.0 "$lno.0 lineend"
- $w_cgrp insert $lno.0 $abbr
- set abbr { |}
+ if {$lno == $first_lno} {
+ $w_cgrp insert $lno.0 $commit_abbr
+ } elseif {$lno == [expr {$first_lno + 1}]} {
+ $w_cgrp insert $lno.0 $author_abbr
+ } else {
+ $w_cgrp insert $lno.0 { |}
+ }
$w_cgrp tag add g$cmit $lno.0 $lno_e
$w_line tag add g$cmit $lno.0 $lno_e
incr blame_lines
}
- if {![catch {set ncmit $line_commit($lno)}]} {
- if {$ncmit eq $cmit} {
- $w_cgrp delete $lno.0 "$lno.0 lineend + 1c"
- $w_cgrp insert $lno.0 " |\n"
+ while {![catch {set ncmit $line_commit($lno)}]
+ && $ncmit eq $cmit} {
+ $w_cgrp delete $lno.0 "$lno.0 lineend"
+
+ if {$lno == $first_lno} {
+ $w_cgrp insert $lno.0 $commit_abbr
+ } elseif {$lno == [expr {$first_lno + 1}]} {
+ $w_cgrp insert $lno.0 $author_abbr
+ } else {
+ $w_cgrp insert $lno.0 { |}
}
+ incr lno
}
+
} elseif {[regexp {^([a-z-]+) (.*)$} $line line key data]} {
set header($r_commit,$key) $data
}