Fossil SCM

On a merge or update, prompt to continue of autosync fails, just like is done for commit.

drh 2016-05-30 22:30 trunk merge
Commit d685096f99a977909bcb8931a55d5cba2e02819c
+1 -1
--- src/branch.c
+++ src/branch.c
@@ -176,11 +176,11 @@
176176
177177
/* Commit */
178178
db_end_transaction(0);
179179
180180
/* Do an autosync push, if requested */
181
- if( !isPrivate ) autosync_loop(SYNC_PUSH, db_get_int("autosync-tries", 1));
181
+ if( !isPrivate ) autosync_loop(SYNC_PUSH, db_get_int("autosync-tries",1),0);
182182
}
183183
184184
#if INTERFACE
185185
/*
186186
** Allows bits in the mBplqFlags parameter to branch_prepare_list_query().
187187
--- src/branch.c
+++ src/branch.c
@@ -176,11 +176,11 @@
176
177 /* Commit */
178 db_end_transaction(0);
179
180 /* Do an autosync push, if requested */
181 if( !isPrivate ) autosync_loop(SYNC_PUSH, db_get_int("autosync-tries", 1));
182 }
183
184 #if INTERFACE
185 /*
186 ** Allows bits in the mBplqFlags parameter to branch_prepare_list_query().
187
--- src/branch.c
+++ src/branch.c
@@ -176,11 +176,11 @@
176
177 /* Commit */
178 db_end_transaction(0);
179
180 /* Do an autosync push, if requested */
181 if( !isPrivate ) autosync_loop(SYNC_PUSH, db_get_int("autosync-tries",1),0);
182 }
183
184 #if INTERFACE
185 /*
186 ** Allows bits in the mBplqFlags parameter to branch_prepare_list_query().
187
+3 -7
--- src/checkin.c
+++ src/checkin.c
@@ -1814,16 +1814,12 @@
18141814
18151815
/*
18161816
** Autosync if autosync is enabled and this is not a private check-in.
18171817
*/
18181818
if( !g.markPrivate ){
1819
- if( autosync_loop(SYNC_PULL, db_get_int("autosync-tries", 1)) ){
1820
- prompt_user("continue in spite of sync failure (y/N)? ", &ans);
1821
- cReply = blob_str(&ans)[0];
1822
- if( cReply!='y' && cReply!='Y' ){
1823
- fossil_exit(1);
1824
- }
1819
+ if( autosync_loop(SYNC_PULL, db_get_int("autosync-tries", 1), 1) ){
1820
+ fossil_exit(1);
18251821
}
18261822
}
18271823
18281824
/* Require confirmation to continue with the check-in if there is
18291825
** clock skew
@@ -2236,11 +2232,11 @@
22362232
exit(1);
22372233
}
22382234
db_end_transaction(0);
22392235
22402236
if( !g.markPrivate ){
2241
- autosync_loop(SYNC_PUSH|SYNC_PULL, db_get_int("autosync-tries", 1));
2237
+ autosync_loop(SYNC_PUSH|SYNC_PULL, db_get_int("autosync-tries", 1), 0);
22422238
}
22432239
if( count_nonbranch_children(vid)>1 ){
22442240
fossil_print("**** warning: a fork has occurred *****\n");
22452241
}
22462242
}
22472243
--- src/checkin.c
+++ src/checkin.c
@@ -1814,16 +1814,12 @@
1814
1815 /*
1816 ** Autosync if autosync is enabled and this is not a private check-in.
1817 */
1818 if( !g.markPrivate ){
1819 if( autosync_loop(SYNC_PULL, db_get_int("autosync-tries", 1)) ){
1820 prompt_user("continue in spite of sync failure (y/N)? ", &ans);
1821 cReply = blob_str(&ans)[0];
1822 if( cReply!='y' && cReply!='Y' ){
1823 fossil_exit(1);
1824 }
1825 }
1826 }
1827
1828 /* Require confirmation to continue with the check-in if there is
1829 ** clock skew
@@ -2236,11 +2232,11 @@
2236 exit(1);
2237 }
2238 db_end_transaction(0);
2239
2240 if( !g.markPrivate ){
2241 autosync_loop(SYNC_PUSH|SYNC_PULL, db_get_int("autosync-tries", 1));
2242 }
2243 if( count_nonbranch_children(vid)>1 ){
2244 fossil_print("**** warning: a fork has occurred *****\n");
2245 }
2246 }
2247
--- src/checkin.c
+++ src/checkin.c
@@ -1814,16 +1814,12 @@
1814
1815 /*
1816 ** Autosync if autosync is enabled and this is not a private check-in.
1817 */
1818 if( !g.markPrivate ){
1819 if( autosync_loop(SYNC_PULL, db_get_int("autosync-tries", 1), 1) ){
1820 fossil_exit(1);
 
 
 
 
1821 }
1822 }
1823
1824 /* Require confirmation to continue with the check-in if there is
1825 ** clock skew
@@ -2236,11 +2232,11 @@
2232 exit(1);
2233 }
2234 db_end_transaction(0);
2235
2236 if( !g.markPrivate ){
2237 autosync_loop(SYNC_PUSH|SYNC_PULL, db_get_int("autosync-tries", 1), 0);
2238 }
2239 if( count_nonbranch_children(vid)>1 ){
2240 fossil_print("**** warning: a fork has occurred *****\n");
2241 }
2242 }
2243
+2 -2
--- src/merge.c
+++ src/merge.c
@@ -265,12 +265,12 @@
265265
if( vid==0 ){
266266
fossil_fatal("nothing is checked out");
267267
}
268268
if( !dryRunFlag ){
269269
if( autosync_loop(SYNC_PULL + SYNC_VERBOSE*verboseFlag,
270
- db_get_int("autosync-tries", 1)) ){
271
- fossil_fatal("Cannot proceed with merge");
270
+ db_get_int("autosync-tries", 1), 1) ){
271
+ fossil_fatal("merge abandoned due to sync failure");
272272
}
273273
}
274274
275275
/* Find mid, the artifactID of the version to be merged into the current
276276
** check-out */
277277
--- src/merge.c
+++ src/merge.c
@@ -265,12 +265,12 @@
265 if( vid==0 ){
266 fossil_fatal("nothing is checked out");
267 }
268 if( !dryRunFlag ){
269 if( autosync_loop(SYNC_PULL + SYNC_VERBOSE*verboseFlag,
270 db_get_int("autosync-tries", 1)) ){
271 fossil_fatal("Cannot proceed with merge");
272 }
273 }
274
275 /* Find mid, the artifactID of the version to be merged into the current
276 ** check-out */
277
--- src/merge.c
+++ src/merge.c
@@ -265,12 +265,12 @@
265 if( vid==0 ){
266 fossil_fatal("nothing is checked out");
267 }
268 if( !dryRunFlag ){
269 if( autosync_loop(SYNC_PULL + SYNC_VERBOSE*verboseFlag,
270 db_get_int("autosync-tries", 1), 1) ){
271 fossil_fatal("merge abandoned due to sync failure");
272 }
273 }
274
275 /* Find mid, the artifactID of the version to be merged into the current
276 ** check-out */
277
+14 -2
--- src/sync.c
+++ src/sync.c
@@ -77,13 +77,17 @@
7777
return rc;
7878
}
7979
8080
/*
8181
** This routine will try a number of times to perform autosync with a
82
-** 0.5 second sleep between attempts; returning the last autosync status.
82
+** 0.5 second sleep between attempts.
83
+**
84
+** Return zero on success and non-zero on a failure. If failure occurs
85
+** and doPrompt flag is true, ask the user if they want to continue, and
86
+** if they answer "yes" then return zero in spite of the failure.
8387
*/
84
-int autosync_loop(int flags, int nTries){
88
+int autosync_loop(int flags, int nTries, int doPrompt){
8589
int n = 0;
8690
int rc = 0;
8791
while( (n==0 || n<nTries) && (rc=autosync(flags)) ){
8892
if( rc ){
8993
if( ++n<nTries ){
@@ -91,10 +95,18 @@
9195
sqlite3_sleep(500);
9296
}else{
9397
fossil_warning("Autosync failed.");
9498
}
9599
}
100
+ }
101
+ if( rc && doPrompt ){
102
+ Blob ans;
103
+ char cReply;
104
+ prompt_user("continue in spite of sync failure (y/N)? ", &ans);
105
+ cReply = blob_str(&ans)[0];
106
+ if( cReply=='y' || cReply=='Y' ) rc = 0;
107
+ blob_reset(&ans);
96108
}
97109
return rc;
98110
}
99111
100112
/*
101113
--- src/sync.c
+++ src/sync.c
@@ -77,13 +77,17 @@
77 return rc;
78 }
79
80 /*
81 ** This routine will try a number of times to perform autosync with a
82 ** 0.5 second sleep between attempts; returning the last autosync status.
 
 
 
 
83 */
84 int autosync_loop(int flags, int nTries){
85 int n = 0;
86 int rc = 0;
87 while( (n==0 || n<nTries) && (rc=autosync(flags)) ){
88 if( rc ){
89 if( ++n<nTries ){
@@ -91,10 +95,18 @@
91 sqlite3_sleep(500);
92 }else{
93 fossil_warning("Autosync failed.");
94 }
95 }
 
 
 
 
 
 
 
 
96 }
97 return rc;
98 }
99
100 /*
101
--- src/sync.c
+++ src/sync.c
@@ -77,13 +77,17 @@
77 return rc;
78 }
79
80 /*
81 ** This routine will try a number of times to perform autosync with a
82 ** 0.5 second sleep between attempts.
83 **
84 ** Return zero on success and non-zero on a failure. If failure occurs
85 ** and doPrompt flag is true, ask the user if they want to continue, and
86 ** if they answer "yes" then return zero in spite of the failure.
87 */
88 int autosync_loop(int flags, int nTries, int doPrompt){
89 int n = 0;
90 int rc = 0;
91 while( (n==0 || n<nTries) && (rc=autosync(flags)) ){
92 if( rc ){
93 if( ++n<nTries ){
@@ -91,10 +95,18 @@
95 sqlite3_sleep(500);
96 }else{
97 fossil_warning("Autosync failed.");
98 }
99 }
100 }
101 if( rc && doPrompt ){
102 Blob ans;
103 char cReply;
104 prompt_user("continue in spite of sync failure (y/N)? ", &ans);
105 cReply = blob_str(&ans)[0];
106 if( cReply=='y' || cReply=='Y' ) rc = 0;
107 blob_reset(&ans);
108 }
109 return rc;
110 }
111
112 /*
113
+2 -2
--- src/update.c
+++ src/update.c
@@ -153,12 +153,12 @@
153153
db_must_be_within_tree();
154154
vid = db_lget_int("checkout", 0);
155155
user_select();
156156
if( !dryRunFlag && !internalUpdate ){
157157
if( autosync_loop(SYNC_PULL + SYNC_VERBOSE*verboseFlag,
158
- db_get_int("autosync-tries", 1)) ){
159
- fossil_fatal("Cannot proceed with update");
158
+ db_get_int("autosync-tries", 1), 1) ){
159
+ fossil_fatal("update abandoned due to sync failure");
160160
}
161161
}
162162
163163
/* Create any empty directories now, as well as after the update,
164164
** so changes in settings are reflected now */
165165
--- src/update.c
+++ src/update.c
@@ -153,12 +153,12 @@
153 db_must_be_within_tree();
154 vid = db_lget_int("checkout", 0);
155 user_select();
156 if( !dryRunFlag && !internalUpdate ){
157 if( autosync_loop(SYNC_PULL + SYNC_VERBOSE*verboseFlag,
158 db_get_int("autosync-tries", 1)) ){
159 fossil_fatal("Cannot proceed with update");
160 }
161 }
162
163 /* Create any empty directories now, as well as after the update,
164 ** so changes in settings are reflected now */
165
--- src/update.c
+++ src/update.c
@@ -153,12 +153,12 @@
153 db_must_be_within_tree();
154 vid = db_lget_int("checkout", 0);
155 user_select();
156 if( !dryRunFlag && !internalUpdate ){
157 if( autosync_loop(SYNC_PULL + SYNC_VERBOSE*verboseFlag,
158 db_get_int("autosync-tries", 1), 1) ){
159 fossil_fatal("update abandoned due to sync failure");
160 }
161 }
162
163 /* Create any empty directories now, as well as after the update,
164 ** so changes in settings are reflected now */
165

Keyboard Shortcuts

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