Diff
Not logged in

Differences From:

File src/rebuild.c part of check-in [42c2a18e73] - Change the way branches are tagged: The value of the "branch" property is used to identify the branch name. Repository rebuild required. Also, branches must be retagged. by drh on 2009-01-22 12:03:51. [view]

To:

File src/rebuild.c part of check-in [d0fc1ad062] - Fix the "rebuild" command so that it works in an open check-out without having to specify the repository and so that it accepts the -R option. by drh on 2009-08-22 19:27:56. [view]

@@ -280,9 +280,9 @@
 
 /*
 ** COMMAND:  rebuild
 **
-** Usage: %fossil rebuild REPOSITORY
+** Usage: %fossil rebuild ?REPOSITORY?
 **
 ** Reconstruct the named repository database from the core
 ** records.  Run this command after updating the fossil
 ** executable in a way that changes the database schema.
@@ -293,12 +293,18 @@
   int errCnt;
 
   forceFlag = find_option("force","f",0)!=0;
   randomizeFlag = find_option("randomize", 0, 0)!=0;
-  if( g.argc!=3 ){
-    usage("REPOSITORY-FILENAME");
-  }
-  db_open_repository(g.argv[2]);
+  if( g.argc==3 ){
+    db_open_repository(g.argv[2]);
+  }else{
+    db_find_and_open_repository(1);
+    if( g.argc!=2 ){
+      usage("?REPOSITORY-FILENAME?");
+    }
+    db_close();
+    db_open_repository(g.zRepositoryName);
+  }
   db_begin_transaction();
   ttyOutput = 1;
   errCnt = rebuild_db(randomizeFlag, 1);
   if( errCnt && !forceFlag ){