Fossil SCM
Avoid division by zero on degenerate repositories when displaying percent done. Ticket [5be04d980c92f73fbc7]
Commit
067a90a903d5a72f4f28b94ce9ee65ead505f12b
Parent
d03718ad5fd9ba4…
2 files changed
+3
-3
+1
-1
+3
-3
| --- src/rebuild.c | ||
| +++ src/rebuild.c | ||
| @@ -106,11 +106,11 @@ | ||
| 106 | 106 | static void rebuild_step_done(rid){ |
| 107 | 107 | /* assert( bag_find(&bagDone, rid)==0 ); */ |
| 108 | 108 | bag_insert(&bagDone, rid); |
| 109 | 109 | if( ttyOutput ){ |
| 110 | 110 | processCnt++; |
| 111 | - if (!g.fQuiet) { | |
| 111 | + if (!g.fQuiet && totalSize>0) { | |
| 112 | 112 | percent_complete((processCnt*1000)/totalSize); |
| 113 | 113 | } |
| 114 | 114 | } |
| 115 | 115 | } |
| 116 | 116 | |
| @@ -324,16 +324,16 @@ | ||
| 324 | 324 | } |
| 325 | 325 | } |
| 326 | 326 | db_finalize(&s); |
| 327 | 327 | manifest_crosslink_end(); |
| 328 | 328 | rebuild_tag_trunk(); |
| 329 | - if (!g.fQuiet) { | |
| 329 | + if( !g.fQuiet && totalSize>0 ){ | |
| 330 | 330 | processCnt += incrSize; |
| 331 | 331 | percent_complete((processCnt*1000)/totalSize); |
| 332 | 332 | } |
| 333 | 333 | create_cluster(); |
| 334 | - if (!g.fQuiet) { | |
| 334 | + if( !g.fQuiet && totalSize>0 ){ | |
| 335 | 335 | processCnt += incrSize; |
| 336 | 336 | percent_complete((processCnt*1000)/totalSize); |
| 337 | 337 | } |
| 338 | 338 | if(!g.fQuiet && ttyOutput ){ |
| 339 | 339 | printf("\n"); |
| 340 | 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) { |
| 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 @@ | ||
| 1173 | 1173 | } |
| 1174 | 1174 | continue; |
| 1175 | 1175 | } |
| 1176 | 1176 | xfer.nToken = blob_tokenize(&xfer.line, xfer.aToken, count(xfer.aToken)); |
| 1177 | 1177 | nCardRcvd++; |
| 1178 | - if( !g.cgiOutput && !g.fQuiet ){ | |
| 1178 | + if( !g.cgiOutput && !g.fQuiet && recv.nUsed>0 ){ | |
| 1179 | 1179 | pctDone = (recv.iCursor*100)/recv.nUsed; |
| 1180 | 1180 | if( pctDone!=lastPctDone ){ |
| 1181 | 1181 | printf("\rprocessed: %d%% ", pctDone); |
| 1182 | 1182 | lastPctDone = pctDone; |
| 1183 | 1183 | fflush(stdout); |
| 1184 | 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 ){ |
| 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 |