Fossil SCM
Add the "pullonly" option to the "autosync" setting.
Commit
ea27129c88e9aae6329ec2725cb88b1787f58d8d
Parent
bf56b2ddf4082e7…
2 files changed
+4
-3
+11
-2
M
src/db.c
+4
-3
| --- src/db.c | ||
| +++ src/db.c | ||
| @@ -1473,13 +1473,14 @@ | ||
| 1473 | 1473 | ** |
| 1474 | 1474 | ** auto-captcha If enabled, the Login page will provide a button |
| 1475 | 1475 | ** which uses JavaScript to fill out the captcha for |
| 1476 | 1476 | ** the "anonymous" user. (Most bots cannot use JavaScript.) |
| 1477 | 1477 | ** |
| 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. | |
| 1481 | 1482 | ** |
| 1482 | 1483 | ** clearsign When enabled (the default), fossil will attempt to |
| 1483 | 1484 | ** sign all commits with gpg. When disabled, commits will |
| 1484 | 1485 | ** be unsigned. |
| 1485 | 1486 | ** |
| 1486 | 1487 |
| --- 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 @@ | ||
| 41 | 41 | ** autosync. This will be a pull if the argument is true or a push |
| 42 | 42 | ** if the argument is false. |
| 43 | 43 | */ |
| 44 | 44 | void autosync(int flags){ |
| 45 | 45 | const char *zUrl; |
| 46 | + const char *zAutosync; | |
| 46 | 47 | if( g.fNoSync ){ |
| 47 | 48 | return; |
| 48 | 49 | } |
| 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. */ | |
| 51 | 60 | } |
| 52 | 61 | zUrl = db_get("last-sync-url", 0); |
| 53 | 62 | if( zUrl==0 ){ |
| 54 | 63 | return; /* No default server */ |
| 55 | 64 | } |
| 56 | 65 |
| --- 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 |