summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 1db95b0)
raw | patch | inline | side by side (parent: 1db95b0)
author | Paul Mackerras <paulus@samba.org> | |
Tue, 10 May 2005 00:23:42 +0000 (00:23 +0000) | ||
committer | Paul Mackerras <paulus@samba.org> | |
Tue, 10 May 2005 00:23:42 +0000 (00:23 +0000) |
Make it cope with commits having parents that aren't listed.
gitk | patch | blob | history |
index 90b2eab355c02fe718e1583881d61274b13b0b6a..801afbca7a988ee64b559454e2bb1bf69a2c696e 100755 (executable)
--- a/gitk
+++ b/gitk
# and distributed under the terms of the GNU General Public Licence,
# either version 2, or (at your option) any later version.
+# CVS $Revision: 1.2 $
+
set datemode 0
set boldnames 0
set revtreeargs {}
}
proc readcommit {id} {
- global commitinfo
+ global commitinfo commitsummary
set inhdr 1
set comment {}
set headline {}
set comdate [clock format $comdate -format "%Y-%m-%d %H:%M:%S"]
}
set commitinfo($id) [list $comment $auname $audate $comname $comdate]
- return [list $headline $auname $audate]
+ set commitsummary($id) [list $headline $auname $audate]
}
proc makewindow {} {
global canv linespc charspc ctext
- frame .clist
- set canv .clist.canv
+ panedwindow .ctop -orient vertical
+ frame .ctop.clist
+ set canv .ctop.clist.canv
canvas $canv -height [expr 30 * $linespc + 4] -width [expr 90 * $charspc] \
-bg white -relief sunk -bd 1 \
- -yscrollincr $linespc -yscrollcommand ".clist.csb set"
- scrollbar .clist.csb -command "$canv yview" -highlightthickness 0
- pack .clist.csb -side right -fill y
+ -yscrollincr $linespc -yscrollcommand ".ctop.clist.csb set"
+ scrollbar .ctop.clist.csb -command "$canv yview" -highlightthickness 0
+ pack .ctop.clist.csb -side right -fill y
pack $canv -side bottom -fill both -expand 1
- pack .clist -side top -fill both -expand 1
- set ctext .ctext
+ .ctop add .ctop.clist
+ #pack .ctop.clist -side top -fill both -expand 1
+ set ctext .ctop.ctext
text $ctext -bg white
- pack $ctext -side top -fill x -expand 1
+ .ctop add .ctop.ctext
+ #pack $ctext -side top -fill x -expand 1
+ pack .ctop -side top -fill both -expand 1
bind $canv <1> {selcanvline %x %y}
bind $canv <B1-Motion> {selcanvline %x %y}
global parents children nparents nchildren commits
global canv mainfont namefont canvx0 canvy0 linespc namex datex
global datemode cdate
- global lineid linehtag linentag linedtag
+ global lineid linehtag linentag linedtag commitsummary
set colors {green red blue magenta darkgrey brown orange}
set ncolors [llength $colors]
set nlines [llength $todo]
set id [lindex $todo $level]
set lineid($lineno) $id
+ set actualparents {}
foreach p $parents($id) {
- incr ncleft($p) -1
+ if {[info exists ncleft($p)]} {
+ incr ncleft($p) -1
+ lappend actualparents $p
+ }
+ }
+ if {![info exists commitsummary($id)]} {
+ readcommit $id
}
- set cinfo [readcommit $id]
set x [expr $canvx0 + $level * $linespc]
set y2 [expr $canvy + $linespc]
if {$linestarty($level) < $canvy} {
-fill blue -outline black -width 1]
$canv raise $t
set xt [expr $canvx0 + $nlines * $linespc]
- set headline [lindex $cinfo 0]
- set name [lindex $cinfo 1]
- set date [lindex $cinfo 2]
+ set headline [lindex $commitsummary($id) 0]
+ set name [lindex $commitsummary($id) 1]
+ set date [lindex $commitsummary($id) 2]
set headline [truncatetofit $headline [expr $namex-$xt-$linespc] \
$mainfont]
set linehtag($lineno) [$canv create text $xt $canvy -anchor w \
-text $name -font $namefont]
set linedtag($lineno) [$canv create text $datex $canvy -anchor w \
-text $date -font $mainfont]
- if {!$datemode && $nparents($id) == 1} {
- set p [lindex $parents($id) 0]
+ if {!$datemode && [llength $actualparents] == 1} {
+ set p [lindex $actualparents 0]
if {$ncleft($p) == 0 && [lsearch -exact $todo $p] < 0} {
set todo [lreplace $todo $level $level $p]
set colormap($p) $colormap($id)
}
set badcolors [list $colormap($id)]
- foreach p $parents($id) {
+ foreach p $actualparents {
if {[info exists colormap($p)]} {
lappend badcolors $colormap($p)
}
incr nullentry -1
}
set i $level
- foreach p $parents($id) {
+ foreach p $actualparents {
set k [lsearch -exact $todo $p]
if {$k < 0} {
set todo [linsert $todo $i $p]