Skip to content

Commit 2b64f88

Browse files
author
Junio C Hamano
committed
Merge with gitk.
This merges commit b664550 from gitk into our head commit bf57030 Sincerely, jit-merge command.
2 parents bf57030 + b664550 commit 2b64f88

File tree

1 file changed

+25
-22
lines changed

1 file changed

+25
-22
lines changed

gitk

Lines changed: 25 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +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
34+
set ncmupdate 1
3535
if [catch {
3636
set parse_args [concat --default HEAD $rargs]
3737
set parsed_args [split [eval exec git-rev-parse $parse_args] "\n"]
@@ -62,7 +62,6 @@ proc getcommitlines {commfd} {
6262
global commits parents cdate children nchildren
6363
global commitlisted phase commitinfo nextupdate
6464
global stopped redisplaying leftover
65-
global numcommits ncmupdate
6665

6766
set stuff [read $commfd]
6867
if {$stuff == {}} {
@@ -110,10 +109,8 @@ to allow selection of commits to be displayed.)}
110109
set commitlisted($id) 1
111110
parsecommit $id $cmit 1
112111
drawcommit $id
113-
if {[clock clicks -milliseconds] >= $nextupdate
114-
&& $numcommits >= $ncmupdate + 100} {
115-
doupdate
116-
set ncmupdate $numcommits
112+
if {[clock clicks -milliseconds] >= $nextupdate} {
113+
doupdate 1
117114
}
118115
while {$redisplaying} {
119116
set redisplaying 0
@@ -123,24 +120,33 @@ to allow selection of commits to be displayed.)}
123120
foreach id $commits {
124121
drawcommit $id
125122
if {$stopped} break
126-
if {[clock clicks -milliseconds] >= $nextupdate
127-
&& $numcommits >= $ncmupdate + 100} {
128-
doupdate
129-
set ncmupdate $numcommits
123+
if {[clock clicks -milliseconds] >= $nextupdate} {
124+
doupdate 1
130125
}
131126
}
132127
}
133128
}
134129
}
135130
}
136131

137-
proc doupdate {} {
138-
global commfd nextupdate
132+
proc doupdate {reading} {
133+
global commfd nextupdate numcommits ncmupdate
139134

140-
incr nextupdate 100
141-
fileevent $commfd readable {}
135+
if {$reading} {
136+
fileevent $commfd readable {}
137+
}
142138
update
143-
fileevent $commfd readable [list getcommitlines $commfd]
139+
set nextupdate [expr {[clock clicks -milliseconds] + 100}]
140+
if {$numcommits < 100} {
141+
set ncmupdate [expr {$numcommits + 1}]
142+
} elseif {$numcommits < 10000} {
143+
set ncmupdate [expr {$numcommits + 10}]
144+
} else {
145+
set ncmupdate [expr {$numcommits + 100}]
146+
}
147+
if {$reading} {
148+
fileevent $commfd readable [list getcommitlines $commfd]
149+
}
144150
}
145151

146152
proc readcommit {id} {
@@ -1127,8 +1133,7 @@ proc drawcommit {id} {
11271133
}
11281134
if {[clock clicks -milliseconds] >= $nextupdate
11291135
&& $numcommits >= $ncmupdate} {
1130-
doupdate
1131-
set ncmupdate $numcommits
1136+
doupdate 1
11321137
if {$stopped} break
11331138
}
11341139
}
@@ -1171,7 +1176,7 @@ proc drawgraph {} {
11711176
if {$startcommits == {}} return
11721177
set startmsecs [clock clicks -milliseconds]
11731178
set nextupdate [expr $startmsecs + 100]
1174-
set ncmupdate 0
1179+
set ncmupdate 1
11751180
initgraph
11761181
set todo [lindex $startcommits 0]
11771182
drawrest 0 1
@@ -1210,10 +1215,8 @@ proc drawrest {level startix} {
12101215
drawslants $level
12111216
}
12121217
if {[clock clicks -milliseconds] >= $nextupdate
1213-
&& $numcommits >= $ncmupdate + 100} {
1214-
update
1215-
incr nextupdate 100
1216-
set ncmupdate $numcommits
1218+
&& $numcommits >= $ncmupdate} {
1219+
doupdate 0
12171220
}
12181221
}
12191222
}

0 commit comments

Comments
 (0)