Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
| Comment: | Updates to the autosync logic. Add the "setting" command. |
|---|---|
| Downloads: | Tarball | ZIP archive |
| Timelines: | family | ancestors | descendants | both | trunk |
| Files: | files | file ages | folders |
| SHA1: |
fff234b77cc774ca649f8279cd50585a |
| User & Date: | drh 2007-09-25 20:23:52.000 |
Context
|
2007-09-25
| ||
| 20:35 | Fix a C++-ism in style.c check-in: 64569b3a7a user: drh tags: trunk | |
| 20:23 | Updates to the autosync logic. Add the "setting" command. check-in: fff234b77c user: drh tags: trunk | |
| 19:32 | Merger w/fossil chat update (5e3f) check-in: e6d1cd9679 user: jnc tags: trunk | |
Changes
Changes to src/branch.c.
| ︙ | ︙ | |||
155 156 157 158 159 160 161 | /* Clear the undo/redo stack */ undo_reset(); /* Commit */ db_end_transaction(0); | | | < < < < | 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 | /* Clear the undo/redo stack */ undo_reset(); /* Commit */ db_end_transaction(0); /* Do an autosync push, if requested */ autosync(0); } /* ** COMMAND: branch ** ** Usage: %fossil branch SUBCOMMAND ... ?-R|--repository FILE? ** |
| ︙ | ︙ |
Changes to src/checkin.c.
| ︙ | ︙ | |||
321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 |
Blob comment;
const char *zComment;
Stmt q;
Stmt q2;
char *zUuid, *zDate;
int noSign = 0; /* True to omit signing the manifest using GPG */
int isAMerge = 0; /* True if checking in a merge */
char *zManifestFile; /* Name of the manifest file */
Blob manifest;
Blob muuid; /* Manifest uuid */
Blob mcksum; /* Self-checksum on the manifest */
Blob cksum1, cksum2; /* Before and after commit checksums */
Blob cksum1b; /* Checksum recorded in the manifest */
noSign = find_option("nosign","",0)!=0;
zComment = find_option("comment","m",1);
db_must_be_within_tree();
noSign = db_get_int("omit-ci-sig", 0)|noSign;
verify_all_options();
| > > | > > > > > | > > > | 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 |
Blob comment;
const char *zComment;
Stmt q;
Stmt q2;
char *zUuid, *zDate;
int noSign = 0; /* True to omit signing the manifest using GPG */
int isAMerge = 0; /* True if checking in a merge */
int forceFlag = 0; /* Force a fork */
char *zManifestFile; /* Name of the manifest file */
Blob manifest;
Blob muuid; /* Manifest uuid */
Blob mcksum; /* Self-checksum on the manifest */
Blob cksum1, cksum2; /* Before and after commit checksums */
Blob cksum1b; /* Checksum recorded in the manifest */
noSign = find_option("nosign","",0)!=0;
zComment = find_option("comment","m",1);
forceFlag = find_option("force", "r", 0)!=0;
db_must_be_within_tree();
noSign = db_get_int("omit-ci-sig", 0)|noSign;
verify_all_options();
/*
** Autosync if requested.
*/
autosync(1);
/* There are two ways this command may be executed. If there are
** no arguments following the word "commit", then all modified files
** in the checked out directory are committed. If one or more arguments
** follows "commit", then only those files are committed.
**
** After the following function call has returned, the Global.aCommitFile[]
** array is allocated to contain the "id" field from the vfile table
** for each file to be committed. Or, if aCommitFile is NULL, all files
** should be committed.
*/
select_commit_files();
isAMerge = db_exists("SELECT 1 FROM vmerge");
if( g.aCommitFile && isAMerge ){
fossil_fatal("cannot do a partial commit of a merge");
}
user_select();
db_begin_transaction();
rc = unsaved_changes();
if( rc==0 && !isAMerge && !forceFlag ){
fossil_panic("nothing has changed");
}
/* If one or more files that were named on the command line have not
** been modified, bail out now.
*/
if( g.aCommitFile ){
Blob unmodified;
memset(&unmodified, 0, sizeof(Blob));
blob_init(&unmodified, 0, 0);
db_blob(&unmodified,
"SELECT pathname FROM vfile WHERE chnged = 0 AND file_is_selected(id)"
);
if( strlen(blob_str(&unmodified)) ){
fossil_panic("file %s has not changed", blob_str(&unmodified));
}
}
vid = db_lget_int("checkout", 0);
if( !forceFlag && db_exists("SELECT 1 FROM plink WHERE pid=%d", vid) ){
fossil_fatal("would fork. use -f or --force");
}
vfile_aggregate_checksum_disk(vid, &cksum1);
if( zComment ){
blob_zero(&comment);
blob_append(&comment, zComment, -1);
}else{
prepare_commit_comment(&comment);
}
|
| ︙ | ︙ | |||
522 523 524 525 526 527 528 | /* Clear the undo/redo stack */ undo_reset(); /* Commit */ db_end_transaction(0); | | | < < < | < | 532 533 534 535 536 537 538 539 540 541 | /* Clear the undo/redo stack */ undo_reset(); /* Commit */ db_end_transaction(0); /* Do an autosync push if requested */ autosync(0); } |
Changes to src/db.c.
| ︙ | ︙ | |||
954 955 956 957 958 959 960 |
db_prepare(&q, "SELECT name, value FROM global_config ORDER BY name");
while( db_step(&q)==SQLITE_ROW ){
printf("%s=%s\n", db_column_text(&q, 0), db_column_text(&q, 1));
}
db_finalize(&q);
}
}
| > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 |
db_prepare(&q, "SELECT name, value FROM global_config ORDER BY name");
while( db_step(&q)==SQLITE_ROW ){
printf("%s=%s\n", db_column_text(&q, 0), db_column_text(&q, 1));
}
db_finalize(&q);
}
}
/*
** COMMAND: setting
** %fossil setting ?PROPERTY? ?VALUE?
**
** With no arguments, list all properties and their values. With just
** a property name, show the value of that property. With a value
** arugment, change the property for the current repository.
*/
void setting_cmd(void){
static const char *azName[] = {
"autosync",
"safemerge"
};
int i;
db_find_and_open_repository();
if( g.argc==2 ){
for(i=0; i<sizeof(azName)/sizeof(azName[0]); i++){
printf("%-20s %d\n", azName[i], db_get_int(azName[i], 0));
}
}else if( g.argc==3 || g.argc==4 ){
const char *zName = g.argv[2];
int n = strlen(zName);
for(i=0; i<sizeof(azName)/sizeof(azName[0]); i++){
if( strncmp(azName[i], zName, n)==0 ) break;
}
if( i>=sizeof(azName)/sizeof(azName[0]) ){
fossil_fatal("no such setting: %s", zName);
}
if( g.argc==4 ){
db_set(azName[i], g.argv[3]);
}else{
printf("%-20s %d\n", azName[i], db_get_int(azName[i], 0));
}
}else{
usage("?PROPERTY? ?VALUE?");
}
}
|
Changes to src/sync.c.
| ︙ | ︙ | |||
24 25 26 27 28 29 30 | ** This file contains code used to push, pull, and sync a repository */ #include "config.h" #include "sync.h" #include <assert.h> /* | | | | > | | | < > > | > | > > > > > > > < > > > | 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 |
** This file contains code used to push, pull, and sync a repository
*/
#include "config.h"
#include "sync.h"
#include <assert.h>
/*
** If the respository is configured for autosyncing, then do an
** autosync. This will be a pull if the argument is true or a push
** if the argument is false. Return true if the autosync is done
** and false if autosync is not requested for the current repository.
*/
int autosync(int pullFlag){
const char *zUrl;
if( db_get_int("autosync", 0)==0 ){
return 0;
}
zUrl = db_get("last-sync-url", 0);
if( zUrl ){
return 0; /* No default server */
}
url_parse(zUrl);
if( g.urlIsFile ){
return 0; /* Network sync only */
}
if( g.urlPort!=80 ){
printf("Autosync: http://%s:%d%s\n", g.urlName, g.urlPort, g.urlPath);
}else{
printf("Autosync: http://%s%s\n", g.urlName, g.urlPath);
}
client_sync(!pullFlag, pullFlag, 0);
return 1;
}
/*
** This routine processes the command-line argument for push, pull,
** and sync. If a command-line argument is given, that is the URL
** of a server to sync against. If no argument is given, use the
** most recently synced URL. Remember the current URL for next time.
|
| ︙ | ︙ |
Changes to src/tag.c.
| ︙ | ︙ | |||
288 289 290 291 292 293 294 | md5sum_blob(&ctrl, &cksum); blob_appendf(&ctrl, "Z %b\n", &cksum); db_begin_transaction(); nrid = content_put(&ctrl, 0, 0); manifest_crosslink(nrid, &ctrl); db_end_transaction(0); | | | < < < < | 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 | md5sum_blob(&ctrl, &cksum); blob_appendf(&ctrl, "Z %b\n", &cksum); db_begin_transaction(); nrid = content_put(&ctrl, 0, 0); manifest_crosslink(nrid, &ctrl); db_end_transaction(0); /* Do an autosync push if requested */ autosync(0); } /* ** COMMAND: tag ** Usage: %fossil tag SUBCOMMAND ... ** ** Run various subcommands to control tags and properties |
| ︙ | ︙ |
Changes to src/update.c.
| ︙ | ︙ | |||
74 75 76 77 78 79 80 |
fossil_fatal("not a version: %s", g.argv[2]);
}
if( !is_a_version(tid) ){
fossil_fatal("not a version: %s", g.argv[2]);
}
}
| > | < < < < | 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 |
fossil_fatal("not a version: %s", g.argv[2]);
}
if( !is_a_version(tid) ){
fossil_fatal("not a version: %s", g.argv[2]);
}
}
/* Do an autosync pull prior to the update, if autosync is on */
autosync(1);
if( tid==0 ){
compute_leaves(vid);
if( !latestFlag && db_int(0, "SELECT count(*) FROM leaves")>1 ){
db_prepare(&q,
"%s "
" AND event.objid IN leaves"
|
| ︙ | ︙ |