X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=gitk;h=6dc4b24f060e790d46b19f3510fee1e507057960;hb=b664550c066810b770ad3e19cafe2fbdd42c6793;hp=edf94bf4c46570245feaf87fa64f94eab72aec1c;hpb=fa4da7b32e1197fa5032db6a2de7749868253f8b;p=git.git diff --git a/gitk b/gitk index edf94bf4..6dc4b24f 100755 --- a/gitk +++ b/gitk @@ -18,7 +18,7 @@ proc gitdir {} { proc getcommits {rargs} { global commits commfd phase canv mainfont env - global startmsecs nextupdate + global startmsecs nextupdate ncmupdate global ctext maincursor textcursor leftover # check that we can find a .git directory somewhere... @@ -31,6 +31,7 @@ proc getcommits {rargs} { set phase getcommits set startmsecs [clock clicks -milliseconds] set nextupdate [expr $startmsecs + 100] + set ncmupdate 1 if [catch { set parse_args [concat --default HEAD $rargs] set parsed_args [split [eval exec git-rev-parse $parse_args] "\n"] @@ -49,7 +50,7 @@ proc getcommits {rargs} { } set leftover {} fconfigure $commfd -blocking 0 -translation lf - fileevent $commfd readable "getcommitlines $commfd" + fileevent $commfd readable [list getcommitlines $commfd] $canv delete all $canv create text 3 3 -anchor nw -text "Reading commits..." \ -font $mainfont -tags textitems @@ -109,7 +110,7 @@ to allow selection of commits to be displayed.)} parsecommit $id $cmit 1 drawcommit $id if {[clock clicks -milliseconds] >= $nextupdate} { - doupdate + doupdate 1 } while {$redisplaying} { set redisplaying 0 @@ -120,7 +121,7 @@ to allow selection of commits to be displayed.)} drawcommit $id if {$stopped} break if {[clock clicks -milliseconds] >= $nextupdate} { - doupdate + doupdate 1 } } } @@ -128,13 +129,24 @@ to allow selection of commits to be displayed.)} } } -proc doupdate {} { - global commfd nextupdate +proc doupdate {reading} { + global commfd nextupdate numcommits ncmupdate - incr nextupdate 100 - fileevent $commfd readable {} + if {$reading} { + fileevent $commfd readable {} + } update - fileevent $commfd readable "getcommitlines $commfd" + set nextupdate [expr {[clock clicks -milliseconds] + 100}] + if {$numcommits < 100} { + set ncmupdate [expr {$numcommits + 1}] + } elseif {$numcommits < 10000} { + set ncmupdate [expr {$numcommits + 10}] + } else { + set ncmupdate [expr {$numcommits + 100}] + } + if {$reading} { + fileevent $commfd readable [list getcommitlines $commfd] + } } proc readcommit {id} { @@ -387,7 +399,7 @@ proc makewindow {} { set ctext .ctop.cdet.left.ctext text $ctext -bg white -state disabled -font $textfont \ -width $geometry(ctextw) -height $geometry(ctexth) \ - -yscrollcommand ".ctop.cdet.left.sb set" + -yscrollcommand ".ctop.cdet.left.sb set" -wrap none scrollbar .ctop.cdet.left.sb -command "$ctext yview" pack .ctop.cdet.left.sb -side right -fill y pack $ctext -side left -fill both -expand 1 @@ -1090,7 +1102,7 @@ proc decidenext {{noread 0}} { proc drawcommit {id} { global phase todo nchildren datemode nextupdate - global startcommits + global startcommits numcommits ncmupdate if {$phase != "incrdraw"} { set phase incrdraw @@ -1119,8 +1131,9 @@ proc drawcommit {id} { if {![info exists commitlisted($id)]} { break } - if {[clock clicks -milliseconds] >= $nextupdate} { - doupdate + if {[clock clicks -milliseconds] >= $nextupdate + && $numcommits >= $ncmupdate} { + doupdate 1 if {$stopped} break } } @@ -1158,11 +1171,12 @@ proc settextcursor {c} { } proc drawgraph {} { - global nextupdate startmsecs startcommits todo + global nextupdate startmsecs startcommits todo ncmupdate if {$startcommits == {}} return set startmsecs [clock clicks -milliseconds] set nextupdate [expr $startmsecs + 100] + set ncmupdate 1 initgraph set todo [lindex $startcommits 0] drawrest 0 1 @@ -1171,7 +1185,7 @@ proc drawgraph {} { proc drawrest {level startix} { global phase stopped redisplaying selectedline global datemode currentparents todo - global numcommits + global numcommits ncmupdate global nextupdate startmsecs startcommits idline if {$level >= 0} { @@ -1200,9 +1214,9 @@ proc drawrest {level startix} { if {$level < 0} break drawslants $level } - if {[clock clicks -milliseconds] >= $nextupdate} { - update - incr nextupdate 100 + if {[clock clicks -milliseconds] >= $nextupdate + && $numcommits >= $ncmupdate} { + doupdate 0 } } } @@ -1704,10 +1718,19 @@ proc selcanvline {w x y} { selectline $l 1 } +proc commit_descriptor {p} { + global commitinfo + set l "..." + if {[info exists commitinfo($p)]} { + set l [lindex $commitinfo($p) 0] + } + return "$p ($l)" +} + proc selectline {l isnew} { global canv canv2 canv3 ctext commitinfo selectedline global lineid linehtag linentag linedtag - global canvy0 linespc parents nparents + global canvy0 linespc parents nparents children nchildren global cflist currentid sha1entry global commentend idtags idline @@ -1790,15 +1813,15 @@ proc selectline {l isnew} { set commentstart [$ctext index "end - 1c"] set comment {} - foreach p $parents($id) { - set l "..." - if {[info exists commitinfo($p)]} { - set l [lindex $commitinfo($p) 0] - if {[string length $l] > 32} { - set l "[string range $l 0 28] ..." - } + if {[info exists parents($id)]} { + foreach p $parents($id) { + append comment "Parent: [commit_descriptor $p]\n" + } + } + if {[info exists children($id)]} { + foreach c $children($id) { + append comment "Child: [commit_descriptor $c]\n" } - append comment "Parent: $p ($l)\n" } append comment "\n" append comment [lindex $info 5]