Fossil SCM

Add the "pullonly" option to the "autosync" setting.

drh 2010-01-19 18:28 trunk
Commit ea27129c88e9aae6329ec2725cb88b1787f58d8d
2 files changed +4 -3 +11 -2
+4 -3
--- src/db.c
+++ src/db.c
@@ -1473,13 +1473,14 @@
14731473
**
14741474
** auto-captcha If enabled, the Login page will provide a button
14751475
** which uses JavaScript to fill out the captcha for
14761476
** the "anonymous" user. (Most bots cannot use JavaScript.)
14771477
**
1478
-** autosync If enabled, automatically pull prior to
1479
-** commit or update and automatically push
1480
-** after commit or tag or branch creation.
1478
+** autosync If enabled, automatically pull prior to commit
1479
+** or update and automatically push after commit or
1480
+** tag or branch creation. If the the value is "pullonly"
1481
+** then only pull operations occur automatically.
14811482
**
14821483
** clearsign When enabled (the default), fossil will attempt to
14831484
** sign all commits with gpg. When disabled, commits will
14841485
** be unsigned.
14851486
**
14861487
--- src/db.c
+++ src/db.c
@@ -1473,13 +1473,14 @@
1473 **
1474 ** auto-captcha If enabled, the Login page will provide a button
1475 ** which uses JavaScript to fill out the captcha for
1476 ** the "anonymous" user. (Most bots cannot use JavaScript.)
1477 **
1478 ** autosync If enabled, automatically pull prior to
1479 ** commit or update and automatically push
1480 ** after commit or tag or branch creation.
 
1481 **
1482 ** clearsign When enabled (the default), fossil will attempt to
1483 ** sign all commits with gpg. When disabled, commits will
1484 ** be unsigned.
1485 **
1486
--- src/db.c
+++ src/db.c
@@ -1473,13 +1473,14 @@
1473 **
1474 ** auto-captcha If enabled, the Login page will provide a button
1475 ** which uses JavaScript to fill out the captcha for
1476 ** the "anonymous" user. (Most bots cannot use JavaScript.)
1477 **
1478 ** autosync If enabled, automatically pull prior to commit
1479 ** or update and automatically push after commit or
1480 ** tag or branch creation. If the the value is "pullonly"
1481 ** then only pull operations occur automatically.
1482 **
1483 ** clearsign When enabled (the default), fossil will attempt to
1484 ** sign all commits with gpg. When disabled, commits will
1485 ** be unsigned.
1486 **
1487
+11 -2
--- src/sync.c
+++ src/sync.c
@@ -41,15 +41,24 @@
4141
** autosync. This will be a pull if the argument is true or a push
4242
** if the argument is false.
4343
*/
4444
void autosync(int flags){
4545
const char *zUrl;
46
+ const char *zAutosync;
4647
if( g.fNoSync ){
4748
return;
4849
}
49
- if( db_get_boolean("autosync", 0)==0 ){
50
- return;
50
+ zAutosync = db_get("autosync", 0);
51
+ if( zAutosync ){
52
+ if( (flags & AUTOSYNC_PUSH)!=0 && memcmp(zAutosync,"pull",4)==0 ){
53
+ return; /* Do not auto-push when autosync=pullonly */
54
+ }
55
+ if( is_false(zAutosync) ){
56
+ return; /* Autosync is completely off */
57
+ }
58
+ }else{
59
+ /* Autosync defaults on. To make it default off, "return" here. */
5160
}
5261
zUrl = db_get("last-sync-url", 0);
5362
if( zUrl==0 ){
5463
return; /* No default server */
5564
}
5665
--- src/sync.c
+++ src/sync.c
@@ -41,15 +41,24 @@
41 ** autosync. This will be a pull if the argument is true or a push
42 ** if the argument is false.
43 */
44 void autosync(int flags){
45 const char *zUrl;
 
46 if( g.fNoSync ){
47 return;
48 }
49 if( db_get_boolean("autosync", 0)==0 ){
50 return;
 
 
 
 
 
 
 
 
51 }
52 zUrl = db_get("last-sync-url", 0);
53 if( zUrl==0 ){
54 return; /* No default server */
55 }
56
--- src/sync.c
+++ src/sync.c
@@ -41,15 +41,24 @@
41 ** autosync. This will be a pull if the argument is true or a push
42 ** if the argument is false.
43 */
44 void autosync(int flags){
45 const char *zUrl;
46 const char *zAutosync;
47 if( g.fNoSync ){
48 return;
49 }
50 zAutosync = db_get("autosync", 0);
51 if( zAutosync ){
52 if( (flags & AUTOSYNC_PUSH)!=0 && memcmp(zAutosync,"pull",4)==0 ){
53 return; /* Do not auto-push when autosync=pullonly */
54 }
55 if( is_false(zAutosync) ){
56 return; /* Autosync is completely off */
57 }
58 }else{
59 /* Autosync defaults on. To make it default off, "return" here. */
60 }
61 zUrl = db_get("last-sync-url", 0);
62 if( zUrl==0 ){
63 return; /* No default server */
64 }
65

Keyboard Shortcuts

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