Skip to content

Commit e8c8063

Browse files
author
Junio C Hamano
committed
Merge with gitk.
This merges commit 466e4fd from gitk into our head commit ef0bd2e Sincerely, jit-merge command.
2 parents ef0bd2e + 466e4fd commit e8c8063

File tree

1 file changed

+21
-10
lines changed

1 file changed

+21
-10
lines changed

gitk

Lines changed: 21 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ proc gitdir {} {
1818

1919
proc getcommits {rargs} {
2020
global commits commfd phase canv mainfont env
21-
global startmsecs nextupdate
21+
global startmsecs nextupdate ncmupdate
2222
global ctext maincursor textcursor leftover
2323

2424
# check that we can find a .git directory somewhere...
@@ -31,6 +31,7 @@ proc getcommits {rargs} {
3131
set phase getcommits
3232
set startmsecs [clock clicks -milliseconds]
3333
set nextupdate [expr $startmsecs + 100]
34+
set ncmupdate 0
3435
if [catch {
3536
set parse_args [concat --default HEAD $rargs]
3637
set parsed_args [split [eval exec git-rev-parse $parse_args] "\n"]
@@ -49,7 +50,7 @@ proc getcommits {rargs} {
4950
}
5051
set leftover {}
5152
fconfigure $commfd -blocking 0 -translation lf
52-
fileevent $commfd readable "getcommitlines $commfd"
53+
fileevent $commfd readable [list getcommitlines $commfd]
5354
$canv delete all
5455
$canv create text 3 3 -anchor nw -text "Reading commits..." \
5556
-font $mainfont -tags textitems
@@ -61,6 +62,7 @@ proc getcommitlines {commfd} {
6162
global commits parents cdate children nchildren
6263
global commitlisted phase commitinfo nextupdate
6364
global stopped redisplaying leftover
65+
global numcommits ncmupdate
6466

6567
set stuff [read $commfd]
6668
if {$stuff == {}} {
@@ -108,8 +110,10 @@ to allow selection of commits to be displayed.)}
108110
set commitlisted($id) 1
109111
parsecommit $id $cmit 1
110112
drawcommit $id
111-
if {[clock clicks -milliseconds] >= $nextupdate} {
113+
if {[clock clicks -milliseconds] >= $nextupdate
114+
&& $numcommits >= $ncmupdate + 100} {
112115
doupdate
116+
set ncmupdate $numcommits
113117
}
114118
while {$redisplaying} {
115119
set redisplaying 0
@@ -119,8 +123,10 @@ to allow selection of commits to be displayed.)}
119123
foreach id $commits {
120124
drawcommit $id
121125
if {$stopped} break
122-
if {[clock clicks -milliseconds] >= $nextupdate} {
126+
if {[clock clicks -milliseconds] >= $nextupdate
127+
&& $numcommits >= $ncmupdate + 100} {
123128
doupdate
129+
set ncmupdate $numcommits
124130
}
125131
}
126132
}
@@ -134,7 +140,7 @@ proc doupdate {} {
134140
incr nextupdate 100
135141
fileevent $commfd readable {}
136142
update
137-
fileevent $commfd readable "getcommitlines $commfd"
143+
fileevent $commfd readable [list getcommitlines $commfd]
138144
}
139145

140146
proc readcommit {id} {
@@ -1090,7 +1096,7 @@ proc decidenext {{noread 0}} {
10901096

10911097
proc drawcommit {id} {
10921098
global phase todo nchildren datemode nextupdate
1093-
global startcommits
1099+
global startcommits numcommits ncmupdate
10941100

10951101
if {$phase != "incrdraw"} {
10961102
set phase incrdraw
@@ -1119,8 +1125,10 @@ proc drawcommit {id} {
11191125
if {![info exists commitlisted($id)]} {
11201126
break
11211127
}
1122-
if {[clock clicks -milliseconds] >= $nextupdate} {
1128+
if {[clock clicks -milliseconds] >= $nextupdate
1129+
&& $numcommits >= $ncmupdate} {
11231130
doupdate
1131+
set ncmupdate $numcommits
11241132
if {$stopped} break
11251133
}
11261134
}
@@ -1158,11 +1166,12 @@ proc settextcursor {c} {
11581166
}
11591167

11601168
proc drawgraph {} {
1161-
global nextupdate startmsecs startcommits todo
1169+
global nextupdate startmsecs startcommits todo ncmupdate
11621170

11631171
if {$startcommits == {}} return
11641172
set startmsecs [clock clicks -milliseconds]
11651173
set nextupdate [expr $startmsecs + 100]
1174+
set ncmupdate 0
11661175
initgraph
11671176
set todo [lindex $startcommits 0]
11681177
drawrest 0 1
@@ -1171,7 +1180,7 @@ proc drawgraph {} {
11711180
proc drawrest {level startix} {
11721181
global phase stopped redisplaying selectedline
11731182
global datemode currentparents todo
1174-
global numcommits
1183+
global numcommits ncmupdate
11751184
global nextupdate startmsecs startcommits idline
11761185

11771186
if {$level >= 0} {
@@ -1200,9 +1209,11 @@ proc drawrest {level startix} {
12001209
if {$level < 0} break
12011210
drawslants $level
12021211
}
1203-
if {[clock clicks -milliseconds] >= $nextupdate} {
1212+
if {[clock clicks -milliseconds] >= $nextupdate
1213+
&& $numcommits >= $ncmupdate + 100} {
12041214
update
12051215
incr nextupdate 100
1216+
set ncmupdate $numcommits
12061217
}
12071218
}
12081219
}

0 commit comments

Comments
 (0)