Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
| Comment: | Make calls to db_begin_write() instead of db_begin_transaction() where appropriate. |
|---|---|
| Downloads: | Tarball | ZIP archive |
| Timelines: | family | ancestors | descendants | both | trunk |
| Files: | files | file ages | folders |
| SHA3-256: |
3ad81c3c499599b47f6027414aa63677 |
| User & Date: | drh 2019-09-03 20:22:33.911 |
References
|
2019-09-03
| ||
| 21:22 | Back out check-in [3ad81c3c499599b4] which was causing sync to fail. ... (check-in: e1962ef67f user: drh tags: trunk) | |
Context
|
2019-09-03
| ||
| 21:22 | Back out check-in [3ad81c3c499599b4] which was causing sync to fail. ... (check-in: e1962ef67f user: drh tags: trunk) | |
| 20:36 | Wiki test fixes. ... (check-in: b40f1ac135 user: drh tags: trunk) | |
| 20:22 | Make calls to db_begin_write() instead of db_begin_transaction() where appropriate. ... (check-in: 3ad81c3c49 user: drh tags: trunk) | |
| 20:20 | Include the "js" property in the configuration export for skins. ... (check-in: 498fc87ac1 user: drh tags: trunk) | |
|
2019-08-31
| ||
| 16:42 | Merge in latest from trunk. ... (check-in: aa37639112 user: andybradford tags: db-begin-txn-updates) | |
Changes
Changes to src/add.c.
| ︙ | ︙ | |||
304 305 306 307 308 309 310 |
zCleanFlag = db_get("clean-glob", 0);
}
if( zIgnoreFlag==0 ){
zIgnoreFlag = db_get("ignore-glob", 0);
}
if( db_get_boolean("dotfiles", 0) ) scanFlags |= SCAN_ALL;
vid = db_lget_int("checkout",0);
| | | 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 |
zCleanFlag = db_get("clean-glob", 0);
}
if( zIgnoreFlag==0 ){
zIgnoreFlag = db_get("ignore-glob", 0);
}
if( db_get_boolean("dotfiles", 0) ) scanFlags |= SCAN_ALL;
vid = db_lget_int("checkout",0);
db_begin_write();
db_multi_exec("CREATE TEMP TABLE sfile(pathname TEXT PRIMARY KEY %s)",
filename_collation());
pClean = glob_create(zCleanFlag);
pIgnore = glob_create(zIgnoreFlag);
nRoot = strlen(g.zLocalRoot);
/* Load the names of all files that are to be added into sfile temp table */
|
| ︙ | ︙ | |||
458 459 460 461 462 463 464 |
softFlag = find_option("soft",0,0)!=0;
hardFlag = find_option("hard",0,0)!=0;
/* We should be done with options.. */
verify_all_options();
db_must_be_within_tree();
| | | 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 |
softFlag = find_option("soft",0,0)!=0;
hardFlag = find_option("hard",0,0)!=0;
/* We should be done with options.. */
verify_all_options();
db_must_be_within_tree();
db_begin_write();
if( g.argv[1][0]=='f' ){ /* i.e. "forget" */
removeFiles = 0;
}else if( softFlag ){
removeFiles = 0;
}else if( hardFlag ){
removeFiles = 1;
}else{
|
| ︙ | ︙ | |||
660 661 662 663 664 665 666 |
zCleanFlag = db_get("clean-glob", 0);
}
if( zIgnoreFlag==0 ){
zIgnoreFlag = db_get("ignore-glob", 0);
}
if( db_get_boolean("dotfiles", 0) ) scanFlags |= SCAN_ALL;
vid = db_lget_int("checkout",0);
| | | 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 |
zCleanFlag = db_get("clean-glob", 0);
}
if( zIgnoreFlag==0 ){
zIgnoreFlag = db_get("ignore-glob", 0);
}
if( db_get_boolean("dotfiles", 0) ) scanFlags |= SCAN_ALL;
vid = db_lget_int("checkout",0);
db_begin_write();
/* step 1:
** Populate the temp table "sfile" with the names of all unmanaged
** files currently in the check-out, except for files that match the
** --ignore or ignore-glob patterns and dot-files. Then add all of
** the files in the sfile temp table to the set of managed files.
*/
|
| ︙ | ︙ | |||
879 880 881 882 883 884 885 |
if( vid==0 ){
fossil_fatal("no checkout in which to rename files");
}
if( g.argc<4 ){
usage("OLDNAME NEWNAME");
}
zDest = g.argv[g.argc-1];
| | | 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 |
if( vid==0 ){
fossil_fatal("no checkout in which to rename files");
}
if( g.argc<4 ){
usage("OLDNAME NEWNAME");
}
zDest = g.argv[g.argc-1];
db_begin_write();
if( g.argv[1][0]=='r' ){ /* i.e. "rename" */
moveFiles = 0;
}else if( softFlag ){
moveFiles = 0;
}else if( hardFlag ){
moveFiles = 1;
}else{
|
| ︙ | ︙ |
Changes to src/alerts.c.
| ︙ | ︙ | |||
209 210 211 212 213 214 215 |
"relay", "SMTP relay"
};
login_check_credentials();
if( !g.perm.Setup ){
login_needed(0);
return;
}
| | | 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 |
"relay", "SMTP relay"
};
login_check_credentials();
if( !g.perm.Setup ){
login_needed(0);
return;
}
db_begin_write();
alert_submenu_common();
style_submenu_element("Send Announcement","%R/announce");
style_header("Email Notification Setup");
@ <h1>Status</h1>
@ <table class="label-value">
if( alert_enabled() ){
|
| ︙ | ︙ |
Changes to src/allrepo.c.
| ︙ | ︙ | |||
299 300 301 302 303 304 305 |
quiet = 1;
}else if( strncmp(zCmd, "ignore", n)==0 ){
int j;
Blob fn = BLOB_INITIALIZER;
Blob sql = BLOB_INITIALIZER;
useCheckouts = find_option("ckout","c",0)!=0;
verify_all_options();
| | | 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 |
quiet = 1;
}else if( strncmp(zCmd, "ignore", n)==0 ){
int j;
Blob fn = BLOB_INITIALIZER;
Blob sql = BLOB_INITIALIZER;
useCheckouts = find_option("ckout","c",0)!=0;
verify_all_options();
db_begin_write();
for(j=3; j<g.argc; j++, blob_reset(&sql), blob_reset(&fn)){
file_canonical_name(g.argv[j], &fn, useCheckouts?1:0);
blob_append_sql(&sql,
"DELETE FROM global_config WHERE name GLOB '%s:%q'",
useCheckouts?"ckout":"repo", blob_str(&fn)
);
if( dryRunFlag ){
|
| ︙ | ︙ | |||
322 323 324 325 326 327 328 |
blob_reset(&extra);
return;
}else if( strncmp(zCmd, "add", n)==0 ){
int j;
Blob fn = BLOB_INITIALIZER;
Blob sql = BLOB_INITIALIZER;
verify_all_options();
| | | 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 |
blob_reset(&extra);
return;
}else if( strncmp(zCmd, "add", n)==0 ){
int j;
Blob fn = BLOB_INITIALIZER;
Blob sql = BLOB_INITIALIZER;
verify_all_options();
db_begin_write();
for(j=3; j<g.argc; j++, blob_reset(&fn), blob_reset(&sql)){
sqlite3 *db;
int rc;
const char *z;
file_canonical_name(g.argv[j], &fn, 0);
z = blob_str(&fn);
if( !file_isfile(z, ExtFILE) ) continue;
|
| ︙ | ︙ |
Changes to src/attach.c.
| ︙ | ︙ | |||
264 265 266 267 268 269 270 |
char *zUUID;
char *zDate;
int rid;
int i, n;
int addCompress = 0;
Manifest *pManifest;
| | | 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 |
char *zUUID;
char *zDate;
int rid;
int i, n;
int addCompress = 0;
Manifest *pManifest;
db_begin_write();
blob_init(&content, aContent, szContent);
pManifest = manifest_parse(&content, 0, 0);
manifest_destroy(pManifest);
blob_init(&content, aContent, szContent);
if( pManifest ){
blob_compress(&content, &content);
addCompress = 1;
|
| ︙ | ︙ | |||
499 500 501 502 503 504 505 |
){
int i, n, rid;
char *zDate;
Blob manifest;
Blob cksum;
const char *zFile = zName;
| | | 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 |
){
int i, n, rid;
char *zDate;
Blob manifest;
Blob cksum;
const char *zFile = zName;
db_begin_write();
blob_zero(&manifest);
for(i=n=0; zFile[i]; i++){
if( zFile[i]=='/' || zFile[i]=='\\' ) n = i;
}
zFile += n;
if( zFile[0]==0 ) zFile = "unknown";
blob_appendf(&manifest, "A %F %F\n", zFile, zTarget);
|
| ︙ | ︙ |
Changes to src/bisect.c.
| ︙ | ︙ | |||
408 409 410 411 412 413 414 |
}else if( strncmp(zCmd, "undo", n)==0 ){
char *zLog;
Blob log, id;
int ridBad = 0;
int ridGood = 0;
int cnt = 0, i;
foundCmd = 1;
| | | 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 |
}else if( strncmp(zCmd, "undo", n)==0 ){
char *zLog;
Blob log, id;
int ridBad = 0;
int ridGood = 0;
int cnt = 0, i;
foundCmd = 1;
db_begin_write();
zLog = db_lget("bisect-log","");
blob_init(&log, zLog, -1);
while( blob_token(&log, &id) ){ cnt++; }
if( cnt==0 ){
fossil_fatal("no previous bisect steps to undo");
}
blob_rewind(&log);
|
| ︙ | ︙ |
Changes to src/branch.c.
| ︙ | ︙ | |||
93 94 95 96 97 98 99 |
" WHERE tagtype>0"
" AND tagid=(SELECT tagid FROM tag WHERE tagname='sym-%q')",
zBranch)!=0 ){
fossil_fatal("branch \"%s\" already exists", zBranch);
}
user_select();
| | | 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 |
" WHERE tagtype>0"
" AND tagid=(SELECT tagid FROM tag WHERE tagname='sym-%q')",
zBranch)!=0 ){
fossil_fatal("branch \"%s\" already exists", zBranch);
}
user_select();
db_begin_write();
rootid = name_to_typed_rid(g.argv[4], "ci");
if( rootid==0 ){
fossil_fatal("unable to locate check-in off of which to branch");
}
pParent = manifest_get(rootid, CFTYPE_MANIFEST, 0);
if( pParent==0 ){
|
| ︙ | ︙ |
Changes to src/bundle.c.
| ︙ | ︙ | |||
156 157 158 159 160 161 162 |
Stmt q;
verify_all_options();
bundle_attach_file(g.argv[3], "b1", 1);
db_prepare(&q,
"INSERT INTO bblob(blobid, uuid, sz, delta, data, notes) "
"VALUES(NULL, $uuid, $sz, NULL, $data, $filename)");
| | | 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 |
Stmt q;
verify_all_options();
bundle_attach_file(g.argv[3], "b1", 1);
db_prepare(&q,
"INSERT INTO bblob(blobid, uuid, sz, delta, data, notes) "
"VALUES(NULL, $uuid, $sz, NULL, $data, $filename)");
db_begin_write();
for(i=4; i<g.argc; i++){
int sz;
blob_read_from_file(&content, g.argv[i], ExtFILE);
sz = blob_size(&content);
sha1sum_blob(&content, &hash);
blob_compress(&content, &content);
db_bind_text(&q, "$uuid", blob_str(&hash));
|
| ︙ | ︙ | |||
301 302 303 304 305 306 307 |
find_checkin_associates("tobundle", 0);
verify_all_options();
describe_artifacts("IN tobundle");
if( g.argc!=4 ) usage("export BUNDLE ?OPTIONS?");
/* Create the new bundle */
bundle_attach_file(g.argv[3], "b1", 1);
| | | 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 |
find_checkin_associates("tobundle", 0);
verify_all_options();
describe_artifacts("IN tobundle");
if( g.argc!=4 ) usage("export BUNDLE ?OPTIONS?");
/* Create the new bundle */
bundle_attach_file(g.argv[3], "b1", 1);
db_begin_write();
/* Add 'mtime' and 'project-code' entries to the bconfig table */
db_multi_exec(
"INSERT INTO bconfig(bcname,bcvalue)"
" VALUES('mtime',datetime('now'));"
);
db_multi_exec(
|
| ︙ | ︙ | |||
597 598 599 600 601 602 603 |
" AND NOT EXISTS(SELECT 1 FROM blob WHERE uuid=bblob.delta)",
HNAME_MIN);
if( zMissingDeltas && zMissingDeltas[0] ){
fossil_fatal("delta basis artifacts not found in repository: %s",
zMissingDeltas);
}
| | | 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 |
" AND NOT EXISTS(SELECT 1 FROM blob WHERE uuid=bblob.delta)",
HNAME_MIN);
if( zMissingDeltas && zMissingDeltas[0] ){
fossil_fatal("delta basis artifacts not found in repository: %s",
zMissingDeltas);
}
db_begin_write();
db_multi_exec(
"CREATE TEMP TABLE bix("
" blobid INTEGER PRIMARY KEY,"
" delta INTEGER"
");"
"CREATE INDEX bixdelta ON bix(delta);"
"INSERT INTO bix(blobid,delta)"
|
| ︙ | ︙ | |||
637 638 639 640 641 642 643 |
static void bundle_purge_cmd(void){
int bForce = find_option("force",0,0)!=0;
int bTest = find_option("test",0,0)!=0; /* Undocumented --test option */
const char *zFile = g.argv[3];
verify_all_options();
if ( g.argc!=4 ) usage("purge BUNDLE ?OPTIONS?");
bundle_attach_file(zFile, "b1", 0);
| | | 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 |
static void bundle_purge_cmd(void){
int bForce = find_option("force",0,0)!=0;
int bTest = find_option("test",0,0)!=0; /* Undocumented --test option */
const char *zFile = g.argv[3];
verify_all_options();
if ( g.argc!=4 ) usage("purge BUNDLE ?OPTIONS?");
bundle_attach_file(zFile, "b1", 0);
db_begin_write();
/* Find all check-ins of the bundle */
db_multi_exec(
"CREATE TEMP TABLE ok(rid INTEGER PRIMARY KEY);"
"INSERT OR IGNORE INTO ok SELECT blob.rid FROM bblob, blob, plink"
" WHERE bblob.uuid=blob.uuid"
" AND plink.cid=blob.rid;"
|
| ︙ | ︙ |
Changes to src/checkin.c.
| ︙ | ︙ | |||
2249 2250 2251 2252 2253 2254 2255 |
** Check that the user exists.
*/
if( !db_exists("SELECT 1 FROM user WHERE login=%Q", g.zLogin) ){
fossil_fatal("no such user: %s", g.zLogin);
}
hasChanges = unsaved_changes(useHash ? CKSIG_HASH : 0);
| | | 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 |
** Check that the user exists.
*/
if( !db_exists("SELECT 1 FROM user WHERE login=%Q", g.zLogin) ){
fossil_fatal("no such user: %s", g.zLogin);
}
hasChanges = unsaved_changes(useHash ? CKSIG_HASH : 0);
db_begin_write();
db_record_repository_filename(0);
if( hasChanges==0 && !isAMerge && !allowEmpty && !forceFlag ){
fossil_fatal("nothing has changed; use --allow-empty to override");
}
/* If none of the files that were named on the command line have
** been modified, bail out now unless the --allow-empty or --force
|
| ︙ | ︙ | |||
2350 2351 2352 2353 2354 2355 2356 |
if( cReply!='y' && cReply!='Y' ){
fossil_exit(1);
}
}
}else{
db_multi_exec("REPLACE INTO vvar VALUES('ci-comment',%B)", &comment);
db_end_transaction(0);
| | | 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 |
if( cReply!='y' && cReply!='Y' ){
fossil_exit(1);
}
}
}else{
db_multi_exec("REPLACE INTO vvar VALUES('ci-comment',%B)", &comment);
db_end_transaction(0);
db_begin_write();
}
/*
** Step 1: Compute an aggregate MD5 checksum over the disk image
** of every file in vid. The file names are part of the checksum.
** The resulting checksum is the same as is expected on the R-card
** of a manifest.
|
| ︙ | ︙ |
Changes to src/checkout.c.
| ︙ | ︙ | |||
291 292 293 294 295 296 297 | char *zVers; /* Version to checkout */ int promptFlag; /* True to prompt before overwriting */ int vid, prior; int setmtimeFlag; /* --setmtime. Set mtimes on files */ Blob cksum1, cksum1b, cksum2; db_must_be_within_tree(); | | | 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 |
char *zVers; /* Version to checkout */
int promptFlag; /* True to prompt before overwriting */
int vid, prior;
int setmtimeFlag; /* --setmtime. Set mtimes on files */
Blob cksum1, cksum1b, cksum2;
db_must_be_within_tree();
db_begin_write();
forceFlag = find_option("force","f",0)!=0;
forceMissingFlag = find_option("force-missing",0,0)!=0;
keepFlag = find_option("keep",0,0)!=0;
latestFlag = find_option("latest",0,0)!=0;
promptFlag = find_option("prompt",0,0)!=0 || forceFlag==0;
setmtimeFlag = find_option("setmtime",0,0)!=0;
|
| ︙ | ︙ |
Changes to src/clone.c.
| ︙ | ︙ | |||
175 176 177 178 179 180 181 |
}
fossil_print("Repository cloned into %s\n", g.argv[3]);
}else{
db_close_config();
db_create_repository(g.argv[3]);
db_open_repository(g.argv[3]);
db_open_config(0,0);
| | | 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 |
}
fossil_print("Repository cloned into %s\n", g.argv[3]);
}else{
db_close_config();
db_create_repository(g.argv[3]);
db_open_repository(g.argv[3]);
db_open_config(0,0);
db_begin_write();
db_record_repository_filename(g.argv[3]);
db_initial_setup(0, 0, zDefaultUser);
user_select();
db_set("content-schema", CONTENT_SCHEMA, 0);
db_set("aux-schema", AUX_SCHEMA_MAX, 0);
db_set("rebuilt", get_version(), 0);
db_unset("hash-policy", 0);
|
| ︙ | ︙ | |||
213 214 215 216 217 218 219 |
db_close(1);
if( nErr ){
file_delete(g.argv[3]);
fossil_fatal("server returned an error - clone aborted");
}
db_open_repository(g.argv[3]);
}
| | | 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 |
db_close(1);
if( nErr ){
file_delete(g.argv[3]);
fossil_fatal("server returned an error - clone aborted");
}
db_open_repository(g.argv[3]);
}
db_begin_write();
fossil_print("Rebuilding repository meta-data...\n");
rebuild_db(0, 1, 0);
if( !noCompress ){
fossil_print("Extra delta compression... "); fflush(stdout);
extra_deltification();
fossil_print("\n");
}
|
| ︙ | ︙ |
Changes to src/configure.c.
| ︙ | ︙ | |||
777 778 779 780 781 782 783 |
}else
if( strncmp(zMethod, "import", n)==0
|| strncmp(zMethod, "merge", n)==0 ){
Blob in;
int groupMask;
if( g.argc!=4 ) usage(mprintf("%s FILENAME",zMethod));
blob_read_from_file(&in, g.argv[3], ExtFILE);
| | | 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 |
}else
if( strncmp(zMethod, "import", n)==0
|| strncmp(zMethod, "merge", n)==0 ){
Blob in;
int groupMask;
if( g.argc!=4 ) usage(mprintf("%s FILENAME",zMethod));
blob_read_from_file(&in, g.argv[3], ExtFILE);
db_begin_write();
if( zMethod[0]=='i' ){
groupMask = CONFIGSET_ALL | CONFIGSET_OVERWRITE;
}else{
groupMask = CONFIGSET_ALL;
}
configure_receive_all(&in, groupMask);
db_end_transaction(0);
|
| ︙ | ︙ | |||
825 826 827 828 829 830 831 |
if( strncmp(zMethod, "reset", n)==0 ){
int mask, i;
char *zBackup;
if( g.argc!=4 ) usage("reset AREA");
mask = configure_name_to_mask(g.argv[3], 1);
zBackup = db_text(0,
"SELECT strftime('config-backup-%%Y%%m%%d%%H%%M%%f','now')");
| | | 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 |
if( strncmp(zMethod, "reset", n)==0 ){
int mask, i;
char *zBackup;
if( g.argc!=4 ) usage("reset AREA");
mask = configure_name_to_mask(g.argv[3], 1);
zBackup = db_text(0,
"SELECT strftime('config-backup-%%Y%%m%%d%%H%%M%%f','now')");
db_begin_write();
export_config(mask, g.argv[3], 0, zBackup);
for(i=0; i<count(aConfig); i++){
const char *zName = aConfig[i].zName;
if( (aConfig[i].groupMask & mask)==0 ) continue;
if( zName[0]!='@' ){
db_multi_exec("DELETE FROM config WHERE name=%Q", zName);
}else if( fossil_strcmp(zName,"@user")==0 ){
|
| ︙ | ︙ |
Changes to src/content.c.
| ︙ | ︙ | |||
511 512 513 514 515 516 517 | Blob hash; int markAsUnclustered = 0; int isDephantomize = 0; assert( g.repositoryOpen ); assert( pBlob!=0 ); assert( srcId==0 || zUuid!=0 ); | | | 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 |
Blob hash;
int markAsUnclustered = 0;
int isDephantomize = 0;
assert( g.repositoryOpen );
assert( pBlob!=0 );
assert( srcId==0 || zUuid!=0 );
db_begin_write();
if( zUuid==0 ){
assert( nBlob==0 );
/* First check the auxiliary hash to see if there is already an artifact
** that uses the auxiliary hash name */
hname_hash(pBlob, 1, &hash);
rid = fast_uuid_to_rid(blob_str(&hash));
if( rid==0 ){
|
| ︙ | ︙ | |||
657 658 659 660 661 662 663 |
** Create a new phantom with the given UUID and return its artifact ID.
*/
int content_new(const char *zUuid, int isPrivate){
int rid;
static Stmt s1, s2, s3;
assert( g.repositoryOpen );
| | | 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 |
** Create a new phantom with the given UUID and return its artifact ID.
*/
int content_new(const char *zUuid, int isPrivate){
int rid;
static Stmt s1, s2, s3;
assert( g.repositoryOpen );
db_begin_write();
if( uuid_is_shunned(zUuid) ){
db_end_transaction(0);
return 0;
}
db_static_prepare(&s1,
"INSERT INTO blob(rcvid,size,uuid,content)"
"VALUES(0,-1,:uuid,NULL)"
|
| ︙ | ︙ | |||
868 869 870 871 872 873 874 |
** make that candidate the new parent now */
if( bestSrc>0 ){
Stmt s1, s2; /* Statements used to create the delta */
blob_compress(&bestDelta, &bestDelta);
db_prepare(&s1, "UPDATE blob SET content=:data WHERE rid=%d", rid);
db_prepare(&s2, "REPLACE INTO delta(rid,srcid)VALUES(%d,%d)", rid, bestSrc);
db_bind_blob(&s1, ":data", &bestDelta);
| | | 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 |
** make that candidate the new parent now */
if( bestSrc>0 ){
Stmt s1, s2; /* Statements used to create the delta */
blob_compress(&bestDelta, &bestDelta);
db_prepare(&s1, "UPDATE blob SET content=:data WHERE rid=%d", rid);
db_prepare(&s2, "REPLACE INTO delta(rid,srcid)VALUES(%d,%d)", rid, bestSrc);
db_bind_blob(&s1, ":data", &bestDelta);
db_begin_write();
db_exec(&s1);
db_exec(&s2);
db_end_transaction(0);
db_finalize(&s1);
db_finalize(&s2);
verify_before_commit(rid);
rc = 1;
|
| ︙ | ︙ | |||
1231 1232 1233 1234 1235 1236 1237 |
"might irrecoverably damage the repository. Make sure you\n"
"have a backup copy!\n"
"Continue? (y/N)? ", &x);
c = blob_str(&x)[0];
blob_reset(&x);
if( c!='y' && c!='Y' ) return;
db_find_and_open_repository(OPEN_ANY_SCHEMA, 0);
| | | 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 |
"might irrecoverably damage the repository. Make sure you\n"
"have a backup copy!\n"
"Continue? (y/N)? ", &x);
c = blob_str(&x)[0];
blob_reset(&x);
if( c!='y' && c!='Y' ) return;
db_find_and_open_repository(OPEN_ANY_SCHEMA, 0);
db_begin_write();
db_prepare(&q, "SELECT rid FROM delta WHERE srcid=:rid");
for(i=2; i<g.argc; i++){
int rid = atoi(g.argv[i]);
fossil_print("Erasing artifact %d (%s)\n",
rid, db_text("", "SELECT uuid FROM blob WHERE rid=%d", rid));
db_bind_int(&q, ":rid", rid);
while( db_step(&q)==SQLITE_ROW ){
|
| ︙ | ︙ |
Changes to src/db.c.
| ︙ | ︙ | |||
2256 2257 2258 2259 2260 2261 2262 |
fossil_fatal("file already exists: %s", g.argv[2]);
}
db_create_repository(g.argv[2]);
db_open_repository(g.argv[2]);
db_open_config(0, 0);
if( zTemplate ) db_attach(zTemplate, "settingSrc");
| | | 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 |
fossil_fatal("file already exists: %s", g.argv[2]);
}
db_create_repository(g.argv[2]);
db_open_repository(g.argv[2]);
db_open_config(0, 0);
if( zTemplate ) db_attach(zTemplate, "settingSrc");
db_begin_write();
if( bUseSha1 ){
g.eHashPolicy = HPOLICY_SHA1;
db_set_int("hash-policy", HPOLICY_SHA1, 0);
}
if( zDate==0 ) zDate = "now";
db_initial_setup(zTemplate, zDate, zDefaultUser);
db_end_transaction(0);
|
| ︙ | ︙ | |||
2639 2640 2641 2642 2643 2644 2645 |
z = fossil_strdup(zDefault);
}else if( zFormat!=0 ){
z = db_text(0, "SELECT strftime(%Q,%Q,'unixepoch');", zFormat, z);
}
return z;
}
void db_set(const char *zName, const char *zValue, int globalFlag){
| | | | 2639 2640 2641 2642 2643 2644 2645 2646 2647 2648 2649 2650 2651 2652 2653 2654 2655 2656 2657 2658 2659 2660 2661 2662 2663 2664 2665 2666 2667 2668 2669 |
z = fossil_strdup(zDefault);
}else if( zFormat!=0 ){
z = db_text(0, "SELECT strftime(%Q,%Q,'unixepoch');", zFormat, z);
}
return z;
}
void db_set(const char *zName, const char *zValue, int globalFlag){
db_begin_write();
if( globalFlag ){
db_swap_connections();
db_multi_exec("REPLACE INTO global_config(name,value) VALUES(%Q,%Q)",
zName, zValue);
db_swap_connections();
}else{
db_multi_exec("REPLACE INTO config(name,value,mtime) VALUES(%Q,%Q,now())",
zName, zValue);
}
if( globalFlag && g.repositoryOpen ){
db_multi_exec("DELETE FROM config WHERE name=%Q", zName);
}
db_end_transaction(0);
}
void db_unset(const char *zName, int globalFlag){
db_begin_write();
if( globalFlag ){
db_swap_connections();
db_multi_exec("DELETE FROM global_config WHERE name=%Q", zName);
db_swap_connections();
}else{
db_multi_exec("DELETE FROM config WHERE name=%Q", zName);
}
|
| ︙ | ︙ |
Changes to src/diff.c.
| ︙ | ︙ | |||
2233 2234 2235 2236 2237 2238 2239 |
mxTime = 0;
}
}else{
/* Default limit is as much as we can do in 1.000 seconds */
iLimit = 0;
mxTime = current_time_in_milliseconds()+1000;
}
| | | 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 |
mxTime = 0;
}
}else{
/* Default limit is as much as we can do in 1.000 seconds */
iLimit = 0;
mxTime = current_time_in_milliseconds()+1000;
}
db_begin_write();
/* Get the artifact ID for the check-in begin analyzed */
if( zRevision ){
cid = name_to_typed_rid(zRevision, "ci");
}else{
db_must_be_within_tree();
cid = db_lget_int("checkout", 0);
|
| ︙ | ︙ |
Changes to src/event.c.
| ︙ | ︙ | |||
253 254 255 256 257 258 259 |
){
Blob event;
char *zDate;
Blob cksum;
int nrid, n;
blob_init(&event, 0, 0);
| | | 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 |
){
Blob event;
char *zDate;
Blob cksum;
int nrid, n;
blob_init(&event, 0, 0);
db_begin_write();
while( fossil_isspace(zComment[0]) ) zComment++;
n = strlen(zComment);
while( n>0 && fossil_isspace(zComment[n-1]) ){ n--; }
if( n>0 ){
blob_appendf(&event, "C %#F\n", n, zComment);
}
zDate = date_in_standard_format("now");
|
| ︙ | ︙ |
Changes to src/import.c.
| ︙ | ︙ | |||
1752 1753 1754 1755 1756 1757 1758 |
if( !incrFlag ){
if( forceFlag ) file_delete(g.argv[2]);
db_create_repository(g.argv[2]);
}
db_open_repository(g.argv[2]);
db_open_config(0, 0);
| | | 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 |
if( !incrFlag ){
if( forceFlag ) file_delete(g.argv[2]);
db_create_repository(g.argv[2]);
}
db_open_repository(g.argv[2]);
db_open_config(0, 0);
db_begin_write();
if( !incrFlag ){
db_initial_setup(0, 0, 0);
db_set("main-branch", gimport.zTrunkName, 0);
}
if( svnFlag ){
db_multi_exec(
|
| ︙ | ︙ | |||
1898 1899 1900 1901 1902 1903 1904 |
verify_cancel();
db_end_transaction(0);
fossil_print(" \r");
if( omitRebuild ){
omitVacuum = 1;
}else{
| | | 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 |
verify_cancel();
db_end_transaction(0);
fossil_print(" \r");
if( omitRebuild ){
omitVacuum = 1;
}else{
db_begin_write();
fossil_print("Rebuilding repository meta-data...\n");
rebuild_db(0, 1, !incrFlag);
verify_cancel();
db_end_transaction(0);
}
if( !omitVacuum ){
fossil_print("Vacuuming..."); fflush(stdout);
|
| ︙ | ︙ |
Changes to src/info.c.
| ︙ | ︙ | |||
2719 2720 2721 2722 2723 2724 2725 |
md5sum_blob(ctrl, &cksum);
blob_appendf(ctrl, "Z %b\n", &cksum);
if( fDryRun ){
assert( g.isHTTP==0 ); /* Only print control artifact in console mode. */
fossil_print("%s", blob_str(ctrl));
blob_reset(ctrl);
}else{
| | | 2719 2720 2721 2722 2723 2724 2725 2726 2727 2728 2729 2730 2731 2732 2733 |
md5sum_blob(ctrl, &cksum);
blob_appendf(ctrl, "Z %b\n", &cksum);
if( fDryRun ){
assert( g.isHTTP==0 ); /* Only print control artifact in console mode. */
fossil_print("%s", blob_str(ctrl));
blob_reset(ctrl);
}else{
db_begin_write();
g.markPrivate = content_is_private(rid);
nrid = content_put(ctrl);
manifest_crosslink(nrid, ctrl, MC_PERMIT_HOOKS);
db_end_transaction(0);
}
assert( blob_is_reset(ctrl) );
}
|
| ︙ | ︙ |
Changes to src/json.c.
| ︙ | ︙ | |||
2101 2102 2103 2104 2105 2106 2107 |
On large repos (e.g. fossil's) this operation is likely to take
longer than the client timeout, which will cause it to fail (but
it's sqlite3, so it'll fail gracefully).
*/
db_close(1);
db_open_repository(g.zRepositoryName);
| | | 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 |
On large repos (e.g. fossil's) this operation is likely to take
longer than the client timeout, which will cause it to fail (but
it's sqlite3, so it'll fail gracefully).
*/
db_close(1);
db_open_repository(g.zRepositoryName);
db_begin_write();
rebuild_db(0, 0, 0);
db_end_transaction(0);
return NULL;
}
}
/*
|
| ︙ | ︙ |
Changes to src/json_branch.c.
| ︙ | ︙ | |||
210 211 212 213 214 215 216 |
" WHERE tagtype>0"
" AND tagid=(SELECT tagid FROM tag WHERE tagname='sym-%q')",
zBranch)!=0 ){
zOpt->rcErrMsg = "Branch already exists.";
return FSL_JSON_E_RESOURCE_ALREADY_EXISTS;
}
| | | 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 |
" WHERE tagtype>0"
" AND tagid=(SELECT tagid FROM tag WHERE tagname='sym-%q')",
zBranch)!=0 ){
zOpt->rcErrMsg = "Branch already exists.";
return FSL_JSON_E_RESOURCE_ALREADY_EXISTS;
}
db_begin_write();
rootid = name_to_typed_rid(zBasis, "ci");
if( rootid==0 ){
zOpt->rcErrMsg = "Basis branch not found.";
return FSL_JSON_E_RESOURCE_NOT_FOUND;
}
pParent = manifest_get(rootid, CFTYPE_MANIFEST, 0);
|
| ︙ | ︙ |
Changes to src/json_tag.c.
| ︙ | ︙ | |||
96 97 98 99 100 101 102 |
zValue = json_find_option_cstr("value",NULL,NULL);
if(!zValue && !fossil_has_json()){
zValue = json_command_arg(5);
}
| | | 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 |
zValue = json_find_option_cstr("value",NULL,NULL);
if(!zValue && !fossil_has_json()){
zValue = json_command_arg(5);
}
db_begin_write();
tag_add_artifact(zPrefix, zName, zCheckin, zValue,
1+fPropagate,NULL/*DateOvrd*/,NULL/*UserOvrd*/);
db_end_transaction(0);
payV = cson_value_new_object();
pay = cson_value_get_object(payV);
cson_object_set(pay, "name", json_new_string(zName) );
|
| ︙ | ︙ | |||
176 177 178 179 180 181 182 |
"'checkin' parameter is missing.");
return NULL;
}
}
/* FIXME?: verify that the tag is currently active. We have no real
error case unless we do that.
*/
| | | 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 |
"'checkin' parameter is missing.");
return NULL;
}
}
/* FIXME?: verify that the tag is currently active. We have no real
error case unless we do that.
*/
db_begin_write();
tag_add_artifact(zPrefix, zName, zCheckin, NULL, 0, 0, 0);
db_end_transaction(0);
return NULL;
}
/*
|
| ︙ | ︙ |
Changes to src/login.c.
| ︙ | ︙ | |||
1909 1910 1911 1912 1913 1914 1915 | } /* Create all the necessary CONFIG table entries on both the ** other repository and on our own repository. */ zSelfProjCode = abbreviated_project_code(zSelfProjCode); zOtherProjCode = abbreviated_project_code(zOtherProjCode); | | | 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 |
}
/* Create all the necessary CONFIG table entries on both the
** other repository and on our own repository.
*/
zSelfProjCode = abbreviated_project_code(zSelfProjCode);
zOtherProjCode = abbreviated_project_code(zOtherProjCode);
db_begin_write();
db_multi_exec(
"DELETE FROM \"%w\".config WHERE name GLOB 'peer-*';"
"INSERT INTO \"%w\".config(name,value) VALUES('peer-repo-%q',%Q);"
"INSERT INTO \"%w\".config(name,value) "
" SELECT 'peer-name-%q', value FROM other.config"
" WHERE name='project-name';",
zSelf,
|
| ︙ | ︙ |
Changes to src/main.c.
| ︙ | ︙ | |||
2204 2205 2206 2207 2208 2209 2210 |
g.zRepositoryName = mprintf("%s", zRepo);
file_simplify_name(g.zRepositoryName, -1, 0);
}else{
if( isDir==0 && fCreate ){
const char *zPassword;
db_create_repository(zRepo);
db_open_repository(zRepo);
| | | 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 |
g.zRepositoryName = mprintf("%s", zRepo);
file_simplify_name(g.zRepositoryName, -1, 0);
}else{
if( isDir==0 && fCreate ){
const char *zPassword;
db_create_repository(zRepo);
db_open_repository(zRepo);
db_begin_write();
g.eHashPolicy = HPOLICY_SHA3;
db_set_int("hash-policy", HPOLICY_SHA3, 0);
db_initial_setup(0, "now", g.zLogin);
db_end_transaction(0);
fossil_print("project-id: %s\n", db_get("project-code", 0));
fossil_print("server-id: %s\n", db_get("server-code", 0));
zPassword = db_text(0, "SELECT pw FROM user WHERE login=%Q", g.zLogin);
|
| ︙ | ︙ |
Changes to src/manifest.c.
| ︙ | ︙ | |||
1804 1805 1806 1807 1808 1809 1810 |
** processing that must be deferred until all artifacts have been
** seen at least once. The deferred processing is accomplished
** by the call to manifest_crosslink_end().
*/
void manifest_crosslink_begin(void){
assert( manifest_crosslink_busy==0 );
manifest_crosslink_busy = 1;
| | | 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 |
** processing that must be deferred until all artifacts have been
** seen at least once. The deferred processing is accomplished
** by the call to manifest_crosslink_end().
*/
void manifest_crosslink_begin(void){
assert( manifest_crosslink_busy==0 );
manifest_crosslink_busy = 1;
db_begin_write();
db_multi_exec(
"CREATE TEMP TABLE pending_tkt(uuid TEXT UNIQUE);"
"CREATE TEMP TABLE time_fudge("
" mid INTEGER PRIMARY KEY," /* The rid of a manifest */
" m1 REAL," /* The timestamp on mid */
" cid INTEGER," /* A child or mid */
" m2 REAL" /* Timestamp on the child */
|
| ︙ | ︙ | |||
2097 2098 2099 2100 2101 2102 2103 |
assert( blob_is_reset(pContent) );
if( (flags & MC_NO_ERRORS)==0 ){
fossil_error(1, "cannot fetch baseline for manifest [%S]",
db_text(0, "SELECT uuid FROM blob WHERE rid=%d",rid));
}
return 0;
}
| | | 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 |
assert( blob_is_reset(pContent) );
if( (flags & MC_NO_ERRORS)==0 ){
fossil_error(1, "cannot fetch baseline for manifest [%S]",
db_text(0, "SELECT uuid FROM blob WHERE rid=%d",rid));
}
return 0;
}
db_begin_write();
if( p->type==CFTYPE_MANIFEST ){
if( permitHooks ){
zScript = xfer_commit_code();
zUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", rid);
}
if( p->nCherrypick && db_table_exists("repository","cherrypick") ){
int i;
|
| ︙ | ︙ |
Changes to src/merge.c.
| ︙ | ︙ | |||
394 395 396 397 398 399 400 |
}
if( verboseFlag ){
print_checkin_description(mid, 12,
integrateFlag ? "integrate:" : "merge-from:");
print_checkin_description(pid, 12, "baseline:");
}
vfile_check_signature(vid, CKSIG_ENOTFILE);
| | | 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 |
}
if( verboseFlag ){
print_checkin_description(mid, 12,
integrateFlag ? "integrate:" : "merge-from:");
print_checkin_description(pid, 12, "baseline:");
}
vfile_check_signature(vid, CKSIG_ENOTFILE);
db_begin_write();
if( !dryRunFlag ) undo_begin();
if( load_vfile_from_rid(mid) && !forceMissingFlag ){
fossil_fatal("missing content, unable to merge");
}
if( load_vfile_from_rid(pid) && !forceMissingFlag ){
fossil_fatal("missing content, unable to merge");
}
|
| ︙ | ︙ |
Changes to src/moderate.c.
| ︙ | ︙ | |||
105 106 107 108 109 110 111 |
*/
void moderation_disapprove(int objid){
Stmt q;
char *zTktid;
int attachRid = 0;
int rid;
if( !moderation_pending(objid) ) return;
| | | 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 |
*/
void moderation_disapprove(int objid){
Stmt q;
char *zTktid;
int attachRid = 0;
int rid;
if( !moderation_pending(objid) ) return;
db_begin_write();
rid = objid;
while( rid && content_is_private(rid) ){
db_prepare(&q, "SELECT rid FROM delta WHERE srcid=%d", rid);
while( db_step(&q)==SQLITE_ROW ){
int ridUser = db_column_int(&q, 0);
content_undelta(ridUser);
}
|
| ︙ | ︙ | |||
147 148 149 150 151 152 153 |
}
/*
** Approve an object held for moderation.
*/
void moderation_approve(int rid){
if( !moderation_pending(rid) ) return;
| | | 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 |
}
/*
** Approve an object held for moderation.
*/
void moderation_approve(int rid){
if( !moderation_pending(rid) ) return;
db_begin_write();
db_multi_exec(
"DELETE FROM private WHERE rid=%d;"
"INSERT OR IGNORE INTO unclustered VALUES(%d);"
"INSERT OR IGNORE INTO unsent VALUES(%d);",
rid, rid, rid
);
db_multi_exec("DELETE FROM modreq WHERE objid=%d", rid);
|
| ︙ | ︙ |
Changes to src/publish.c.
| ︙ | ︙ | |||
75 76 77 78 79 80 81 |
int bTest = find_option("test",0,0)!=0; /* Undocumented --test option */
int bExclusive = find_option("exclusive",0,0)!=0; /* undocumented */
int i;
db_find_and_open_repository(0,0);
verify_all_options();
if( g.argc<3 ) usage("?--only? TAGS...");
| | | 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 |
int bTest = find_option("test",0,0)!=0; /* Undocumented --test option */
int bExclusive = find_option("exclusive",0,0)!=0; /* undocumented */
int i;
db_find_and_open_repository(0,0);
verify_all_options();
if( g.argc<3 ) usage("?--only? TAGS...");
db_begin_write();
db_multi_exec("CREATE TEMP TABLE ok(rid INTEGER PRIMARY KEY);");
for(i=2; i<g.argc; i++){
int rid = name_to_rid(g.argv[i]);
if( db_exists("SELECT 1 FROM tagxref"
" WHERE rid=%d AND tagid=%d"
" AND tagtype>0 AND value=%Q",
rid,TAG_BRANCH,g.argv[i]) ){
|
| ︙ | ︙ |
Changes to src/purge.c.
| ︙ | ︙ | |||
101 102 103 104 105 106 107 |
unsigned purgeFlags /* zero or more PURGE_* flags */
){
int peid = 0; /* New purgeevent ID */
Stmt q; /* General-use prepared statement */
char *z;
assert( g.repositoryOpen ); /* Main database must already be open */
| | | 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 |
unsigned purgeFlags /* zero or more PURGE_* flags */
){
int peid = 0; /* New purgeevent ID */
Stmt q; /* General-use prepared statement */
char *z;
assert( g.repositoryOpen ); /* Main database must already be open */
db_begin_write();
z = sqlite3_mprintf("IN \"%w\"", zTab);
describe_artifacts(z);
sqlite3_free(z);
describe_artifacts_to_stdout(0, 0);
/* The explain-only flags causes this routine to list the artifacts
** that would have been purged but to not actually make any changes
|
| ︙ | ︙ | |||
258 259 260 261 262 263 264 |
** not in the set.
**
** The "fossil publish" command with the (undocumented) --test and
** --exclusive options can be used for interactiving testing of this
** function.
*/
void find_checkin_associates(const char *zTab, int bExclusive){
| | | 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 |
** not in the set.
**
** The "fossil publish" command with the (undocumented) --test and
** --exclusive options can be used for interactiving testing of this
** function.
*/
void find_checkin_associates(const char *zTab, int bExclusive){
db_begin_write();
/* Compute the set of files that need to be added to zTab */
db_multi_exec("CREATE TEMP TABLE \"%w_files\"(fid INTEGER PRIMARY KEY)",zTab);
db_multi_exec(
"INSERT OR IGNORE INTO \"%w_files\"(fid)"
" SELECT fid FROM mlink WHERE fid!=0 AND mid IN \"%w\"",
zTab, zTab
|
| ︙ | ︙ | |||
533 534 535 536 537 538 539 |
db_find_and_open_repository(0,0);
n = (int)strlen(zSubcmd);
if( find_option("explain",0,0)!=0 || find_option("dry-run",0,0)!=0 ){
purgeFlags |= PURGE_EXPLAIN_ONLY;
}
if( strncmp(zSubcmd, "artifacts", n)==0 ){
verify_all_options();
| | | 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 |
db_find_and_open_repository(0,0);
n = (int)strlen(zSubcmd);
if( find_option("explain",0,0)!=0 || find_option("dry-run",0,0)!=0 ){
purgeFlags |= PURGE_EXPLAIN_ONLY;
}
if( strncmp(zSubcmd, "artifacts", n)==0 ){
verify_all_options();
db_begin_write();
db_multi_exec("CREATE TEMP TABLE ok(rid INTEGER PRIMARY KEY)");
for(i=3; i<g.argc; i++){
int r = name_to_typed_rid(g.argv[i], "");
db_multi_exec("INSERT OR IGNORE INTO ok(rid) VALUES(%d);", r);
}
describe_artifacts_to_stdout("IN ok", 0);
purge_artifact_list("ok", "", purgeFlags);
|
| ︙ | ︙ | |||
560 561 562 563 564 565 566 |
}
}else if( strncmp(zSubcmd, "checkins", n)==0 ){
int vid;
if( find_option("explain",0,0)!=0 || find_option("dry-run",0,0)!=0 ){
purgeFlags |= PURGE_EXPLAIN_ONLY;
}
verify_all_options();
| | | | 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 |
}
}else if( strncmp(zSubcmd, "checkins", n)==0 ){
int vid;
if( find_option("explain",0,0)!=0 || find_option("dry-run",0,0)!=0 ){
purgeFlags |= PURGE_EXPLAIN_ONLY;
}
verify_all_options();
db_begin_write();
if( g.argc<=3 ) usage("checkins TAGS... [OPTIONS]");
db_multi_exec("CREATE TEMP TABLE ok(rid INTEGER PRIMARY KEY)");
for(i=3; i<g.argc; i++){
int r = name_to_typed_rid(g.argv[i], "br");
compute_descendants(r, 1000000000);
}
vid = db_lget_int("checkout",0);
if( db_exists("SELECT 1 FROM ok WHERE rid=%d",vid) ){
fossil_fatal("cannot purge the current checkout");
}
find_checkin_associates("ok", 1);
purge_artifact_list("ok", "", purgeFlags);
db_end_transaction(0);
}else if( strncmp(zSubcmd, "files", n)==0 ){
verify_all_options();
db_begin_write();
db_multi_exec("CREATE TEMP TABLE ok(rid INTEGER PRIMARY KEY)");
for(i=3; i<g.argc; i++){
db_multi_exec(
"INSERT OR IGNORE INTO ok(rid) "
" SELECT fid FROM mlink, filename"
" WHERE mlink.fnid=filename.fnid"
" AND (filename.name=%Q OR filename.name GLOB '%q/*')",
|
| ︙ | ︙ | |||
616 617 618 619 620 621 622 |
"Obliterating the graveyard will permanently delete information.\n"
"Changes cannot be undone. Continue (y/N)? ", &ans);
cReply = blob_str(&ans)[0];
if( cReply!='y' && cReply!='Y' ){
fossil_exit(1);
}
}
| | | | 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 |
"Obliterating the graveyard will permanently delete information.\n"
"Changes cannot be undone. Continue (y/N)? ", &ans);
cReply = blob_str(&ans)[0];
if( cReply!='y' && cReply!='Y' ){
fossil_exit(1);
}
}
db_begin_write();
for(i=3; i<g.argc; i++){
int peid = atoi(g.argv[i]);
if( !db_exists("SELECT 1 FROM purgeevent WHERE peid=%d",peid) ){
fossil_fatal("no such purge event: %s", g.argv[i]);
}
db_multi_exec(
"DELETE FROM purgeevent WHERE peid=%d;"
"DELETE FROM purgeitem WHERE peid=%d;",
peid, peid
);
}
db_end_transaction(0);
}else if( strncmp(zSubcmd, "tickets", n)==0 ){
fossil_fatal("not yet implemented....");
}else if( strncmp(zSubcmd, "undo", n)==0 ){
int peid;
if( g.argc!=4 ) usage("undo ID");
peid = atoi(g.argv[3]);
if( (purgeFlags & PURGE_EXPLAIN_ONLY)==0 ){
db_begin_write();
db_multi_exec(
"CREATE TEMP TABLE ix("
" piid INTEGER PRIMARY KEY,"
" srcid INTEGER"
");"
"CREATE INDEX ixsrcid ON ix(srcid);"
"INSERT INTO ix(piid,srcid) "
|
| ︙ | ︙ |
Changes to src/rebuild.c.
| ︙ | ︙ | |||
39 40 41 42 43 44 45 |
/* Verify that the MLINK table has the newer columns added by the
** 2015-01-24 schema change. Create them if necessary. This code
** can be removed in the future, once all users have upgraded to the
** 2015-01-24 or later schema.
*/
if( !db_table_has_column("repository","mlink","isaux") ){
| | | 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
/* Verify that the MLINK table has the newer columns added by the
** 2015-01-24 schema change. Create them if necessary. This code
** can be removed in the future, once all users have upgraded to the
** 2015-01-24 or later schema.
*/
if( !db_table_has_column("repository","mlink","isaux") ){
db_begin_write();
db_multi_exec(
"ALTER TABLE repository.mlink ADD COLUMN pmid INTEGER DEFAULT 0;"
"ALTER TABLE repository.mlink ADD COLUMN isaux BOOLEAN DEFAULT 0;"
);
db_end_transaction(0);
}
|
| ︙ | ︙ | |||
484 485 486 487 488 489 490 |
*/
void extra_deltification(void){
Stmt q;
int aPrev[N_NEIGHBOR];
int nPrev;
int rid;
int prevfnid, fnid;
| | | 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 |
*/
void extra_deltification(void){
Stmt q;
int aPrev[N_NEIGHBOR];
int nPrev;
int rid;
int prevfnid, fnid;
db_begin_write();
/* Look for manifests that have not been deltaed and try to make them
** children of one of the 5 chronologically subsequent check-ins
*/
db_prepare(&q,
"SELECT rid FROM event, blob"
" WHERE blob.rid=event.objid"
|
| ︙ | ︙ | |||
659 660 661 662 663 664 665 |
if( optIfNeeded && fossil_strcmp(db_get("aux-schema",""),AUX_SCHEMA_MAX)==0 ){
return;
}
/* We should be done with options.. */
verify_all_options();
| | | 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 |
if( optIfNeeded && fossil_strcmp(db_get("aux-schema",""),AUX_SCHEMA_MAX)==0 ){
return;
}
/* We should be done with options.. */
verify_all_options();
db_begin_write();
if( !compressOnlyFlag ){
search_drop_index();
ttyOutput = 1;
errCnt = rebuild_db(randomizeFlag, 1, doClustering);
reconstruct_private_table();
}
db_multi_exec(
|
| ︙ | ︙ | |||
747 748 749 750 751 752 753 |
** Change the project-code and make other changes in order to prevent
** the repository from ever again pushing or pulling to other
** repositories. Used to create a "test" repository for development
** testing by cloning a working project repository.
*/
void test_detach_cmd(void){
db_find_and_open_repository(0, 2);
| | | 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 |
** Change the project-code and make other changes in order to prevent
** the repository from ever again pushing or pulling to other
** repositories. Used to create a "test" repository for development
** testing by cloning a working project repository.
*/
void test_detach_cmd(void){
db_find_and_open_repository(0, 2);
db_begin_write();
db_multi_exec(
"DELETE FROM config WHERE name='last-sync-url';"
"UPDATE config SET value=lower(hex(randomblob(20)))"
" WHERE name='project-code';"
"UPDATE config SET value='detached-' || value"
" WHERE name='project-name' AND value NOT GLOB 'detached-*';"
);
|
| ︙ | ︙ | |||
775 776 777 778 779 780 781 |
db_find_and_open_repository(0, 0);
if( g.argc!=2 ){
usage("?REPOSITORY-FILENAME?");
}
db_close(1);
db_open_repository(g.zRepositoryName);
}
| | | 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 |
db_find_and_open_repository(0, 0);
if( g.argc!=2 ){
usage("?REPOSITORY-FILENAME?");
}
db_close(1);
db_open_repository(g.zRepositoryName);
}
db_begin_write();
create_cluster();
db_end_transaction(0);
}
/*
** COMMAND: test-clusters
**
|
| ︙ | ︙ | |||
896 897 898 899 900 901 902 |
"Scrubbing the repository will permanently delete information.\n"
"Changes cannot be undone. Continue (y/N)? ", &ans);
cReply = blob_str(&ans)[0];
if( cReply!='y' && cReply!='Y' ){
fossil_exit(1);
}
}
| | | 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 |
"Scrubbing the repository will permanently delete information.\n"
"Changes cannot be undone. Continue (y/N)? ", &ans);
cReply = blob_str(&ans)[0];
if( cReply!='y' && cReply!='Y' ){
fossil_exit(1);
}
}
db_begin_write();
if( privateOnly || bVerily ){
bNeedRebuild = db_exists("SELECT 1 FROM private");
delete_private_content();
}
if( !privateOnly ){
db_multi_exec(
"UPDATE user SET pw='';"
|
| ︙ | ︙ | |||
1165 1166 1167 1168 1169 1170 1171 | db_create_repository(g.argv[2]); db_open_repository(g.argv[2]); /* We should be done with options.. */ verify_all_options(); db_open_config(0, 0); | | | 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 |
db_create_repository(g.argv[2]);
db_open_repository(g.argv[2]);
/* We should be done with options.. */
verify_all_options();
db_open_config(0, 0);
db_begin_write();
db_initial_setup(0, 0, 0);
fossil_print("Reading files from directory \"%s\"...\n", g.argv[3]);
recon_read_dir(g.argv[3]);
fossil_print("\nBuilding the Fossil repository...\n");
rebuild_db(0, 1, 1);
|
| ︙ | ︙ |
Changes to src/search.c.
| ︙ | ︙ | |||
1879 1880 1881 1882 1883 1884 1885 |
if( iCmd==1 ){
if( search_index_exists() ) iAction = 2;
}
if( iCmd==2 ){
if( g.argc<3 ) usage("index (on|off)");
iAction = 1 + is_truth(g.argv[3]);
}
| | | 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 |
if( iCmd==1 ){
if( search_index_exists() ) iAction = 2;
}
if( iCmd==2 ){
if( g.argc<3 ) usage("index (on|off)");
iAction = 1 + is_truth(g.argv[3]);
}
db_begin_write();
/* Adjust search settings */
if( iCmd==3 || iCmd==4 ){
const char *zCtrl;
if( g.argc<4 ) usage(mprintf("%s STRING",zSubCmd));
zCtrl = g.argv[3];
for(j=0; j<count(aSetng); j++){
|
| ︙ | ︙ |
Changes to src/setup.c.
| ︙ | ︙ | |||
322 323 324 325 326 327 328 |
login_check_credentials();
if( !g.perm.Setup ){
login_needed(0);
return;
}
style_header("Access Control Settings");
| | | 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 |
login_check_credentials();
if( !g.perm.Setup ){
login_needed(0);
return;
}
style_header("Access Control Settings");
db_begin_write();
@ <form action="%s(g.zTop)/setup_access" method="post"><div>
login_insert_csrf_secret();
@ <input type="submit" name="submit" value="Apply Changes" /></p>
@ <hr />
multiple_choice_attribute("Redirect to HTTPS",
"redirect-to-https", "redirhttps", "0",
count(azRedirectOpts)/2, azRedirectOpts);
|
| ︙ | ︙ | |||
677 678 679 680 681 682 683 |
login_check_credentials();
if( !g.perm.Admin ){
login_needed(0);
return;
}
style_header("Timeline Display Preferences");
| | | 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 |
login_check_credentials();
if( !g.perm.Admin ){
login_needed(0);
return;
}
style_header("Timeline Display Preferences");
db_begin_write();
@ <form action="%s(g.zTop)/setup_timeline" method="post"><div>
login_insert_csrf_secret();
@ <p><input type="submit" name="submit" value="Apply Changes" /></p>
@ <hr />
onoff_attribute("Allow block-markup in timeline",
"timeline-block-markup", "tbm", 0, 0);
|
| ︙ | ︙ | |||
810 811 812 813 814 815 816 |
style_header("Settings");
if(!g.repositoryOpen){
/* Provide read-only access to versioned settings,
but only if no repo file was explicitly provided. */
db_open_local(0);
}
| | | 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 |
style_header("Settings");
if(!g.repositoryOpen){
/* Provide read-only access to versioned settings,
but only if no repo file was explicitly provided. */
db_open_local(0);
}
db_begin_write();
@ <p>Settings marked with (v) are "versionable" and will be overridden
@ by the contents of managed files named
@ "<tt>.fossil-settings/</tt><i>SETTING-NAME</i>".
@ If the file for a versionable setting exists, the value cannot be
@ changed on this screen.</p><hr /><p>
@
@ <form action="%s(g.zTop)/setup_settings" method="post"><div>
|
| ︙ | ︙ | |||
887 888 889 890 891 892 893 |
login_check_credentials();
if( !g.perm.Setup ){
login_needed(0);
return;
}
style_header("WWW Configuration");
| | | 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 |
login_check_credentials();
if( !g.perm.Setup ){
login_needed(0);
return;
}
style_header("WWW Configuration");
db_begin_write();
@ <form action="%s(g.zTop)/setup_config" method="post"><div>
login_insert_csrf_secret();
@ <input type="submit" name="submit" value="Apply Changes" /></p>
@ <hr />
entry_attribute("Project Name", 60, "project-name", "pn", "", 0);
@ <p>A brief project name so visitors know what this site is about.
@ The project name will also be used as the RSS feed title.
|
| ︙ | ︙ | |||
983 984 985 986 987 988 989 |
login_check_credentials();
if( !g.perm.Setup ){
login_needed(0);
return;
}
style_header("Wiki Configuration");
| | | 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 |
login_check_credentials();
if( !g.perm.Setup ){
login_needed(0);
return;
}
style_header("Wiki Configuration");
db_begin_write();
@ <form action="%s(g.zTop)/setup_wiki" method="post"><div>
login_insert_csrf_secret();
@ <input type="submit" name="submit" value="Apply Changes" /></p>
@ <hr />
onoff_attribute("Associate Wiki Pages With Branches, Tags, or Checkins",
"wiki-about", "wiki-about", 1, 0);
@ <p>
|
| ︙ | ︙ | |||
1043 1044 1045 1046 1047 1048 1049 |
login_check_credentials();
if( !g.perm.Admin ){
login_needed(0);
return;
}
style_header("Moderator For Wiki And Tickets");
| | | 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 |
login_check_credentials();
if( !g.perm.Admin ){
login_needed(0);
return;
}
style_header("Moderator For Wiki And Tickets");
db_begin_write();
@ <form action="%R/setup_modreq" method="post"><div>
login_insert_csrf_secret();
@ <hr />
onoff_attribute("Moderate ticket changes",
"modreq-tkt", "modreq-tkt", 0, 0);
@ <p>When enabled, any change to tickets is subject to the approval
@ by a ticket moderator - a user with the "q" or Mod-Tkt privilege.
|
| ︙ | ︙ | |||
1089 1090 1091 1092 1093 1094 1095 |
*/
void setup_adunit(void){
login_check_credentials();
if( !g.perm.Admin ){
login_needed(0);
return;
}
| | | 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 |
*/
void setup_adunit(void){
login_check_credentials();
if( !g.perm.Admin ){
login_needed(0);
return;
}
db_begin_write();
if( P("clear")!=0 && cgi_csrf_safe(1) ){
db_multi_exec("DELETE FROM config WHERE name GLOB 'adunit*'");
cgi_replace_parameter("adunit","");
}
style_header("Edit Ad Unit");
@ <form action="%s(g.zTop)/setup_adunit" method="post"><div>
|
| ︙ | ︙ | |||
1179 1180 1181 1182 1183 1184 1185 |
zBgMime = PD("bgim:mimetype","image/gif");
}
login_check_credentials();
if( !g.perm.Admin ){
login_needed(0);
return;
}
| | | 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 |
zBgMime = PD("bgim:mimetype","image/gif");
}
login_check_credentials();
if( !g.perm.Admin ){
login_needed(0);
return;
}
db_begin_write();
if( !cgi_csrf_safe(1) ){
/* Allow no state changes if not safe from CSRF */
}else if( P("setlogo")!=0 && zLogoMime && zLogoMime[0] && szLogoImg>0 ){
Blob img;
Stmt ins;
blob_init(&img, aLogoImg, szLogoImg);
db_prepare(&ins,
|
| ︙ | ︙ |
Changes to src/shun.c.
| ︙ | ︙ | |||
57 58 59 60 61 62 63 |
if( !g.perm.Admin ){
login_needed(0);
return;
}
if( P("rebuild") ){
db_close(1);
db_open_repository(g.zRepositoryName);
| | | 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 |
if( !g.perm.Admin ){
login_needed(0);
return;
}
if( P("rebuild") ){
db_close(1);
db_open_repository(g.zRepositoryName);
db_begin_write();
rebuild_db(0, 0, 0);
admin_log("Rebuilt database.");
db_end_transaction(0);
}
if( zUuid ){
char *p;
int i = 0;
|
| ︙ | ︙ |
Changes to src/skins.c.
| ︙ | ︙ | |||
461 462 463 464 465 466 467 |
int once;
login_check_credentials();
if( !g.perm.Admin ){
login_needed(0);
return;
}
| | | 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 |
int once;
login_check_credentials();
if( !g.perm.Admin ){
login_needed(0);
return;
}
db_begin_write();
zCurrent = getSkin(0);
for(i=0; i<count(aBuiltinSkin); i++){
aBuiltinSkin[i].zSQL = getSkin(aBuiltinSkin[i].zLabel);
}
if( cgi_csrf_safe(1) ){
/* Process requests to delete a user-defined skin */
|
| ︙ | ︙ | |||
762 763 764 765 766 767 768 |
zOrig = db_get(zKey, zDflt);
zContent = PD(zFile,zOrig);
if( P("revert")!=0 && cgi_csrf_safe(0) ){
zContent = zDflt;
isRevert = 1;
}
| | | 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 |
zOrig = db_get(zKey, zDflt);
zContent = PD(zFile,zOrig);
if( P("revert")!=0 && cgi_csrf_safe(0) ){
zContent = zDflt;
isRevert = 1;
}
db_begin_write();
style_header("%s", zTitle);
for(j=0; j<count(aSkinAttr); j++){
style_submenu_element(aSkinAttr[j].zSubmenu,
"%R/setup_skinedit?w=%d&basis=%h&sk=%d",j,zBasis,iSkin);
}
@ <form action="%s(g.zTop)/setup_skinedit" method="post"><div>
login_insert_csrf_secret();
|
| ︙ | ︙ |
Changes to src/stash.c.
| ︙ | ︙ | |||
578 579 580 581 582 583 584 |
void stash_cmd(void){
const char *zCmd;
int nCmd;
int stashid = 0;
undo_capture_command_line();
db_must_be_within_tree();
db_open_config(0, 0);
| | | 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 |
void stash_cmd(void){
const char *zCmd;
int nCmd;
int stashid = 0;
undo_capture_command_line();
db_must_be_within_tree();
db_open_config(0, 0);
db_begin_write();
stash_tables_exist_and_current();
if( g.argc<=2 ){
zCmd = "save";
}else{
zCmd = g.argv[2];
}
nCmd = strlen(zCmd);
|
| ︙ | ︙ |
Changes to src/tag.c.
| ︙ | ︙ | |||
272 273 274 275 276 277 278 |
}
rid = name_to_rid(g.argv[3]);
if( rid==0 ){
fossil_fatal("no such object: %s", g.argv[3]);
}
g.markPrivate = content_is_private(rid);
zValue = g.argc==5 ? g.argv[4] : 0;
| | | 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 |
}
rid = name_to_rid(g.argv[3]);
if( rid==0 ){
fossil_fatal("no such object: %s", g.argv[3]);
}
g.markPrivate = content_is_private(rid);
zValue = g.argc==5 ? g.argv[4] : 0;
db_begin_write();
tag_insert(zTag, tagtype, zValue, -1, 0.0, rid);
db_end_transaction(0);
}
/*
** OR this value into the tagtype argument to tag_add_artifact to
** cause the tag to be displayed on standard output rather than be
|
| ︙ | ︙ | |||
467 468 469 470 471 472 473 |
const char *zDateOvrd = find_option("date-override",0,1);
const char *zUserOvrd = find_option("user-override",0,1);
if( find_option("dryrun","n",0)!=0 ) dryRun = TAG_ADD_DRYRUN;
if( g.argc!=5 && g.argc!=6 ){
usage("add ?options? TAGNAME CHECK-IN ?VALUE?");
}
zValue = g.argc==6 ? g.argv[5] : 0;
| | | | 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 |
const char *zDateOvrd = find_option("date-override",0,1);
const char *zUserOvrd = find_option("user-override",0,1);
if( find_option("dryrun","n",0)!=0 ) dryRun = TAG_ADD_DRYRUN;
if( g.argc!=5 && g.argc!=6 ){
usage("add ?options? TAGNAME CHECK-IN ?VALUE?");
}
zValue = g.argc==6 ? g.argv[5] : 0;
db_begin_write();
tag_add_artifact(zPrefix, g.argv[3], g.argv[4], zValue,
1+fPropagate+dryRun,zDateOvrd,zUserOvrd);
db_end_transaction(0);
}else
if( strncmp(g.argv[2],"branch",n)==0 ){
fossil_fatal("the \"fossil tag branch\" command is discontinued\n"
"Use the \"fossil branch new\" command instead.");
}else
if( strncmp(g.argv[2],"cancel",n)==0 ){
int dryRun = 0;
int fRaw = find_option("raw","",0)!=0;
const char *zPrefix = fRaw ? "" : "sym-";
const char *zDateOvrd = find_option("date-override",0,1);
const char *zUserOvrd = find_option("user-override",0,1);
if( find_option("dryrun","n",0)!=0 ) dryRun = TAG_ADD_DRYRUN;
if( g.argc!=5 ){
usage("cancel ?options? TAGNAME CHECK-IN");
}
db_begin_write();
tag_add_artifact(zPrefix, g.argv[3], g.argv[4], 0, dryRun,
zDateOvrd, zUserOvrd);
db_end_transaction(0);
}else
if( strncmp(g.argv[2],"find",n)==0 ){
Stmt q;
|
| ︙ | ︙ |
Changes to src/tkt.c.
| ︙ | ︙ | |||
384 385 386 387 388 389 390 |
/*
** Repopulate the TICKET and TICKETCHNG tables from scratch using all
** available ticket artifacts.
*/
void ticket_rebuild(void){
Stmt q;
ticket_create_table(1);
| | | 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 |
/*
** Repopulate the TICKET and TICKETCHNG tables from scratch using all
** available ticket artifacts.
*/
void ticket_rebuild(void){
Stmt q;
ticket_create_table(1);
db_begin_write();
db_prepare(&q,"SELECT tagname FROM tag WHERE tagname GLOB 'tkt-*'");
while( db_step(&q)==SQLITE_ROW ){
const char *zName = db_column_text(&q, 0);
int len;
zName += 4;
len = strlen(zName);
if( len<20 || !validate16(zName, len) ) continue;
|
| ︙ | ︙ |
Changes to src/tktsetup.c.
| ︙ | ︙ | |||
889 890 891 892 893 894 895 |
return;
}
if( P("setup") ){
cgi_redirect("tktsetup");
}
style_header("Ticket Display On Timelines");
| | | 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 |
return;
}
if( P("setup") ){
cgi_redirect("tktsetup");
}
style_header("Ticket Display On Timelines");
db_begin_write();
@ <form action="%s(g.zTop)/tktsetup_timeline" method="post"><div>
login_insert_csrf_secret();
@ <hr />
entry_attribute("Ticket Title", 40, "ticket-title-expr", "t",
"title", 0);
@ <p>An SQL expression in a query against the TICKET table that will
|
| ︙ | ︙ |
Changes to src/undo.c.
| ︙ | ︙ | |||
459 460 461 462 463 464 465 |
const char *zCmd = isRedo ? "redo" : "undo";
if( !dryRunFlag ){
dryRunFlag = find_option("explain", 0, 0)!=0;
}
db_must_be_within_tree();
verify_all_options();
| | | 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 |
const char *zCmd = isRedo ? "redo" : "undo";
if( !dryRunFlag ){
dryRunFlag = find_option("explain", 0, 0)!=0;
}
db_must_be_within_tree();
verify_all_options();
db_begin_write();
undo_available = db_lget_int("undo_available", 0);
if( dryRunFlag ){
if( undo_available==0 ){
fossil_print("No undo or redo is available\n");
}else{
Stmt q;
int nChng = 0;
|
| ︙ | ︙ |
Changes to src/unversioned.c.
| ︙ | ︙ | |||
291 292 293 294 295 296 297 |
const char *zAs;
Blob file;
int i;
zAs = find_option("as",0,1);
if( zAs && g.argc!=4 ) usage("add DISKFILE --as UVFILE");
verify_all_options();
| | | 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 |
const char *zAs;
Blob file;
int i;
zAs = find_option("as",0,1);
if( zAs && g.argc!=4 ) usage("add DISKFILE --as UVFILE");
verify_all_options();
db_begin_write();
content_rcvid_init("#!fossil unversioned add");
for(i=3; i<g.argc; i++){
zIn = zAs ? zAs : g.argv[i];
if( zIn[0]==0 ){
zError = "be empty string";
}else if( zIn[0]=='/' ){
zError = "be absolute";
|
| ︙ | ︙ | |||
316 317 318 319 320 321 322 |
unversioned_write(zIn, &file, mtime);
blob_reset(&file);
}
db_end_transaction(0);
}else if( memcmp(zCmd, "cat", nCmd)==0 ){
int i;
verify_all_options();
| | | 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 |
unversioned_write(zIn, &file, mtime);
blob_reset(&file);
}
db_end_transaction(0);
}else if( memcmp(zCmd, "cat", nCmd)==0 ){
int i;
verify_all_options();
db_begin_write();
for(i=3; i<g.argc; i++){
Blob content;
if( unversioned_content(g.argv[i], &content)==0 ){
blob_write_to_file(&content, "-");
}
blob_reset(&content);
}
|
| ︙ | ︙ | |||
339 340 341 342 343 344 345 |
verify_all_options();
if( g.argc!=4) usage("edit UVFILE");
zUVFile = g.argv[3];
zEditor = fossil_text_editor();
if( zEditor==0 ) fossil_fatal("no text editor - set the VISUAL env variable");
zTFile = fossil_temp_filename();
if( zTFile==0 ) fossil_fatal("cannot find a temporary filename");
| | | 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 |
verify_all_options();
if( g.argc!=4) usage("edit UVFILE");
zUVFile = g.argv[3];
zEditor = fossil_text_editor();
if( zEditor==0 ) fossil_fatal("no text editor - set the VISUAL env variable");
zTFile = fossil_temp_filename();
if( zTFile==0 ) fossil_fatal("cannot find a temporary filename");
db_begin_write();
content_rcvid_init("#!fossil unversioned edit");
if( unversioned_content(zUVFile, &content) ){
fossil_fatal("no such uv-file: %Q", zUVFile);
}
if( looks_like_binary(&content) ){
fossil_fatal("cannot edit binary content");
}
|
| ︙ | ︙ | |||
429 430 431 432 433 434 435 |
g.argv[1] = "sync";
g.argv[2] = "--uv-noop";
sync_unversioned(syncFlags);
}else if( memcmp(zCmd, "remove", nCmd)==0 || memcmp(zCmd, "rm", nCmd)==0
|| memcmp(zCmd, "delete", nCmd)==0 ){
int i;
verify_all_options();
| | | | 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 |
g.argv[1] = "sync";
g.argv[2] = "--uv-noop";
sync_unversioned(syncFlags);
}else if( memcmp(zCmd, "remove", nCmd)==0 || memcmp(zCmd, "rm", nCmd)==0
|| memcmp(zCmd, "delete", nCmd)==0 ){
int i;
verify_all_options();
db_begin_write();
for(i=3; i<g.argc; i++){
db_multi_exec(
"UPDATE unversioned"
" SET hash=NULL, content=NULL, mtime=%lld, sz=0 WHERE name=%Q",
mtime, g.argv[i]
);
}
db_unset("uv-hash", 0);
db_end_transaction(0);
}else if( memcmp(zCmd,"sync",nCmd)==0 ){
unsigned syncFlags = unversioned_sync_flags(SYNC_UNVERSIONED);
g.argv[1] = "sync";
g.argv[2] = "--uv-noop";
sync_unversioned(syncFlags);
}else if( memcmp(zCmd, "touch", nCmd)==0 ){
int i;
verify_all_options();
db_begin_write();
for(i=3; i<g.argc; i++){
db_multi_exec(
"UPDATE unversioned SET mtime=%lld WHERE name=%Q",
mtime, g.argv[i]
);
}
db_unset("uv-hash", 0);
|
| ︙ | ︙ |
Changes to src/update.c.
| ︙ | ︙ | |||
227 228 229 230 231 232 233 |
if( tid==0 ) tid = vid;
}
if( tid==0 ){
return;
}
| | | 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 |
if( tid==0 ) tid = vid;
}
if( tid==0 ){
return;
}
db_begin_write();
db_multi_exec(
"CREATE TEMP TABLE dir_to_delete(name TEXT %s PRIMARY KEY)WITHOUT ROWID",
filename_collation()
);
vfile_check_signature(vid, CKSIG_ENOTFILE);
if( !dryRunFlag && !internalUpdate ) undo_begin();
if( load_vfile_from_rid(tid) && !forceMissingFlag ){
|
| ︙ | ︙ | |||
801 802 803 804 805 806 807 | } db_must_be_within_tree(); /* Get manifests of revert version and (if different) current checkout. */ pRvManifest = historical_manifest(zRevision); pCoManifest = zRevision ? historical_manifest(0) : 0; | | | 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 |
}
db_must_be_within_tree();
/* Get manifests of revert version and (if different) current checkout. */
pRvManifest = historical_manifest(zRevision);
pCoManifest = zRevision ? historical_manifest(0) : 0;
db_begin_write();
undo_begin();
db_multi_exec("CREATE TEMP TABLE torevert(name UNIQUE);");
if( g.argc>2 ){
for(i=2; i<g.argc; i++){
Blob fname;
zFile = mprintf("%/", g.argv[i]);
|
| ︙ | ︙ |
Changes to src/vfile.c.
| ︙ | ︙ | |||
79 80 81 82 83 84 85 |
Manifest *p;
ManifestFile *pFile;
if( db_exists("SELECT 1 FROM vfile WHERE vid=%d", vid) ){
return 0;
}
| | | 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 |
Manifest *p;
ManifestFile *pFile;
if( db_exists("SELECT 1 FROM vfile WHERE vid=%d", vid) ){
return 0;
}
db_begin_write();
p = manifest_get(vid, CFTYPE_MANIFEST, 0);
if( p==0 ) {
db_end_transaction(1);
return 0;
}
db_prepare(&ins,
"INSERT INTO vfile(vid,isexe,islink,rid,mrid,pathname,mhash) "
|
| ︙ | ︙ | |||
172 173 174 175 176 177 178 |
*/
void vfile_check_signature(int vid, unsigned int cksigFlags){
int nErr = 0;
Stmt q;
int useMtime = (cksigFlags & CKSIG_HASH)==0
&& db_get_boolean("mtime-changes", 1);
| | | 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 |
*/
void vfile_check_signature(int vid, unsigned int cksigFlags){
int nErr = 0;
Stmt q;
int useMtime = (cksigFlags & CKSIG_HASH)==0
&& db_get_boolean("mtime-changes", 1);
db_begin_write();
db_prepare(&q, "SELECT id, %Q || pathname,"
" vfile.mrid, deleted, chnged, uuid, size, mtime,"
" CASE WHEN isexe THEN %d WHEN islink THEN %d ELSE %d END"
" FROM vfile LEFT JOIN blob ON vfile.mrid=blob.rid"
" WHERE vid=%d ", g.zLocalRoot, PERM_EXE, PERM_LNK, PERM_REG,
vid);
while( db_step(&q)==SQLITE_ROW ){
|
| ︙ | ︙ |
Changes to src/wiki.c.
| ︙ | ︙ | |||
654 655 656 657 658 659 660 |
}
if( P("submit")!=0 && zBody!=0
&& (goodCaptcha = captcha_is_correct(0))
){
char *zDate;
Blob cksum;
blob_zero(&wiki);
| | | 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 |
}
if( P("submit")!=0 && zBody!=0
&& (goodCaptcha = captcha_is_correct(0))
){
char *zDate;
Blob cksum;
blob_zero(&wiki);
db_begin_write();
if( isSandbox ){
db_set("sandbox",zBody,0);
db_set("sandbox-mimetype",zMimetype,0);
}else{
login_verify_csrf_secret();
zDate = date_in_standard_format("now");
blob_appendf(&wiki, "D %s\n", zDate);
|
| ︙ | ︙ | |||
933 934 935 936 937 938 939 |
login_verify_csrf_secret();
pWiki = manifest_get(rid, CFTYPE_WIKI, 0);
if( pWiki ){
blob_append(&body, pWiki->zWiki, -1);
manifest_destroy(pWiki);
}
blob_zero(&wiki);
| | | 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 |
login_verify_csrf_secret();
pWiki = manifest_get(rid, CFTYPE_WIKI, 0);
if( pWiki ){
blob_append(&body, pWiki->zWiki, -1);
manifest_destroy(pWiki);
}
blob_zero(&wiki);
db_begin_write();
zDate = date_in_standard_format("now");
blob_appendf(&wiki, "D %s\n", zDate);
blob_appendf(&wiki, "L %F\n", zPageName);
if( fossil_strcmp(zMimetype, "text/x-fossil-wiki")!=0 ){
blob_appendf(&wiki, "N %s\n", zMimetype);
}
if( rid ){
|
| ︙ | ︙ | |||
1309 1310 1311 1312 1313 1314 1315 |
blob_appendf(&wiki, "U %F\n", login_name());
}
blob_appendf( &wiki, "W %d\n%s\n", blob_size(pContent),
blob_str(pContent) );
md5sum_blob(&wiki, &cksum);
blob_appendf(&wiki, "Z %b\n", &cksum);
blob_reset(&cksum);
| | | 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 |
blob_appendf(&wiki, "U %F\n", login_name());
}
blob_appendf( &wiki, "W %d\n%s\n", blob_size(pContent),
blob_str(pContent) );
md5sum_blob(&wiki, &cksum);
blob_appendf(&wiki, "Z %b\n", &cksum);
blob_reset(&cksum);
db_begin_write();
wiki_put(&wiki, 0, wiki_need_moderation(localUser));
db_end_transaction(0);
return 1;
}
/*
** Determine the rid for a tech note given either its id or its
|
| ︙ | ︙ |
Changes to src/xfer.c.
| ︙ | ︙ | |||
1165 1166 1167 1168 1169 1170 1171 |
xfer.pOut = cgi_output_blob();
xfer.mxSend = db_get_int("max-download", 5000000);
xfer.maxTime = db_get_int("max-download-time", 30);
if( xfer.maxTime<1 ) xfer.maxTime = 1;
xfer.maxTime += time(NULL);
g.xferPanic = 1;
| | | 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 |
xfer.pOut = cgi_output_blob();
xfer.mxSend = db_get_int("max-download", 5000000);
xfer.maxTime = db_get_int("max-download-time", 30);
if( xfer.maxTime<1 ) xfer.maxTime = 1;
xfer.maxTime += time(NULL);
g.xferPanic = 1;
db_begin_write();
db_multi_exec(
"CREATE TEMP TABLE onremote(rid INTEGER PRIMARY KEY);"
);
manifest_crosslink_begin();
rc = xfer_run_common_script();
if( rc==TH_ERROR ){
cgi_reset_content();
|
| ︙ | ︙ | |||
1886 1887 1888 1889 1890 1891 1892 |
fossil_print(zLabelFormat /*works-like:"%s%s%s%s%d"*/,
"", "Bytes", "Cards", "Artifacts", "Deltas");
}
while( go ){
int newPhantom = 0;
char *zRandomness;
| | | 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 |
fossil_print(zLabelFormat /*works-like:"%s%s%s%s%d"*/,
"", "Bytes", "Cards", "Artifacts", "Deltas");
}
while( go ){
int newPhantom = 0;
char *zRandomness;
db_begin_write();
db_record_repository_filename(0);
db_multi_exec(
"CREATE TEMP TABLE onremote(rid INTEGER PRIMARY KEY);"
);
manifest_crosslink_begin();
|
| ︙ | ︙ |