Diff
Not logged in

Differences From:

File src/rebuild.c part of check-in [70d5cc86b7] - Add the shun table. Do not process artifacts named in the shun table. by drh on 2007-10-05 13:47:00. [view]

To:

File src/rebuild.c part of check-in [e38fc922a5] - Remove unused hard-coded tags from the schema. Output a row count as a status indicator when doing a rebuild. by drh on 2007-10-11 01:17:20. [view]

@@ -38,12 +38,13 @@
 ** extracted in a random order.  This feature is used to test the
 ** ability of fossil to accept records in any order and still
 ** construct a sane repository.
 */
-int rebuild_db(int randomize){
+int rebuild_db(int randomize, int ttyOutput){
   Stmt s;
   int errCnt = 0;
   char *zTable;
+  int cnt = 0;
 
   db_multi_exec(
     "CREATE INDEX IF NOT EXISTS delta_i1 ON delta(srcid);"
     "CREATE TABLE IF NOT EXISTS shun(uuid UNIQUE);"
@@ -76,14 +77,23 @@
     int rid = db_column_int(&s, 0);
     int size = db_column_int(&s, 1);
     if( size>=0 ){
       Blob content;
+      if( ttyOutput ){
+        cnt++;
+        printf("%d...\r", cnt);
+        fflush(stdout);
+      }
       content_get(rid, &content);
       manifest_crosslink(rid, &content);
       blob_reset(&content);
     }else{
       db_multi_exec("INSERT OR IGNORE INTO phantom VALUES(%d)", rid);
     }
+  }
+  db_finalize(&s);
+  if( ttyOutput ){
+    printf("\n");
   }
   return errCnt;
 }
 
@@ -107,9 +117,9 @@
     usage("REPOSITORY-FILENAME");
   }
   db_open_repository(g.argv[2]);
   db_begin_transaction();
-  errCnt = rebuild_db(randomizeFlag);
+  errCnt = rebuild_db(randomizeFlag, 1);
   if( errCnt && !forceFlag ){
     printf("%d errors. Rolling back changes. Use --force to force a commit.\n",
             errCnt);
     db_end_transaction(1);