@@ -31,7 +31,7 @@ proc getcommits {rargs} {
31
31
set phase getcommits
32
32
set startmsecs [clock clicks -milliseconds]
33
33
set nextupdate [expr $startmsecs + 100]
34
- set ncmupdate 0
34
+ set ncmupdate 1
35
35
if [catch {
36
36
set parse_args [concat --default HEAD $rargs ]
37
37
set parsed_args [split [eval exec git-rev-parse $parse_args ] " \n " ]
@@ -62,7 +62,6 @@ proc getcommitlines {commfd} {
62
62
global commits parents cdate children nchildren
63
63
global commitlisted phase commitinfo nextupdate
64
64
global stopped redisplaying leftover
65
- global numcommits ncmupdate
66
65
67
66
set stuff [read $commfd ]
68
67
if {$stuff == {}} {
@@ -110,10 +109,8 @@ to allow selection of commits to be displayed.)}
110
109
set commitlisted($id ) 1
111
110
parsecommit $id $cmit 1
112
111
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
117
114
}
118
115
while {$redisplaying } {
119
116
set redisplaying 0
@@ -123,24 +120,33 @@ to allow selection of commits to be displayed.)}
123
120
foreach id $commits {
124
121
drawcommit $id
125
122
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
130
125
}
131
126
}
132
127
}
133
128
}
134
129
}
135
130
}
136
131
137
- proc doupdate {} {
138
- global commfd nextupdate
132
+ proc doupdate {reading } {
133
+ global commfd nextupdate numcommits ncmupdate
139
134
140
- incr nextupdate 100
141
- fileevent $commfd readable {}
135
+ if {$reading } {
136
+ fileevent $commfd readable {}
137
+ }
142
138
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
+ }
144
150
}
145
151
146
152
proc readcommit {id} {
@@ -1127,8 +1133,7 @@ proc drawcommit {id} {
1127
1133
}
1128
1134
if {[clock clicks -milliseconds] >= $nextupdate
1129
1135
&& $numcommits >= $ncmupdate } {
1130
- doupdate
1131
- set ncmupdate $numcommits
1136
+ doupdate 1
1132
1137
if {$stopped } break
1133
1138
}
1134
1139
}
@@ -1171,7 +1176,7 @@ proc drawgraph {} {
1171
1176
if {$startcommits == {}} return
1172
1177
set startmsecs [clock clicks -milliseconds]
1173
1178
set nextupdate [expr $startmsecs + 100]
1174
- set ncmupdate 0
1179
+ set ncmupdate 1
1175
1180
initgraph
1176
1181
set todo [lindex $startcommits 0]
1177
1182
drawrest 0 1
@@ -1210,10 +1215,8 @@ proc drawrest {level startix} {
1210
1215
drawslants $level
1211
1216
}
1212
1217
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
1217
1220
}
1218
1221
}
1219
1222
}
0 commit comments