@@ -18,7 +18,7 @@ proc gitdir {} {
18
18
19
19
proc getcommits {rargs} {
20
20
global commits commfd phase canv mainfont env
21
- global startmsecs nextupdate
21
+ global startmsecs nextupdate ncmupdate
22
22
global ctext maincursor textcursor leftover
23
23
24
24
# check that we can find a .git directory somewhere...
@@ -31,6 +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
35
if [catch {
35
36
set parse_args [concat --default HEAD $rargs ]
36
37
set parsed_args [split [eval exec git-rev-parse $parse_args ] " \n " ]
@@ -49,7 +50,7 @@ proc getcommits {rargs} {
49
50
}
50
51
set leftover {}
51
52
fconfigure $commfd -blocking 0 -translation lf
52
- fileevent $commfd readable " getcommitlines $commfd "
53
+ fileevent $commfd readable [ list getcommitlines $commfd ]
53
54
$canv delete all
54
55
$canv create text 3 3 -anchor nw -text " Reading commits..." \
55
56
-font $mainfont -tags textitems
@@ -61,6 +62,7 @@ proc getcommitlines {commfd} {
61
62
global commits parents cdate children nchildren
62
63
global commitlisted phase commitinfo nextupdate
63
64
global stopped redisplaying leftover
65
+ global numcommits ncmupdate
64
66
65
67
set stuff [read $commfd ]
66
68
if {$stuff == {}} {
@@ -108,8 +110,10 @@ to allow selection of commits to be displayed.)}
108
110
set commitlisted($id ) 1
109
111
parsecommit $id $cmit 1
110
112
drawcommit $id
111
- if {[clock clicks -milliseconds] >= $nextupdate } {
113
+ if {[clock clicks -milliseconds] >= $nextupdate
114
+ && $numcommits >= $ncmupdate + 100} {
112
115
doupdate
116
+ set ncmupdate $numcommits
113
117
}
114
118
while {$redisplaying } {
115
119
set redisplaying 0
@@ -119,8 +123,10 @@ to allow selection of commits to be displayed.)}
119
123
foreach id $commits {
120
124
drawcommit $id
121
125
if {$stopped } break
122
- if {[clock clicks -milliseconds] >= $nextupdate } {
126
+ if {[clock clicks -milliseconds] >= $nextupdate
127
+ && $numcommits >= $ncmupdate + 100} {
123
128
doupdate
129
+ set ncmupdate $numcommits
124
130
}
125
131
}
126
132
}
@@ -134,7 +140,7 @@ proc doupdate {} {
134
140
incr nextupdate 100
135
141
fileevent $commfd readable {}
136
142
update
137
- fileevent $commfd readable " getcommitlines $commfd "
143
+ fileevent $commfd readable [ list getcommitlines $commfd ]
138
144
}
139
145
140
146
proc readcommit {id} {
@@ -1090,7 +1096,7 @@ proc decidenext {{noread 0}} {
1090
1096
1091
1097
proc drawcommit {id} {
1092
1098
global phase todo nchildren datemode nextupdate
1093
- global startcommits
1099
+ global startcommits numcommits ncmupdate
1094
1100
1095
1101
if {$phase != " incrdraw" } {
1096
1102
set phase incrdraw
@@ -1119,8 +1125,10 @@ proc drawcommit {id} {
1119
1125
if {![info exists commitlisted($id )]} {
1120
1126
break
1121
1127
}
1122
- if {[clock clicks -milliseconds] >= $nextupdate } {
1128
+ if {[clock clicks -milliseconds] >= $nextupdate
1129
+ && $numcommits >= $ncmupdate } {
1123
1130
doupdate
1131
+ set ncmupdate $numcommits
1124
1132
if {$stopped } break
1125
1133
}
1126
1134
}
@@ -1158,11 +1166,12 @@ proc settextcursor {c} {
1158
1166
}
1159
1167
1160
1168
proc drawgraph {} {
1161
- global nextupdate startmsecs startcommits todo
1169
+ global nextupdate startmsecs startcommits todo ncmupdate
1162
1170
1163
1171
if {$startcommits == {}} return
1164
1172
set startmsecs [clock clicks -milliseconds]
1165
1173
set nextupdate [expr $startmsecs + 100]
1174
+ set ncmupdate 0
1166
1175
initgraph
1167
1176
set todo [lindex $startcommits 0]
1168
1177
drawrest 0 1
@@ -1171,7 +1180,7 @@ proc drawgraph {} {
1171
1180
proc drawrest {level startix} {
1172
1181
global phase stopped redisplaying selectedline
1173
1182
global datemode currentparents todo
1174
- global numcommits
1183
+ global numcommits ncmupdate
1175
1184
global nextupdate startmsecs startcommits idline
1176
1185
1177
1186
if {$level >= 0} {
@@ -1200,9 +1209,11 @@ proc drawrest {level startix} {
1200
1209
if {$level < 0} break
1201
1210
drawslants $level
1202
1211
}
1203
- if {[clock clicks -milliseconds] >= $nextupdate } {
1212
+ if {[clock clicks -milliseconds] >= $nextupdate
1213
+ && $numcommits >= $ncmupdate + 100} {
1204
1214
update
1205
1215
incr nextupdate 100
1216
+ set ncmupdate $numcommits
1206
1217
}
1207
1218
}
1208
1219
}
0 commit comments