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.
Commit
d0fc1ad062658a4c5048eb513168678b3e81e87f
Parent
614519b46cb7cbf…
1 file changed
+10
-4
+10
-4
| --- src/rebuild.c | ||
| +++ src/rebuild.c | ||
| @@ -279,11 +279,11 @@ | ||
| 279 | 279 | } |
| 280 | 280 | |
| 281 | 281 | /* |
| 282 | 282 | ** COMMAND: rebuild |
| 283 | 283 | ** |
| 284 | -** Usage: %fossil rebuild REPOSITORY | |
| 284 | +** Usage: %fossil rebuild ?REPOSITORY? | |
| 285 | 285 | ** |
| 286 | 286 | ** Reconstruct the named repository database from the core |
| 287 | 287 | ** records. Run this command after updating the fossil |
| 288 | 288 | ** executable in a way that changes the database schema. |
| 289 | 289 | */ |
| @@ -292,14 +292,20 @@ | ||
| 292 | 292 | int randomizeFlag; |
| 293 | 293 | int errCnt; |
| 294 | 294 | |
| 295 | 295 | forceFlag = find_option("force","f",0)!=0; |
| 296 | 296 | 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); | |
| 299 | 306 | } |
| 300 | - db_open_repository(g.argv[2]); | |
| 301 | 307 | db_begin_transaction(); |
| 302 | 308 | ttyOutput = 1; |
| 303 | 309 | errCnt = rebuild_db(randomizeFlag, 1); |
| 304 | 310 | if( errCnt && !forceFlag ){ |
| 305 | 311 | printf("%d errors. Rolling back changes. Use --force to force a commit.\n", |
| 306 | 312 |
| --- 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 |