Fossil SCM
Issue a warning if the "push" or "sync" command is issued when "dont-push" is enable.
Commit
21ceccddd836d07094d88915bfe3bbb7e830cd25
Parent
e05fea385228ec8…
1 file changed
+12
-1
+12
-1
| --- src/sync.c | ||
| +++ src/sync.c | ||
| @@ -43,10 +43,13 @@ | ||
| 43 | 43 | const char *zPw; |
| 44 | 44 | int rc; |
| 45 | 45 | int configSync = 0; /* configuration changes transferred */ |
| 46 | 46 | if( g.fNoSync ){ |
| 47 | 47 | return 0; |
| 48 | + } | |
| 49 | + if( flags==AUTOSYNC_PUSH && db_get_boolean("dont-push",0) ){ | |
| 50 | + return 0; | |
| 48 | 51 | } |
| 49 | 52 | zAutosync = db_get("autosync", 0); |
| 50 | 53 | if( zAutosync ){ |
| 51 | 54 | if( (flags & AUTOSYNC_PUSH)!=0 && memcmp(zAutosync,"pull",4)==0 ){ |
| 52 | 55 | return 0; /* Do not auto-push when autosync=pullonly */ |
| @@ -185,10 +188,13 @@ | ||
| 185 | 188 | */ |
| 186 | 189 | void push_cmd(void){ |
| 187 | 190 | int syncFlags; |
| 188 | 191 | int bPrivate; |
| 189 | 192 | process_sync_args(&syncFlags, &bPrivate); |
| 193 | + if( db_get_boolean("dont-push",0) ){ | |
| 194 | + fossil_fatal("pushing is prohibited: the 'dont-push' option is set"); | |
| 195 | + } | |
| 190 | 196 | client_sync(1,0,0,bPrivate,0,0); |
| 191 | 197 | } |
| 192 | 198 | |
| 193 | 199 | |
| 194 | 200 | /* |
| @@ -219,12 +225,17 @@ | ||
| 219 | 225 | ** See also: clone, push, pull, remote-url |
| 220 | 226 | */ |
| 221 | 227 | void sync_cmd(void){ |
| 222 | 228 | int syncFlags; |
| 223 | 229 | int bPrivate; |
| 230 | + int pushFlag = 1; | |
| 224 | 231 | process_sync_args(&syncFlags, &bPrivate); |
| 225 | - client_sync(1,1,0,bPrivate,syncFlags,0); | |
| 232 | + if( db_get_boolean("dont-push",0) ) pushFlag = 0; | |
| 233 | + client_sync(pushFlag,1,0,bPrivate,syncFlags,0); | |
| 234 | + if( pushFlag==0 ){ | |
| 235 | + fossil_warning("pull only: the 'dont-push' option is set"); | |
| 236 | + } | |
| 226 | 237 | } |
| 227 | 238 | |
| 228 | 239 | /* |
| 229 | 240 | ** COMMAND: remote-url |
| 230 | 241 | ** |
| 231 | 242 |
| --- src/sync.c | |
| +++ src/sync.c | |
| @@ -43,10 +43,13 @@ | |
| 43 | const char *zPw; |
| 44 | int rc; |
| 45 | int configSync = 0; /* configuration changes transferred */ |
| 46 | if( g.fNoSync ){ |
| 47 | return 0; |
| 48 | } |
| 49 | zAutosync = db_get("autosync", 0); |
| 50 | if( zAutosync ){ |
| 51 | if( (flags & AUTOSYNC_PUSH)!=0 && memcmp(zAutosync,"pull",4)==0 ){ |
| 52 | return 0; /* Do not auto-push when autosync=pullonly */ |
| @@ -185,10 +188,13 @@ | |
| 185 | */ |
| 186 | void push_cmd(void){ |
| 187 | int syncFlags; |
| 188 | int bPrivate; |
| 189 | process_sync_args(&syncFlags, &bPrivate); |
| 190 | client_sync(1,0,0,bPrivate,0,0); |
| 191 | } |
| 192 | |
| 193 | |
| 194 | /* |
| @@ -219,12 +225,17 @@ | |
| 219 | ** See also: clone, push, pull, remote-url |
| 220 | */ |
| 221 | void sync_cmd(void){ |
| 222 | int syncFlags; |
| 223 | int bPrivate; |
| 224 | process_sync_args(&syncFlags, &bPrivate); |
| 225 | client_sync(1,1,0,bPrivate,syncFlags,0); |
| 226 | } |
| 227 | |
| 228 | /* |
| 229 | ** COMMAND: remote-url |
| 230 | ** |
| 231 |
| --- src/sync.c | |
| +++ src/sync.c | |
| @@ -43,10 +43,13 @@ | |
| 43 | const char *zPw; |
| 44 | int rc; |
| 45 | int configSync = 0; /* configuration changes transferred */ |
| 46 | if( g.fNoSync ){ |
| 47 | return 0; |
| 48 | } |
| 49 | if( flags==AUTOSYNC_PUSH && db_get_boolean("dont-push",0) ){ |
| 50 | return 0; |
| 51 | } |
| 52 | zAutosync = db_get("autosync", 0); |
| 53 | if( zAutosync ){ |
| 54 | if( (flags & AUTOSYNC_PUSH)!=0 && memcmp(zAutosync,"pull",4)==0 ){ |
| 55 | return 0; /* Do not auto-push when autosync=pullonly */ |
| @@ -185,10 +188,13 @@ | |
| 188 | */ |
| 189 | void push_cmd(void){ |
| 190 | int syncFlags; |
| 191 | int bPrivate; |
| 192 | process_sync_args(&syncFlags, &bPrivate); |
| 193 | if( db_get_boolean("dont-push",0) ){ |
| 194 | fossil_fatal("pushing is prohibited: the 'dont-push' option is set"); |
| 195 | } |
| 196 | client_sync(1,0,0,bPrivate,0,0); |
| 197 | } |
| 198 | |
| 199 | |
| 200 | /* |
| @@ -219,12 +225,17 @@ | |
| 225 | ** See also: clone, push, pull, remote-url |
| 226 | */ |
| 227 | void sync_cmd(void){ |
| 228 | int syncFlags; |
| 229 | int bPrivate; |
| 230 | int pushFlag = 1; |
| 231 | process_sync_args(&syncFlags, &bPrivate); |
| 232 | if( db_get_boolean("dont-push",0) ) pushFlag = 0; |
| 233 | client_sync(pushFlag,1,0,bPrivate,syncFlags,0); |
| 234 | if( pushFlag==0 ){ |
| 235 | fossil_warning("pull only: the 'dont-push' option is set"); |
| 236 | } |
| 237 | } |
| 238 | |
| 239 | /* |
| 240 | ** COMMAND: remote-url |
| 241 | ** |
| 242 |