Fossil SCM

Avoid division by zero on degenerate repositories when displaying percent done. Ticket [5be04d980c92f73fbc7]

drh 2010-10-29 18:06 trunk
Commit 067a90a903d5a72f4f28b94ce9ee65ead505f12b
2 files changed +3 -3 +1 -1
+3 -3
--- src/rebuild.c
+++ src/rebuild.c
@@ -106,11 +106,11 @@
106106
static void rebuild_step_done(rid){
107107
/* assert( bag_find(&bagDone, rid)==0 ); */
108108
bag_insert(&bagDone, rid);
109109
if( ttyOutput ){
110110
processCnt++;
111
- if (!g.fQuiet) {
111
+ if (!g.fQuiet && totalSize>0) {
112112
percent_complete((processCnt*1000)/totalSize);
113113
}
114114
}
115115
}
116116
@@ -324,16 +324,16 @@
324324
}
325325
}
326326
db_finalize(&s);
327327
manifest_crosslink_end();
328328
rebuild_tag_trunk();
329
- if (!g.fQuiet) {
329
+ if( !g.fQuiet && totalSize>0 ){
330330
processCnt += incrSize;
331331
percent_complete((processCnt*1000)/totalSize);
332332
}
333333
create_cluster();
334
- if (!g.fQuiet) {
334
+ if( !g.fQuiet && totalSize>0 ){
335335
processCnt += incrSize;
336336
percent_complete((processCnt*1000)/totalSize);
337337
}
338338
if(!g.fQuiet && ttyOutput ){
339339
printf("\n");
340340
--- src/rebuild.c
+++ src/rebuild.c
@@ -106,11 +106,11 @@
106 static void rebuild_step_done(rid){
107 /* assert( bag_find(&bagDone, rid)==0 ); */
108 bag_insert(&bagDone, rid);
109 if( ttyOutput ){
110 processCnt++;
111 if (!g.fQuiet) {
112 percent_complete((processCnt*1000)/totalSize);
113 }
114 }
115 }
116
@@ -324,16 +324,16 @@
324 }
325 }
326 db_finalize(&s);
327 manifest_crosslink_end();
328 rebuild_tag_trunk();
329 if (!g.fQuiet) {
330 processCnt += incrSize;
331 percent_complete((processCnt*1000)/totalSize);
332 }
333 create_cluster();
334 if (!g.fQuiet) {
335 processCnt += incrSize;
336 percent_complete((processCnt*1000)/totalSize);
337 }
338 if(!g.fQuiet && ttyOutput ){
339 printf("\n");
340
--- src/rebuild.c
+++ src/rebuild.c
@@ -106,11 +106,11 @@
106 static void rebuild_step_done(rid){
107 /* assert( bag_find(&bagDone, rid)==0 ); */
108 bag_insert(&bagDone, rid);
109 if( ttyOutput ){
110 processCnt++;
111 if (!g.fQuiet && totalSize>0) {
112 percent_complete((processCnt*1000)/totalSize);
113 }
114 }
115 }
116
@@ -324,16 +324,16 @@
324 }
325 }
326 db_finalize(&s);
327 manifest_crosslink_end();
328 rebuild_tag_trunk();
329 if( !g.fQuiet && totalSize>0 ){
330 processCnt += incrSize;
331 percent_complete((processCnt*1000)/totalSize);
332 }
333 create_cluster();
334 if( !g.fQuiet && totalSize>0 ){
335 processCnt += incrSize;
336 percent_complete((processCnt*1000)/totalSize);
337 }
338 if(!g.fQuiet && ttyOutput ){
339 printf("\n");
340
+1 -1
--- src/xfer.c
+++ src/xfer.c
@@ -1173,11 +1173,11 @@
11731173
}
11741174
continue;
11751175
}
11761176
xfer.nToken = blob_tokenize(&xfer.line, xfer.aToken, count(xfer.aToken));
11771177
nCardRcvd++;
1178
- if( !g.cgiOutput && !g.fQuiet ){
1178
+ if( !g.cgiOutput && !g.fQuiet && recv.nUsed>0 ){
11791179
pctDone = (recv.iCursor*100)/recv.nUsed;
11801180
if( pctDone!=lastPctDone ){
11811181
printf("\rprocessed: %d%% ", pctDone);
11821182
lastPctDone = pctDone;
11831183
fflush(stdout);
11841184
--- src/xfer.c
+++ src/xfer.c
@@ -1173,11 +1173,11 @@
1173 }
1174 continue;
1175 }
1176 xfer.nToken = blob_tokenize(&xfer.line, xfer.aToken, count(xfer.aToken));
1177 nCardRcvd++;
1178 if( !g.cgiOutput && !g.fQuiet ){
1179 pctDone = (recv.iCursor*100)/recv.nUsed;
1180 if( pctDone!=lastPctDone ){
1181 printf("\rprocessed: %d%% ", pctDone);
1182 lastPctDone = pctDone;
1183 fflush(stdout);
1184
--- src/xfer.c
+++ src/xfer.c
@@ -1173,11 +1173,11 @@
1173 }
1174 continue;
1175 }
1176 xfer.nToken = blob_tokenize(&xfer.line, xfer.aToken, count(xfer.aToken));
1177 nCardRcvd++;
1178 if( !g.cgiOutput && !g.fQuiet && recv.nUsed>0 ){
1179 pctDone = (recv.iCursor*100)/recv.nUsed;
1180 if( pctDone!=lastPctDone ){
1181 printf("\rprocessed: %d%% ", pctDone);
1182 lastPctDone = pctDone;
1183 fflush(stdout);
1184

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button