Check-in [d0fc1ad062]
Not logged in
Overview

SHA1 Hash:d0fc1ad062658a4c5048eb513168678b3e81e87f
Date: 2009-08-22 19:27:56
User: drh
Comment: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.
Timelines: ancestors | descendants | both | trunk
Other Links: files | ZIP archive | manifest

Tags And Properties
Changes
[hide diffs]

Modified src/rebuild.c from [485e8e6098] to [523d3c93a0].

@@ -279,11 +279,11 @@
 }
 
 /*
 ** 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.
 */
@@ -292,14 +292,20 @@
   int randomizeFlag;
   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 ){
     printf("%d errors. Rolling back changes. Use --force to force a commit.\n",