Fossil SCM

Issue a warning if the "push" or "sync" command is issued when "dont-push" is enable.

drh 2011-05-27 14:37 trunk
Commit 21ceccddd836d07094d88915bfe3bbb7e830cd25
1 file changed +12 -1
+12 -1
--- src/sync.c
+++ src/sync.c
@@ -43,10 +43,13 @@
4343
const char *zPw;
4444
int rc;
4545
int configSync = 0; /* configuration changes transferred */
4646
if( g.fNoSync ){
4747
return 0;
48
+ }
49
+ if( flags==AUTOSYNC_PUSH && db_get_boolean("dont-push",0) ){
50
+ return 0;
4851
}
4952
zAutosync = db_get("autosync", 0);
5053
if( zAutosync ){
5154
if( (flags & AUTOSYNC_PUSH)!=0 && memcmp(zAutosync,"pull",4)==0 ){
5255
return 0; /* Do not auto-push when autosync=pullonly */
@@ -185,10 +188,13 @@
185188
*/
186189
void push_cmd(void){
187190
int syncFlags;
188191
int bPrivate;
189192
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
+ }
190196
client_sync(1,0,0,bPrivate,0,0);
191197
}
192198
193199
194200
/*
@@ -219,12 +225,17 @@
219225
** See also: clone, push, pull, remote-url
220226
*/
221227
void sync_cmd(void){
222228
int syncFlags;
223229
int bPrivate;
230
+ int pushFlag = 1;
224231
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
+ }
226237
}
227238
228239
/*
229240
** COMMAND: remote-url
230241
**
231242
--- 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

Keyboard Shortcuts

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