Fossil SCM

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.

drh 2009-08-22 19:27 trunk
Commit d0fc1ad062658a4c5048eb513168678b3e81e87f
1 file changed +10 -4
+10 -4
--- src/rebuild.c
+++ src/rebuild.c
@@ -279,11 +279,11 @@
279279
}
280280
281281
/*
282282
** COMMAND: rebuild
283283
**
284
-** Usage: %fossil rebuild REPOSITORY
284
+** Usage: %fossil rebuild ?REPOSITORY?
285285
**
286286
** Reconstruct the named repository database from the core
287287
** records. Run this command after updating the fossil
288288
** executable in a way that changes the database schema.
289289
*/
@@ -292,14 +292,20 @@
292292
int randomizeFlag;
293293
int errCnt;
294294
295295
forceFlag = find_option("force","f",0)!=0;
296296
randomizeFlag = find_option("randomize", 0, 0)!=0;
297
- if( g.argc!=3 ){
298
- usage("REPOSITORY-FILENAME");
297
+ if( g.argc==3 ){
298
+ db_open_repository(g.argv[2]);
299
+ }else{
300
+ db_find_and_open_repository(1);
301
+ if( g.argc!=2 ){
302
+ usage("?REPOSITORY-FILENAME?");
303
+ }
304
+ db_close();
305
+ db_open_repository(g.zRepositoryName);
299306
}
300
- db_open_repository(g.argv[2]);
301307
db_begin_transaction();
302308
ttyOutput = 1;
303309
errCnt = rebuild_db(randomizeFlag, 1);
304310
if( errCnt && !forceFlag ){
305311
printf("%d errors. Rolling back changes. Use --force to force a commit.\n",
306312
--- src/rebuild.c
+++ src/rebuild.c
@@ -279,11 +279,11 @@
279 }
280
281 /*
282 ** COMMAND: rebuild
283 **
284 ** Usage: %fossil rebuild REPOSITORY
285 **
286 ** Reconstruct the named repository database from the core
287 ** records. Run this command after updating the fossil
288 ** executable in a way that changes the database schema.
289 */
@@ -292,14 +292,20 @@
292 int randomizeFlag;
293 int errCnt;
294
295 forceFlag = find_option("force","f",0)!=0;
296 randomizeFlag = find_option("randomize", 0, 0)!=0;
297 if( g.argc!=3 ){
298 usage("REPOSITORY-FILENAME");
 
 
 
 
 
 
 
299 }
300 db_open_repository(g.argv[2]);
301 db_begin_transaction();
302 ttyOutput = 1;
303 errCnt = rebuild_db(randomizeFlag, 1);
304 if( errCnt && !forceFlag ){
305 printf("%d errors. Rolling back changes. Use --force to force a commit.\n",
306
--- src/rebuild.c
+++ src/rebuild.c
@@ -279,11 +279,11 @@
279 }
280
281 /*
282 ** COMMAND: rebuild
283 **
284 ** Usage: %fossil rebuild ?REPOSITORY?
285 **
286 ** Reconstruct the named repository database from the core
287 ** records. Run this command after updating the fossil
288 ** executable in a way that changes the database schema.
289 */
@@ -292,14 +292,20 @@
292 int randomizeFlag;
293 int errCnt;
294
295 forceFlag = find_option("force","f",0)!=0;
296 randomizeFlag = find_option("randomize", 0, 0)!=0;
297 if( g.argc==3 ){
298 db_open_repository(g.argv[2]);
299 }else{
300 db_find_and_open_repository(1);
301 if( g.argc!=2 ){
302 usage("?REPOSITORY-FILENAME?");
303 }
304 db_close();
305 db_open_repository(g.zRepositoryName);
306 }
 
307 db_begin_transaction();
308 ttyOutput = 1;
309 errCnt = rebuild_db(randomizeFlag, 1);
310 if( errCnt && !forceFlag ){
311 printf("%d errors. Rolling back changes. Use --force to force a commit.\n",
312

Keyboard Shortcuts

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