summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 8c93917)
raw | patch | inline | side by side (parent: 8c93917)
author | Paul Mackerras <paulus@samba.org> | |
Mon, 9 Jul 2007 12:45:47 +0000 (22:45 +1000) | ||
committer | Paul Mackerras <paulus@samba.org> | |
Mon, 9 Jul 2007 12:45:47 +0000 (22:45 +1000) |
This is based on patches from Linus Torvalds and Junio Hamano, so the
ideas here are theirs.
This makes gitk use "git log -z --pretty=raw" instead of "git rev-list"
to generate the list of commits, and also makes it grok the "<" and ">"
markers that git log (and git rev-list) output with the --left-right
flag to indicate which side of a symmetric diff a commit is reachable
from. Left-side commits are drawn with a triangle pointing leftwards
instead of a circle, and right-side commits are drawn with a triangle
pointing rightwards. The commitlisted list is used to store the
left/right information as well as the information about whether each
commit is on the boundary.
Signed-off-by: Paul Mackerras <paulus@samba.org>
ideas here are theirs.
This makes gitk use "git log -z --pretty=raw" instead of "git rev-list"
to generate the list of commits, and also makes it grok the "<" and ">"
markers that git log (and git rev-list) output with the --left-right
flag to indicate which side of a symmetric diff a commit is reachable
from. Left-side commits are drawn with a triangle pointing leftwards
instead of a circle, and right-side commits are drawn with a triangle
pointing rightwards. The commitlisted list is used to store the
left/right information as well as the information about whether each
commit is on the boundary.
Signed-off-by: Paul Mackerras <paulus@samba.org>
gitk | patch | blob | history |
index ee818647c494d0b42902c2387c37af92d1e7b57b..468cf32228997f597f1fa1f5cb516da0e8512fa5 100755 (executable)
--- a/gitk
+++ b/gitk
set order "--date-order"
}
if {[catch {
- set fd [open [concat | git rev-list --header $order \
- --parents --boundary --default HEAD $args] r]
+ set fd [open [concat | git log -z --pretty=raw $order \
+ --parents --boundary $args] r]
} err]} {
puts stderr "Error executing git rev-list: $err"
exit 1
set j [string first "\n" $cmit]
set ok 0
set listed 1
- if {$j >= 0} {
- set ids [string range $cmit 0 [expr {$j - 1}]]
- if {[string range $ids 0 0] == "-"} {
- set listed 0
+ if {$j >= 0 && [string match "commit *" $cmit]} {
+ set ids [string range $cmit 7 [expr {$j - 1}]]
+ if {[string match {[-<>]*} $ids]} {
+ switch -- [string index $ids 0] {
+ "-" {set listed 0}
+ "<" {set listed 2}
+ ">" {set listed 3}
+ }
set ids [string range $ids 1 end]
}
set ok 1
if {[string length $shortcmit] > 80} {
set shortcmit "[string range $shortcmit 0 80]..."
}
- error_popup "Can't parse git rev-list output: {$shortcmit}"
+ error_popup "Can't parse git log output: {$shortcmit}"
exit 1
}
set id [lindex $ids 0]
}
proc drawcmittext {id row col} {
- global linespc canv canv2 canv3 canvy0 fgcolor
+ global linespc canv canv2 canv3 canvy0 fgcolor curview
global commitlisted commitinfo rowidlist parentlist
global rowtextx idpos idtags idheads idotherrefs
global linehtag linentag linedtag markingmatches
global mainfont canvxmax boldrows boldnamerows fgcolor nullid
+ # listed is 0 for boundary, 1 for normal, 2 for left, 3 for right
+ set listed [lindex $commitlisted $row]
if {$id eq $nullid} {
set ofill red
} else {
- set ofill [expr {[lindex $commitlisted $row]? "blue": "white"}]
+ set ofill [expr {$listed != 0? "blue": "white"}]
}
set x [xc $row $col]
set y [yc $row]
set orad [expr {$linespc / 3}]
- set t [$canv create oval [expr {$x - $orad}] [expr {$y - $orad}] \
- [expr {$x + $orad - 1}] [expr {$y + $orad - 1}] \
- -fill $ofill -outline $fgcolor -width 1 -tags circle]
+ if {$listed <= 1} {
+ set t [$canv create oval [expr {$x - $orad}] [expr {$y - $orad}] \
+ [expr {$x + $orad - 1}] [expr {$y + $orad - 1}] \
+ -fill $ofill -outline $fgcolor -width 1 -tags circle]
+ } elseif {$listed == 2} {
+ # triangle pointing left for left-side commits
+ set t [$canv create polygon \
+ [expr {$x - $orad}] $y \
+ [expr {$x + $orad - 1}] [expr {$y - $orad}] \
+ [expr {$x + $orad - 1}] [expr {$y + $orad - 1}] \
+ -fill $ofill -outline $fgcolor -width 1 -tags circle]
+ } else {
+ # triangle pointing right for right-side commits
+ set t [$canv create polygon \
+ [expr {$x + $orad - 1}] $y \
+ [expr {$x - $orad}] [expr {$y - $orad}] \
+ [expr {$x - $orad}] [expr {$y + $orad - 1}] \
+ -fill $ofill -outline $fgcolor -width 1 -tags circle]
+ }
$canv raise $t
$canv bind $t <1> {selcanvline {} %x %y}
set rmx [llength [lindex $rowidlist $row]]