Fossil SCM
Add the --ifneeded option to the "fossil rebuild" command. Changed the --no-index option to --noindex for consistency. Updated the help screen for "fossil rebuild" so that options are in sorted order.
Commit
7a91ee99fce042ac94aaa52329aa0d2a07a66b0e
Parent
c6b233229ddbfae…
2 files changed
+2
-1
+17
-7
+2
-1
| --- src/allrepo.c | ||
| +++ src/allrepo.c | ||
| @@ -230,11 +230,12 @@ | ||
| 230 | 230 | collect_argument(&extra, "deanalyze",0); |
| 231 | 231 | collect_argument(&extra, "analyze",0); |
| 232 | 232 | collect_argument(&extra, "wal",0); |
| 233 | 233 | collect_argument(&extra, "stats",0); |
| 234 | 234 | collect_argument(&extra, "index",0); |
| 235 | - collect_argument(&extra, "no-index",0); | |
| 235 | + collect_argument(&extra, "noindex",0); | |
| 236 | + collect_argument(&extra, "ifneeded", 0); | |
| 236 | 237 | }else if( strncmp(zCmd, "setting", n)==0 ){ |
| 237 | 238 | zCmd = "setting -R"; |
| 238 | 239 | collect_argv(&extra, 3); |
| 239 | 240 | }else if( strncmp(zCmd, "unset", n)==0 ){ |
| 240 | 241 | zCmd = "unset -R"; |
| 241 | 242 |
| --- src/allrepo.c | |
| +++ src/allrepo.c | |
| @@ -230,11 +230,12 @@ | |
| 230 | collect_argument(&extra, "deanalyze",0); |
| 231 | collect_argument(&extra, "analyze",0); |
| 232 | collect_argument(&extra, "wal",0); |
| 233 | collect_argument(&extra, "stats",0); |
| 234 | collect_argument(&extra, "index",0); |
| 235 | collect_argument(&extra, "no-index",0); |
| 236 | }else if( strncmp(zCmd, "setting", n)==0 ){ |
| 237 | zCmd = "setting -R"; |
| 238 | collect_argv(&extra, 3); |
| 239 | }else if( strncmp(zCmd, "unset", n)==0 ){ |
| 240 | zCmd = "unset -R"; |
| 241 |
| --- src/allrepo.c | |
| +++ src/allrepo.c | |
| @@ -230,11 +230,12 @@ | |
| 230 | collect_argument(&extra, "deanalyze",0); |
| 231 | collect_argument(&extra, "analyze",0); |
| 232 | collect_argument(&extra, "wal",0); |
| 233 | collect_argument(&extra, "stats",0); |
| 234 | collect_argument(&extra, "index",0); |
| 235 | collect_argument(&extra, "noindex",0); |
| 236 | collect_argument(&extra, "ifneeded", 0); |
| 237 | }else if( strncmp(zCmd, "setting", n)==0 ){ |
| 238 | zCmd = "setting -R"; |
| 239 | collect_argv(&extra, 3); |
| 240 | }else if( strncmp(zCmd, "unset", n)==0 ){ |
| 241 | zCmd = "unset -R"; |
| 242 |
+17
-7
| --- src/rebuild.c | ||
| +++ src/rebuild.c | ||
| @@ -522,23 +522,24 @@ | ||
| 522 | 522 | ** Reconstruct the named repository database from the core |
| 523 | 523 | ** records. Run this command after updating the fossil |
| 524 | 524 | ** executable in a way that changes the database schema. |
| 525 | 525 | ** |
| 526 | 526 | ** Options: |
| 527 | +** --analyze Run ANALYZE on the database after rebuilding | |
| 527 | 528 | ** --cluster Compute clusters for unclustered artifacts |
| 528 | 529 | ** --compress Strive to make the database as small as possible |
| 530 | +** --deanalyze Remove ANALYZE tables from the database | |
| 529 | 531 | ** --force Force the rebuild to complete even if errors are seen |
| 532 | +** --ifneeded Only do the rebuild if it would change the schema version | |
| 533 | +** --index Always add in the full-text search index | |
| 530 | 534 | ** --noverify Skip the verification of changes to the BLOB table |
| 535 | +** --noindex Always omit the full-text search index | |
| 531 | 536 | ** --pagesize N Set the database pagesize to N. (512..65536 and power of 2) |
| 532 | 537 | ** --randomize Scan artifacts in a random order |
| 538 | +** --stats Show artifact statistics after rebuilding | |
| 533 | 539 | ** --vacuum Run VACUUM on the database after rebuilding |
| 534 | -** --deanalyze Remove ANALYZE tables from the database | |
| 535 | -** --analyze Run ANALYZE on the database after rebuilding | |
| 536 | 540 | ** --wal Set Write-Ahead-Log journalling mode on the database |
| 537 | -** --stats Show artifact statistics after rebuilding | |
| 538 | -** --index Always add in the full-text search index | |
| 539 | -** --no-index Always omit the full-text search index | |
| 540 | 541 | ** |
| 541 | 542 | ** See also: deconstruct, reconstruct |
| 542 | 543 | */ |
| 543 | 544 | void rebuild_database(void){ |
| 544 | 545 | int forceFlag; |
| @@ -553,10 +554,13 @@ | ||
| 553 | 554 | int runDeanalyze; |
| 554 | 555 | int runAnalyze; |
| 555 | 556 | int runCompress; |
| 556 | 557 | int showStats; |
| 557 | 558 | int runReindex; |
| 559 | + int optNoIndex; | |
| 560 | + int optIndex; | |
| 561 | + int optIfNeeded; | |
| 558 | 562 | |
| 559 | 563 | omitVerify = find_option("noverify",0,0)!=0; |
| 560 | 564 | forceFlag = find_option("force","f",0)!=0; |
| 561 | 565 | randomizeFlag = find_option("randomize", 0, 0)!=0; |
| 562 | 566 | doClustering = find_option("cluster", 0, 0)!=0; |
| @@ -564,10 +568,13 @@ | ||
| 564 | 568 | runDeanalyze = find_option("deanalyze",0,0)!=0; |
| 565 | 569 | runAnalyze = find_option("analyze",0,0)!=0; |
| 566 | 570 | runCompress = find_option("compress",0,0)!=0; |
| 567 | 571 | zPagesize = find_option("pagesize",0,1); |
| 568 | 572 | showStats = find_option("stats",0,0)!=0; |
| 573 | + optIndex = find_option("index",0,0)!=0; | |
| 574 | + optNoIndex = find_option("noindex",0,0)!=0; | |
| 575 | + optIfNeeded = find_option("ifneeded",0,0)!=0; | |
| 569 | 576 | if( zPagesize ){ |
| 570 | 577 | newPagesize = atoi(zPagesize); |
| 571 | 578 | if( newPagesize<512 || newPagesize>65536 |
| 572 | 579 | || (newPagesize&(newPagesize-1))!=0 |
| 573 | 580 | ){ |
| @@ -584,12 +591,15 @@ | ||
| 584 | 591 | } |
| 585 | 592 | db_close(1); |
| 586 | 593 | db_open_repository(g.zRepositoryName); |
| 587 | 594 | } |
| 588 | 595 | runReindex = search_index_exists(); |
| 589 | - if( find_option("index",0,0)!=0 ) runReindex = 1; | |
| 590 | - if( find_option("no-index",0,0)!=0 ) runReindex = 0; | |
| 596 | + if( optIndex ) runReindex = 1; | |
| 597 | + if( optNoIndex ) runReindex = 0; | |
| 598 | + if( optIfNeeded && fossil_strcmp(db_get("aux-schema",""),AUX_SCHEMA_MAX)==0 ){ | |
| 599 | + return; | |
| 600 | + } | |
| 591 | 601 | |
| 592 | 602 | /* We should be done with options.. */ |
| 593 | 603 | verify_all_options(); |
| 594 | 604 | |
| 595 | 605 | db_begin_transaction(); |
| 596 | 606 |
| --- src/rebuild.c | |
| +++ src/rebuild.c | |
| @@ -522,23 +522,24 @@ | |
| 522 | ** Reconstruct the named repository database from the core |
| 523 | ** records. Run this command after updating the fossil |
| 524 | ** executable in a way that changes the database schema. |
| 525 | ** |
| 526 | ** Options: |
| 527 | ** --cluster Compute clusters for unclustered artifacts |
| 528 | ** --compress Strive to make the database as small as possible |
| 529 | ** --force Force the rebuild to complete even if errors are seen |
| 530 | ** --noverify Skip the verification of changes to the BLOB table |
| 531 | ** --pagesize N Set the database pagesize to N. (512..65536 and power of 2) |
| 532 | ** --randomize Scan artifacts in a random order |
| 533 | ** --vacuum Run VACUUM on the database after rebuilding |
| 534 | ** --deanalyze Remove ANALYZE tables from the database |
| 535 | ** --analyze Run ANALYZE on the database after rebuilding |
| 536 | ** --wal Set Write-Ahead-Log journalling mode on the database |
| 537 | ** --stats Show artifact statistics after rebuilding |
| 538 | ** --index Always add in the full-text search index |
| 539 | ** --no-index Always omit the full-text search index |
| 540 | ** |
| 541 | ** See also: deconstruct, reconstruct |
| 542 | */ |
| 543 | void rebuild_database(void){ |
| 544 | int forceFlag; |
| @@ -553,10 +554,13 @@ | |
| 553 | int runDeanalyze; |
| 554 | int runAnalyze; |
| 555 | int runCompress; |
| 556 | int showStats; |
| 557 | int runReindex; |
| 558 | |
| 559 | omitVerify = find_option("noverify",0,0)!=0; |
| 560 | forceFlag = find_option("force","f",0)!=0; |
| 561 | randomizeFlag = find_option("randomize", 0, 0)!=0; |
| 562 | doClustering = find_option("cluster", 0, 0)!=0; |
| @@ -564,10 +568,13 @@ | |
| 564 | runDeanalyze = find_option("deanalyze",0,0)!=0; |
| 565 | runAnalyze = find_option("analyze",0,0)!=0; |
| 566 | runCompress = find_option("compress",0,0)!=0; |
| 567 | zPagesize = find_option("pagesize",0,1); |
| 568 | showStats = find_option("stats",0,0)!=0; |
| 569 | if( zPagesize ){ |
| 570 | newPagesize = atoi(zPagesize); |
| 571 | if( newPagesize<512 || newPagesize>65536 |
| 572 | || (newPagesize&(newPagesize-1))!=0 |
| 573 | ){ |
| @@ -584,12 +591,15 @@ | |
| 584 | } |
| 585 | db_close(1); |
| 586 | db_open_repository(g.zRepositoryName); |
| 587 | } |
| 588 | runReindex = search_index_exists(); |
| 589 | if( find_option("index",0,0)!=0 ) runReindex = 1; |
| 590 | if( find_option("no-index",0,0)!=0 ) runReindex = 0; |
| 591 | |
| 592 | /* We should be done with options.. */ |
| 593 | verify_all_options(); |
| 594 | |
| 595 | db_begin_transaction(); |
| 596 |
| --- src/rebuild.c | |
| +++ src/rebuild.c | |
| @@ -522,23 +522,24 @@ | |
| 522 | ** Reconstruct the named repository database from the core |
| 523 | ** records. Run this command after updating the fossil |
| 524 | ** executable in a way that changes the database schema. |
| 525 | ** |
| 526 | ** Options: |
| 527 | ** --analyze Run ANALYZE on the database after rebuilding |
| 528 | ** --cluster Compute clusters for unclustered artifacts |
| 529 | ** --compress Strive to make the database as small as possible |
| 530 | ** --deanalyze Remove ANALYZE tables from the database |
| 531 | ** --force Force the rebuild to complete even if errors are seen |
| 532 | ** --ifneeded Only do the rebuild if it would change the schema version |
| 533 | ** --index Always add in the full-text search index |
| 534 | ** --noverify Skip the verification of changes to the BLOB table |
| 535 | ** --noindex Always omit the full-text search index |
| 536 | ** --pagesize N Set the database pagesize to N. (512..65536 and power of 2) |
| 537 | ** --randomize Scan artifacts in a random order |
| 538 | ** --stats Show artifact statistics after rebuilding |
| 539 | ** --vacuum Run VACUUM on the database after rebuilding |
| 540 | ** --wal Set Write-Ahead-Log journalling mode on the database |
| 541 | ** |
| 542 | ** See also: deconstruct, reconstruct |
| 543 | */ |
| 544 | void rebuild_database(void){ |
| 545 | int forceFlag; |
| @@ -553,10 +554,13 @@ | |
| 554 | int runDeanalyze; |
| 555 | int runAnalyze; |
| 556 | int runCompress; |
| 557 | int showStats; |
| 558 | int runReindex; |
| 559 | int optNoIndex; |
| 560 | int optIndex; |
| 561 | int optIfNeeded; |
| 562 | |
| 563 | omitVerify = find_option("noverify",0,0)!=0; |
| 564 | forceFlag = find_option("force","f",0)!=0; |
| 565 | randomizeFlag = find_option("randomize", 0, 0)!=0; |
| 566 | doClustering = find_option("cluster", 0, 0)!=0; |
| @@ -564,10 +568,13 @@ | |
| 568 | runDeanalyze = find_option("deanalyze",0,0)!=0; |
| 569 | runAnalyze = find_option("analyze",0,0)!=0; |
| 570 | runCompress = find_option("compress",0,0)!=0; |
| 571 | zPagesize = find_option("pagesize",0,1); |
| 572 | showStats = find_option("stats",0,0)!=0; |
| 573 | optIndex = find_option("index",0,0)!=0; |
| 574 | optNoIndex = find_option("noindex",0,0)!=0; |
| 575 | optIfNeeded = find_option("ifneeded",0,0)!=0; |
| 576 | if( zPagesize ){ |
| 577 | newPagesize = atoi(zPagesize); |
| 578 | if( newPagesize<512 || newPagesize>65536 |
| 579 | || (newPagesize&(newPagesize-1))!=0 |
| 580 | ){ |
| @@ -584,12 +591,15 @@ | |
| 591 | } |
| 592 | db_close(1); |
| 593 | db_open_repository(g.zRepositoryName); |
| 594 | } |
| 595 | runReindex = search_index_exists(); |
| 596 | if( optIndex ) runReindex = 1; |
| 597 | if( optNoIndex ) runReindex = 0; |
| 598 | if( optIfNeeded && fossil_strcmp(db_get("aux-schema",""),AUX_SCHEMA_MAX)==0 ){ |
| 599 | return; |
| 600 | } |
| 601 | |
| 602 | /* We should be done with options.. */ |
| 603 | verify_all_options(); |
| 604 | |
| 605 | db_begin_transaction(); |
| 606 |