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.

drh 2015-02-08 21:47 trunk
Commit 7a91ee99fce042ac94aaa52329aa0d2a07a66b0e
2 files changed +2 -1 +17 -7
+2 -1
--- src/allrepo.c
+++ src/allrepo.c
@@ -230,11 +230,12 @@
230230
collect_argument(&extra, "deanalyze",0);
231231
collect_argument(&extra, "analyze",0);
232232
collect_argument(&extra, "wal",0);
233233
collect_argument(&extra, "stats",0);
234234
collect_argument(&extra, "index",0);
235
- collect_argument(&extra, "no-index",0);
235
+ collect_argument(&extra, "noindex",0);
236
+ collect_argument(&extra, "ifneeded", 0);
236237
}else if( strncmp(zCmd, "setting", n)==0 ){
237238
zCmd = "setting -R";
238239
collect_argv(&extra, 3);
239240
}else if( strncmp(zCmd, "unset", n)==0 ){
240241
zCmd = "unset -R";
241242
--- 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 @@
522522
** Reconstruct the named repository database from the core
523523
** records. Run this command after updating the fossil
524524
** executable in a way that changes the database schema.
525525
**
526526
** Options:
527
+** --analyze Run ANALYZE on the database after rebuilding
527528
** --cluster Compute clusters for unclustered artifacts
528529
** --compress Strive to make the database as small as possible
530
+** --deanalyze Remove ANALYZE tables from the database
529531
** --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
530534
** --noverify Skip the verification of changes to the BLOB table
535
+** --noindex Always omit the full-text search index
531536
** --pagesize N Set the database pagesize to N. (512..65536 and power of 2)
532537
** --randomize Scan artifacts in a random order
538
+** --stats Show artifact statistics after rebuilding
533539
** --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
536540
** --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
540541
**
541542
** See also: deconstruct, reconstruct
542543
*/
543544
void rebuild_database(void){
544545
int forceFlag;
@@ -553,10 +554,13 @@
553554
int runDeanalyze;
554555
int runAnalyze;
555556
int runCompress;
556557
int showStats;
557558
int runReindex;
559
+ int optNoIndex;
560
+ int optIndex;
561
+ int optIfNeeded;
558562
559563
omitVerify = find_option("noverify",0,0)!=0;
560564
forceFlag = find_option("force","f",0)!=0;
561565
randomizeFlag = find_option("randomize", 0, 0)!=0;
562566
doClustering = find_option("cluster", 0, 0)!=0;
@@ -564,10 +568,13 @@
564568
runDeanalyze = find_option("deanalyze",0,0)!=0;
565569
runAnalyze = find_option("analyze",0,0)!=0;
566570
runCompress = find_option("compress",0,0)!=0;
567571
zPagesize = find_option("pagesize",0,1);
568572
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;
569576
if( zPagesize ){
570577
newPagesize = atoi(zPagesize);
571578
if( newPagesize<512 || newPagesize>65536
572579
|| (newPagesize&(newPagesize-1))!=0
573580
){
@@ -584,12 +591,15 @@
584591
}
585592
db_close(1);
586593
db_open_repository(g.zRepositoryName);
587594
}
588595
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
+ }
591601
592602
/* We should be done with options.. */
593603
verify_all_options();
594604
595605
db_begin_transaction();
596606
--- 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

Keyboard Shortcuts

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