Fossil SCM

Rebuild ticket tables when modifications are made using 'fossil config'.

joel 2013-11-29 06:10 UTC trunk
Commit 0047370ce670cd77ab756826a4445c2ef8e84106
2 files changed +18 +1
--- src/configure.c
+++ src/configure.c
@@ -400,10 +400,25 @@
400400
@ DROP TABLE _xfer_user;
401401
@ DROP TABLE _xfer_reportfmt;
402402
;
403403
db_multi_exec(zSQL);
404404
}
405
+
406
+/*
407
+** Mask of modified configuration sets
408
+*/
409
+static int rebuildMask = 0;
410
+
411
+/*
412
+** Rebuild auxiliary tables as required by configuration changes.
413
+*/
414
+void configure_rebuild(void){
415
+ if( rebuildMask & CONFIGSET_TKT ){
416
+ ticket_rebuild();
417
+ }
418
+ rebuildMask = 0;
419
+}
405420
406421
/*
407422
** Return true if z[] is not a "safe" SQL token. A safe token is one of:
408423
**
409424
** * A string literal
@@ -566,10 +581,11 @@
566581
blob_appendf(&sql, " WHERE %s=%s AND mtime<%s",
567582
aType[ii].zPrimKey, azToken[1], azToken[0]);
568583
db_multi_exec("%s", blob_str(&sql));
569584
}
570585
blob_reset(&sql);
586
+ rebuildMask |= thisMask;
571587
}else{
572588
/* Otherwise, the old format */
573589
if( (configure_is_exportable(zName) & groupMask)==0 ) return;
574590
if( fossil_strcmp(zName, "logo-image")==0 ){
575591
Stmt ins;
@@ -948,11 +964,13 @@
948964
}
949965
db_end_transaction(0);
950966
fossil_print("Configuration reset to factory defaults.\n");
951967
fossil_print("To recover, use: %s %s import %s\n",
952968
g.argv[0], g.argv[1], zBackup);
969
+ rebuildMask |= mask;
953970
}else
954971
{
955972
fossil_fatal("METHOD should be one of:"
956973
" export import merge pull push reset");
957974
}
975
+ configure_rebuild();
958976
}
959977
--- src/configure.c
+++ src/configure.c
@@ -400,10 +400,25 @@
400 @ DROP TABLE _xfer_user;
401 @ DROP TABLE _xfer_reportfmt;
402 ;
403 db_multi_exec(zSQL);
404 }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
405
406 /*
407 ** Return true if z[] is not a "safe" SQL token. A safe token is one of:
408 **
409 ** * A string literal
@@ -566,10 +581,11 @@
566 blob_appendf(&sql, " WHERE %s=%s AND mtime<%s",
567 aType[ii].zPrimKey, azToken[1], azToken[0]);
568 db_multi_exec("%s", blob_str(&sql));
569 }
570 blob_reset(&sql);
 
571 }else{
572 /* Otherwise, the old format */
573 if( (configure_is_exportable(zName) & groupMask)==0 ) return;
574 if( fossil_strcmp(zName, "logo-image")==0 ){
575 Stmt ins;
@@ -948,11 +964,13 @@
948 }
949 db_end_transaction(0);
950 fossil_print("Configuration reset to factory defaults.\n");
951 fossil_print("To recover, use: %s %s import %s\n",
952 g.argv[0], g.argv[1], zBackup);
 
953 }else
954 {
955 fossil_fatal("METHOD should be one of:"
956 " export import merge pull push reset");
957 }
 
958 }
959
--- src/configure.c
+++ src/configure.c
@@ -400,10 +400,25 @@
400 @ DROP TABLE _xfer_user;
401 @ DROP TABLE _xfer_reportfmt;
402 ;
403 db_multi_exec(zSQL);
404 }
405
406 /*
407 ** Mask of modified configuration sets
408 */
409 static int rebuildMask = 0;
410
411 /*
412 ** Rebuild auxiliary tables as required by configuration changes.
413 */
414 void configure_rebuild(void){
415 if( rebuildMask & CONFIGSET_TKT ){
416 ticket_rebuild();
417 }
418 rebuildMask = 0;
419 }
420
421 /*
422 ** Return true if z[] is not a "safe" SQL token. A safe token is one of:
423 **
424 ** * A string literal
@@ -566,10 +581,11 @@
581 blob_appendf(&sql, " WHERE %s=%s AND mtime<%s",
582 aType[ii].zPrimKey, azToken[1], azToken[0]);
583 db_multi_exec("%s", blob_str(&sql));
584 }
585 blob_reset(&sql);
586 rebuildMask |= thisMask;
587 }else{
588 /* Otherwise, the old format */
589 if( (configure_is_exportable(zName) & groupMask)==0 ) return;
590 if( fossil_strcmp(zName, "logo-image")==0 ){
591 Stmt ins;
@@ -948,11 +964,13 @@
964 }
965 db_end_transaction(0);
966 fossil_print("Configuration reset to factory defaults.\n");
967 fossil_print("To recover, use: %s %s import %s\n",
968 g.argv[0], g.argv[1], zBackup);
969 rebuildMask |= mask;
970 }else
971 {
972 fossil_fatal("METHOD should be one of:"
973 " export import merge pull push reset");
974 }
975 configure_rebuild();
976 }
977
+1
--- src/xfer.c
+++ src/xfer.c
@@ -1267,10 +1267,11 @@
12671267
zNow = db_text(0, "SELECT strftime('%%Y-%%m-%%dT%%H:%%M:%%S', 'now')");
12681268
@ # timestamp %s(zNow)
12691269
free(zNow);
12701270
12711271
db_end_transaction(0);
1272
+ configure_rebuild();
12721273
}
12731274
12741275
/*
12751276
** COMMAND: test-xfer
12761277
**
12771278
--- src/xfer.c
+++ src/xfer.c
@@ -1267,10 +1267,11 @@
1267 zNow = db_text(0, "SELECT strftime('%%Y-%%m-%%dT%%H:%%M:%%S', 'now')");
1268 @ # timestamp %s(zNow)
1269 free(zNow);
1270
1271 db_end_transaction(0);
 
1272 }
1273
1274 /*
1275 ** COMMAND: test-xfer
1276 **
1277
--- src/xfer.c
+++ src/xfer.c
@@ -1267,10 +1267,11 @@
1267 zNow = db_text(0, "SELECT strftime('%%Y-%%m-%%dT%%H:%%M:%%S', 'now')");
1268 @ # timestamp %s(zNow)
1269 free(zNow);
1270
1271 db_end_transaction(0);
1272 configure_rebuild();
1273 }
1274
1275 /*
1276 ** COMMAND: test-xfer
1277 **
1278

Keyboard Shortcuts

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