Fossil SCM

The "fossil sync --all" command now makes up to two passes through the list of remote URLs to ensure that everybody gets synced up. See the discussion at [forum:/forumpost/4d6a94aca6105fc6|forum thread 4d6a94aca6105fc6].

drh 2024-03-22 12:28 trunk
Commit 0cd5589c09562b55edbf9b66c4825caa56d5a64abad2e85d2558cfd4bffe86ff
+1 -1
--- src/clone.c
+++ src/clone.c
@@ -260,11 +260,11 @@
260260
db_protect_pop();
261261
url_enable_proxy(0);
262262
clone_ssh_db_set_options();
263263
url_get_password_if_needed();
264264
g.xlinkClusterOnly = 1;
265
- nErr = client_sync(syncFlags,CONFIGSET_ALL,0,0);
265
+ nErr = client_sync(syncFlags,CONFIGSET_ALL,0,0,0);
266266
g.xlinkClusterOnly = 0;
267267
verify_cancel();
268268
db_end_transaction(0);
269269
db_close(1);
270270
if( nErr ){
271271
--- src/clone.c
+++ src/clone.c
@@ -260,11 +260,11 @@
260 db_protect_pop();
261 url_enable_proxy(0);
262 clone_ssh_db_set_options();
263 url_get_password_if_needed();
264 g.xlinkClusterOnly = 1;
265 nErr = client_sync(syncFlags,CONFIGSET_ALL,0,0);
266 g.xlinkClusterOnly = 0;
267 verify_cancel();
268 db_end_transaction(0);
269 db_close(1);
270 if( nErr ){
271
--- src/clone.c
+++ src/clone.c
@@ -260,11 +260,11 @@
260 db_protect_pop();
261 url_enable_proxy(0);
262 clone_ssh_db_set_options();
263 url_get_password_if_needed();
264 g.xlinkClusterOnly = 1;
265 nErr = client_sync(syncFlags,CONFIGSET_ALL,0,0,0);
266 g.xlinkClusterOnly = 0;
267 verify_cancel();
268 db_end_transaction(0);
269 db_close(1);
270 if( nErr ){
271
+3 -3
--- src/configure.c
+++ src/configure.c
@@ -871,17 +871,17 @@
871871
if( g.url.protocol==0 ) fossil_fatal("no server URL specified");
872872
user_select();
873873
url_enable_proxy("via proxy: ");
874874
if( overwriteFlag ) mask |= CONFIGSET_OVERWRITE;
875875
if( strncmp(zMethod, "push", n)==0 ){
876
- client_sync(0,0,(unsigned)mask,0);
876
+ client_sync(0,0,(unsigned)mask,0,0);
877877
}else if( strncmp(zMethod, "pull", n)==0 ){
878878
if( overwriteFlag ) db_unprotect(PROTECT_USER);
879
- client_sync(0,(unsigned)mask,0,0);
879
+ client_sync(0,(unsigned)mask,0,0,0);
880880
if( overwriteFlag ) db_protect_pop();
881881
}else{
882
- client_sync(0,(unsigned)mask,(unsigned)mask,0);
882
+ client_sync(0,(unsigned)mask,(unsigned)mask,0,0);
883883
}
884884
}else
885885
if( strncmp(zMethod, "reset", n)==0 ){
886886
int mask, i;
887887
char *zBackup;
888888
--- src/configure.c
+++ src/configure.c
@@ -871,17 +871,17 @@
871 if( g.url.protocol==0 ) fossil_fatal("no server URL specified");
872 user_select();
873 url_enable_proxy("via proxy: ");
874 if( overwriteFlag ) mask |= CONFIGSET_OVERWRITE;
875 if( strncmp(zMethod, "push", n)==0 ){
876 client_sync(0,0,(unsigned)mask,0);
877 }else if( strncmp(zMethod, "pull", n)==0 ){
878 if( overwriteFlag ) db_unprotect(PROTECT_USER);
879 client_sync(0,(unsigned)mask,0,0);
880 if( overwriteFlag ) db_protect_pop();
881 }else{
882 client_sync(0,(unsigned)mask,(unsigned)mask,0);
883 }
884 }else
885 if( strncmp(zMethod, "reset", n)==0 ){
886 int mask, i;
887 char *zBackup;
888
--- src/configure.c
+++ src/configure.c
@@ -871,17 +871,17 @@
871 if( g.url.protocol==0 ) fossil_fatal("no server URL specified");
872 user_select();
873 url_enable_proxy("via proxy: ");
874 if( overwriteFlag ) mask |= CONFIGSET_OVERWRITE;
875 if( strncmp(zMethod, "push", n)==0 ){
876 client_sync(0,0,(unsigned)mask,0,0);
877 }else if( strncmp(zMethod, "pull", n)==0 ){
878 if( overwriteFlag ) db_unprotect(PROTECT_USER);
879 client_sync(0,(unsigned)mask,0,0,0);
880 if( overwriteFlag ) db_protect_pop();
881 }else{
882 client_sync(0,(unsigned)mask,(unsigned)mask,0,0);
883 }
884 }else
885 if( strncmp(zMethod, "reset", n)==0 ){
886 int mask, i;
887 char *zBackup;
888
+68 -26
--- src/sync.c
+++ src/sync.c
@@ -52,20 +52,32 @@
5252
unsigned syncFlags, /* Mask of SYNC_* flags */
5353
unsigned configRcvMask, /* Receive these configuration items */
5454
unsigned configSendMask, /* Send these configuration items */
5555
const char *zAltPCode /* Alternative project code (usually NULL) */
5656
){
57
- int nErr;
58
- int nOther;
59
- char **azOther;
60
- int i;
61
- Stmt q;
57
+ int nErr; /* Number of errors seen */
58
+ int nOther; /* Number of extra remote URLs */
59
+ char **azOther; /* Text of extra remote URLs */
60
+ int i; /* Loop counter */
61
+ int iEnd; /* Loop termination point */
62
+ int nextIEnd; /* Loop termination point for next pass */
63
+ int iPass; /* Which pass through the remotes. 0 or 1 */
64
+ int nPass; /* Number of passes to make. 1 or 2 */
65
+ Stmt q; /* An SQL statement */
66
+ UrlData baseUrl; /* Saved parse of the default remote */
6267
6368
sync_explain(syncFlags);
64
- nErr = client_sync(syncFlags, configRcvMask, configSendMask, zAltPCode);
65
- if( nErr==0 ) url_remember();
66
- if( (syncFlags & SYNC_ALLURL)==0 ) return nErr;
69
+ if( (syncFlags & SYNC_ALLURL)==0 ){
70
+ /* Common-case: Only sync with the remote identified by g.url */
71
+ nErr = client_sync(syncFlags, configRcvMask, configSendMask, zAltPCode, 0);
72
+ if( nErr==0 ) url_remember();
73
+ return nErr;
74
+ }
75
+
76
+ /* If we reach this point, it means we want to sync with all remotes */
77
+ memset(&baseUrl, 0, sizeof(baseUrl));
78
+ url_move_parse(&baseUrl, &g.url);
6779
nOther = 0;
6880
azOther = 0;
6981
db_prepare(&q,
7082
"SELECT substr(name,10) FROM config"
7183
" WHERE name glob 'sync-url:*'"
@@ -75,30 +87,60 @@
7587
const char *zUrl = db_column_text(&q, 0);
7688
azOther = fossil_realloc(azOther, sizeof(*azOther)*(nOther+1));
7789
azOther[nOther++] = fossil_strdup(zUrl);
7890
}
7991
db_finalize(&q);
80
- for(i=0; i<nOther; i++){
81
- int rc;
82
- url_unparse(&g.url);
83
- url_parse(azOther[i], URL_PROMPT_PW|URL_ASK_REMEMBER_PW|URL_USE_CONFIG);
84
- sync_explain(syncFlags);
85
- rc = client_sync(syncFlags, configRcvMask, configSendMask, zAltPCode);
86
- nErr += rc;
87
- if( (g.url.flags & URL_REMEMBER_PW)!=0 && rc==0 ){
88
- char *zKey = mprintf("sync-pw:%s", azOther[i]);
89
- char *zPw = obscure(g.url.passwd);
90
- if( zPw && zPw[0] ){
91
- db_set(zKey/*works-like:""*/, zPw, 0);
92
- }
93
- fossil_free(zPw);
94
- fossil_free(zKey);
95
- }
92
+ iEnd = nOther+1;
93
+ nextIEnd = 0;
94
+ nPass = 1 + ((syncFlags & (SYNC_PUSH|SYNC_PULL))==(SYNC_PUSH|SYNC_PULL));
95
+ for(iPass=0; iPass<nPass; iPass++){
96
+ for(i=0; i<iEnd; i++){
97
+ int rc;
98
+ int nRcvd;
99
+ if( i==0 ){
100
+ url_move_parse(&g.url, &baseUrl); /* Load canonical URL */
101
+ }else{
102
+ /* Load an auxiliary remote URL */
103
+ url_parse(azOther[i-1],
104
+ URL_PROMPT_PW|URL_ASK_REMEMBER_PW|URL_USE_CONFIG);
105
+ }
106
+ if( i>0 || iPass>0 ) sync_explain(syncFlags);
107
+ rc = client_sync(syncFlags, configRcvMask, configSendMask,
108
+ zAltPCode, &nRcvd);
109
+ if( nRcvd>0 ){
110
+ /* If new artifacts were received, we want to repeat all prior
111
+ ** remotes on the second pass */
112
+ nextIEnd = i;
113
+ }
114
+ nErr += rc;
115
+ if( rc==0 && iPass==0 ){
116
+ if( i==0 ){
117
+ url_remember();
118
+ }else if( (g.url.flags & URL_REMEMBER_PW)!=0 ){
119
+ char *zKey = mprintf("sync-pw:%s", azOther[i-1]);
120
+ char *zPw = obscure(g.url.passwd);
121
+ if( zPw && zPw[0] ){
122
+ db_set(zKey/*works-like:""*/, zPw, 0);
123
+ }
124
+ fossil_free(zPw);
125
+ fossil_free(zKey);
126
+ }
127
+ }
128
+ if( i==0 ){
129
+ url_move_parse(&baseUrl, &g.url); /* Don't forget canonical URL */
130
+ }else{
131
+ url_unparse(&g.url); /* Delete auxiliary URL parses */
132
+ }
133
+ }
134
+ iEnd = nextIEnd;
135
+ }
136
+ for(i=0; i<nOther; i++){
96137
fossil_free(azOther[i]);
97138
azOther[i] = 0;
98139
}
99140
fossil_free(azOther);
141
+ url_move_parse(&g.url, &baseUrl); /* Restore the canonical URL parse */
100142
return nErr;
101143
}
102144
103145
104146
/*
@@ -149,11 +191,11 @@
149191
rc = client_sync_all_urls(flags|SYNC_ALLURL, configSync, 0, 0);
150192
}else{
151193
url_remember();
152194
sync_explain(flags);
153195
url_enable_proxy("via proxy: ");
154
- rc = client_sync(flags, configSync, 0, 0);
196
+ rc = client_sync(flags, configSync, 0, 0, 0);
155197
}
156198
return rc;
157199
}
158200
159201
/*
@@ -480,11 +522,11 @@
480522
void sync_unversioned(unsigned syncFlags){
481523
unsigned configFlags = 0;
482524
(void)find_option("uv-noop",0,0);
483525
process_sync_args(&configFlags, &syncFlags, 1, 0);
484526
verify_all_options();
485
- client_sync(syncFlags, 0, 0, 0);
527
+ client_sync(syncFlags, 0, 0, 0, 0);
486528
}
487529
488530
/*
489531
** COMMAND: remote
490532
** COMMAND: remote-url*
491533
--- src/sync.c
+++ src/sync.c
@@ -52,20 +52,32 @@
52 unsigned syncFlags, /* Mask of SYNC_* flags */
53 unsigned configRcvMask, /* Receive these configuration items */
54 unsigned configSendMask, /* Send these configuration items */
55 const char *zAltPCode /* Alternative project code (usually NULL) */
56 ){
57 int nErr;
58 int nOther;
59 char **azOther;
60 int i;
61 Stmt q;
 
 
 
 
 
62
63 sync_explain(syncFlags);
64 nErr = client_sync(syncFlags, configRcvMask, configSendMask, zAltPCode);
65 if( nErr==0 ) url_remember();
66 if( (syncFlags & SYNC_ALLURL)==0 ) return nErr;
 
 
 
 
 
 
 
67 nOther = 0;
68 azOther = 0;
69 db_prepare(&q,
70 "SELECT substr(name,10) FROM config"
71 " WHERE name glob 'sync-url:*'"
@@ -75,30 +87,60 @@
75 const char *zUrl = db_column_text(&q, 0);
76 azOther = fossil_realloc(azOther, sizeof(*azOther)*(nOther+1));
77 azOther[nOther++] = fossil_strdup(zUrl);
78 }
79 db_finalize(&q);
80 for(i=0; i<nOther; i++){
81 int rc;
82 url_unparse(&g.url);
83 url_parse(azOther[i], URL_PROMPT_PW|URL_ASK_REMEMBER_PW|URL_USE_CONFIG);
84 sync_explain(syncFlags);
85 rc = client_sync(syncFlags, configRcvMask, configSendMask, zAltPCode);
86 nErr += rc;
87 if( (g.url.flags & URL_REMEMBER_PW)!=0 && rc==0 ){
88 char *zKey = mprintf("sync-pw:%s", azOther[i]);
89 char *zPw = obscure(g.url.passwd);
90 if( zPw && zPw[0] ){
91 db_set(zKey/*works-like:""*/, zPw, 0);
92 }
93 fossil_free(zPw);
94 fossil_free(zKey);
95 }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
96 fossil_free(azOther[i]);
97 azOther[i] = 0;
98 }
99 fossil_free(azOther);
 
100 return nErr;
101 }
102
103
104 /*
@@ -149,11 +191,11 @@
149 rc = client_sync_all_urls(flags|SYNC_ALLURL, configSync, 0, 0);
150 }else{
151 url_remember();
152 sync_explain(flags);
153 url_enable_proxy("via proxy: ");
154 rc = client_sync(flags, configSync, 0, 0);
155 }
156 return rc;
157 }
158
159 /*
@@ -480,11 +522,11 @@
480 void sync_unversioned(unsigned syncFlags){
481 unsigned configFlags = 0;
482 (void)find_option("uv-noop",0,0);
483 process_sync_args(&configFlags, &syncFlags, 1, 0);
484 verify_all_options();
485 client_sync(syncFlags, 0, 0, 0);
486 }
487
488 /*
489 ** COMMAND: remote
490 ** COMMAND: remote-url*
491
--- src/sync.c
+++ src/sync.c
@@ -52,20 +52,32 @@
52 unsigned syncFlags, /* Mask of SYNC_* flags */
53 unsigned configRcvMask, /* Receive these configuration items */
54 unsigned configSendMask, /* Send these configuration items */
55 const char *zAltPCode /* Alternative project code (usually NULL) */
56 ){
57 int nErr; /* Number of errors seen */
58 int nOther; /* Number of extra remote URLs */
59 char **azOther; /* Text of extra remote URLs */
60 int i; /* Loop counter */
61 int iEnd; /* Loop termination point */
62 int nextIEnd; /* Loop termination point for next pass */
63 int iPass; /* Which pass through the remotes. 0 or 1 */
64 int nPass; /* Number of passes to make. 1 or 2 */
65 Stmt q; /* An SQL statement */
66 UrlData baseUrl; /* Saved parse of the default remote */
67
68 sync_explain(syncFlags);
69 if( (syncFlags & SYNC_ALLURL)==0 ){
70 /* Common-case: Only sync with the remote identified by g.url */
71 nErr = client_sync(syncFlags, configRcvMask, configSendMask, zAltPCode, 0);
72 if( nErr==0 ) url_remember();
73 return nErr;
74 }
75
76 /* If we reach this point, it means we want to sync with all remotes */
77 memset(&baseUrl, 0, sizeof(baseUrl));
78 url_move_parse(&baseUrl, &g.url);
79 nOther = 0;
80 azOther = 0;
81 db_prepare(&q,
82 "SELECT substr(name,10) FROM config"
83 " WHERE name glob 'sync-url:*'"
@@ -75,30 +87,60 @@
87 const char *zUrl = db_column_text(&q, 0);
88 azOther = fossil_realloc(azOther, sizeof(*azOther)*(nOther+1));
89 azOther[nOther++] = fossil_strdup(zUrl);
90 }
91 db_finalize(&q);
92 iEnd = nOther+1;
93 nextIEnd = 0;
94 nPass = 1 + ((syncFlags & (SYNC_PUSH|SYNC_PULL))==(SYNC_PUSH|SYNC_PULL));
95 for(iPass=0; iPass<nPass; iPass++){
96 for(i=0; i<iEnd; i++){
97 int rc;
98 int nRcvd;
99 if( i==0 ){
100 url_move_parse(&g.url, &baseUrl); /* Load canonical URL */
101 }else{
102 /* Load an auxiliary remote URL */
103 url_parse(azOther[i-1],
104 URL_PROMPT_PW|URL_ASK_REMEMBER_PW|URL_USE_CONFIG);
105 }
106 if( i>0 || iPass>0 ) sync_explain(syncFlags);
107 rc = client_sync(syncFlags, configRcvMask, configSendMask,
108 zAltPCode, &nRcvd);
109 if( nRcvd>0 ){
110 /* If new artifacts were received, we want to repeat all prior
111 ** remotes on the second pass */
112 nextIEnd = i;
113 }
114 nErr += rc;
115 if( rc==0 && iPass==0 ){
116 if( i==0 ){
117 url_remember();
118 }else if( (g.url.flags & URL_REMEMBER_PW)!=0 ){
119 char *zKey = mprintf("sync-pw:%s", azOther[i-1]);
120 char *zPw = obscure(g.url.passwd);
121 if( zPw && zPw[0] ){
122 db_set(zKey/*works-like:""*/, zPw, 0);
123 }
124 fossil_free(zPw);
125 fossil_free(zKey);
126 }
127 }
128 if( i==0 ){
129 url_move_parse(&baseUrl, &g.url); /* Don't forget canonical URL */
130 }else{
131 url_unparse(&g.url); /* Delete auxiliary URL parses */
132 }
133 }
134 iEnd = nextIEnd;
135 }
136 for(i=0; i<nOther; i++){
137 fossil_free(azOther[i]);
138 azOther[i] = 0;
139 }
140 fossil_free(azOther);
141 url_move_parse(&g.url, &baseUrl); /* Restore the canonical URL parse */
142 return nErr;
143 }
144
145
146 /*
@@ -149,11 +191,11 @@
191 rc = client_sync_all_urls(flags|SYNC_ALLURL, configSync, 0, 0);
192 }else{
193 url_remember();
194 sync_explain(flags);
195 url_enable_proxy("via proxy: ");
196 rc = client_sync(flags, configSync, 0, 0, 0);
197 }
198 return rc;
199 }
200
201 /*
@@ -480,11 +522,11 @@
522 void sync_unversioned(unsigned syncFlags){
523 unsigned configFlags = 0;
524 (void)find_option("uv-noop",0,0);
525 process_sync_args(&configFlags, &syncFlags, 1, 0);
526 verify_all_options();
527 client_sync(syncFlags, 0, 0, 0, 0);
528 }
529
530 /*
531 ** COMMAND: remote
532 ** COMMAND: remote-url*
533
+9
--- src/url.c
+++ src/url.c
@@ -414,10 +414,19 @@
414414
fossil_free(p->passwd);
415415
fossil_free(p->fossil);
416416
fossil_free(p->pwConfig);
417417
memset(p, 0, sizeof(*p));
418418
}
419
+
420
+/*
421
+** Move a URL parse from one UrlData object to another.
422
+*/
423
+void url_move_parse(UrlData *pTo, UrlData *pFrom){
424
+ url_unparse(pTo);
425
+ memcpy(pTo, pFrom, sizeof(*pTo));
426
+ memset(pFrom, 0, sizeof(*pFrom));
427
+}
419428
420429
/*
421430
** Parse the given URL, which describes a sync server. Populate variables
422431
** in the global "g.url" structure as shown below. If zUrl is NULL, then
423432
** parse the URL given in the last-sync-url setting, taking the password
424433
--- src/url.c
+++ src/url.c
@@ -414,10 +414,19 @@
414 fossil_free(p->passwd);
415 fossil_free(p->fossil);
416 fossil_free(p->pwConfig);
417 memset(p, 0, sizeof(*p));
418 }
 
 
 
 
 
 
 
 
 
419
420 /*
421 ** Parse the given URL, which describes a sync server. Populate variables
422 ** in the global "g.url" structure as shown below. If zUrl is NULL, then
423 ** parse the URL given in the last-sync-url setting, taking the password
424
--- src/url.c
+++ src/url.c
@@ -414,10 +414,19 @@
414 fossil_free(p->passwd);
415 fossil_free(p->fossil);
416 fossil_free(p->pwConfig);
417 memset(p, 0, sizeof(*p));
418 }
419
420 /*
421 ** Move a URL parse from one UrlData object to another.
422 */
423 void url_move_parse(UrlData *pTo, UrlData *pFrom){
424 url_unparse(pTo);
425 memcpy(pTo, pFrom, sizeof(*pTo));
426 memset(pFrom, 0, sizeof(*pFrom));
427 }
428
429 /*
430 ** Parse the given URL, which describes a sync server. Populate variables
431 ** in the global "g.url" structure as shown below. If zUrl is NULL, then
432 ** parse the URL given in the last-sync-url setting, taking the password
433
+6 -1
--- src/xfer.c
+++ src/xfer.c
@@ -1949,11 +1949,12 @@
19491949
*/
19501950
int client_sync(
19511951
unsigned syncFlags, /* Mask of SYNC_* flags */
19521952
unsigned configRcvMask, /* Receive these configuration items */
19531953
unsigned configSendMask, /* Send these configuration items */
1954
- const char *zAltPCode /* Alternative project code (usually NULL) */
1954
+ const char *zAltPCode, /* Alternative project code (usually NULL) */
1955
+ int *pnRcvd /* Set to # received artifacts, if not NULL */
19551956
){
19561957
int go = 1; /* Loop until zero */
19571958
int nCardSent = 0; /* Number of cards sent */
19581959
int nCardRcvd = 0; /* Number of cards received */
19591960
int nCycle = 0; /* Number of round trips to the server */
@@ -1989,10 +1990,11 @@
19891990
int autopushFailed = 0; /* Autopush following commit failed if true */
19901991
const char *zCkinLock; /* Name of check-in to lock. NULL for none */
19911992
const char *zClientId; /* A unique identifier for this check-out */
19921993
unsigned int mHttpFlags;/* Flags for the http_exchange() subsystem */
19931994
1995
+ if( pnRcvd ) *pnRcvd = 0;
19941996
if( db_get_boolean("dont-push", 0) ) syncFlags &= ~SYNC_PUSH;
19951997
if( (syncFlags & (SYNC_PUSH|SYNC_PULL|SYNC_CLONE|SYNC_UNVERSIONED))==0
19961998
&& configRcvMask==0
19971999
&& configSendMask==0
19982000
){
@@ -2852,10 +2854,11 @@
28522854
content_enable_dephantomize(1);
28532855
}
28542856
db_end_transaction(0);
28552857
};
28562858
transport_stats(&nSent, &nRcvd, 1);
2859
+ if( pnRcvd ) *pnRcvd = nArtifactRcvd;
28572860
if( (rSkew*24.0*3600.0) > 10.0 ){
28582861
fossil_warning("*** time skew *** server is fast by %s",
28592862
db_timespan_name(rSkew));
28602863
g.clockSkewSeen = 1;
28612864
}else if( rSkew*24.0*3600.0 < -10.0 ){
@@ -2882,10 +2885,12 @@
28822885
}
28832886
if( syncFlags & SYNC_VERBOSE ){
28842887
fossil_print(
28852888
"Uncompressed payload sent: %lld received: %lld\n", nUncSent, nUncRcvd);
28862889
}
2890
+ blob_reset(&send);
2891
+ blob_reset(&recv);
28872892
transport_close(&g.url);
28882893
transport_global_shutdown(&g.url);
28892894
if( nErr && go==2 ){
28902895
db_multi_exec("DROP TABLE onremote; DROP TABLE unk;");
28912896
manifest_crosslink_end(MC_PERMIT_HOOKS);
28922897
--- src/xfer.c
+++ src/xfer.c
@@ -1949,11 +1949,12 @@
1949 */
1950 int client_sync(
1951 unsigned syncFlags, /* Mask of SYNC_* flags */
1952 unsigned configRcvMask, /* Receive these configuration items */
1953 unsigned configSendMask, /* Send these configuration items */
1954 const char *zAltPCode /* Alternative project code (usually NULL) */
 
1955 ){
1956 int go = 1; /* Loop until zero */
1957 int nCardSent = 0; /* Number of cards sent */
1958 int nCardRcvd = 0; /* Number of cards received */
1959 int nCycle = 0; /* Number of round trips to the server */
@@ -1989,10 +1990,11 @@
1989 int autopushFailed = 0; /* Autopush following commit failed if true */
1990 const char *zCkinLock; /* Name of check-in to lock. NULL for none */
1991 const char *zClientId; /* A unique identifier for this check-out */
1992 unsigned int mHttpFlags;/* Flags for the http_exchange() subsystem */
1993
 
1994 if( db_get_boolean("dont-push", 0) ) syncFlags &= ~SYNC_PUSH;
1995 if( (syncFlags & (SYNC_PUSH|SYNC_PULL|SYNC_CLONE|SYNC_UNVERSIONED))==0
1996 && configRcvMask==0
1997 && configSendMask==0
1998 ){
@@ -2852,10 +2854,11 @@
2852 content_enable_dephantomize(1);
2853 }
2854 db_end_transaction(0);
2855 };
2856 transport_stats(&nSent, &nRcvd, 1);
 
2857 if( (rSkew*24.0*3600.0) > 10.0 ){
2858 fossil_warning("*** time skew *** server is fast by %s",
2859 db_timespan_name(rSkew));
2860 g.clockSkewSeen = 1;
2861 }else if( rSkew*24.0*3600.0 < -10.0 ){
@@ -2882,10 +2885,12 @@
2882 }
2883 if( syncFlags & SYNC_VERBOSE ){
2884 fossil_print(
2885 "Uncompressed payload sent: %lld received: %lld\n", nUncSent, nUncRcvd);
2886 }
 
 
2887 transport_close(&g.url);
2888 transport_global_shutdown(&g.url);
2889 if( nErr && go==2 ){
2890 db_multi_exec("DROP TABLE onremote; DROP TABLE unk;");
2891 manifest_crosslink_end(MC_PERMIT_HOOKS);
2892
--- src/xfer.c
+++ src/xfer.c
@@ -1949,11 +1949,12 @@
1949 */
1950 int client_sync(
1951 unsigned syncFlags, /* Mask of SYNC_* flags */
1952 unsigned configRcvMask, /* Receive these configuration items */
1953 unsigned configSendMask, /* Send these configuration items */
1954 const char *zAltPCode, /* Alternative project code (usually NULL) */
1955 int *pnRcvd /* Set to # received artifacts, if not NULL */
1956 ){
1957 int go = 1; /* Loop until zero */
1958 int nCardSent = 0; /* Number of cards sent */
1959 int nCardRcvd = 0; /* Number of cards received */
1960 int nCycle = 0; /* Number of round trips to the server */
@@ -1989,10 +1990,11 @@
1990 int autopushFailed = 0; /* Autopush following commit failed if true */
1991 const char *zCkinLock; /* Name of check-in to lock. NULL for none */
1992 const char *zClientId; /* A unique identifier for this check-out */
1993 unsigned int mHttpFlags;/* Flags for the http_exchange() subsystem */
1994
1995 if( pnRcvd ) *pnRcvd = 0;
1996 if( db_get_boolean("dont-push", 0) ) syncFlags &= ~SYNC_PUSH;
1997 if( (syncFlags & (SYNC_PUSH|SYNC_PULL|SYNC_CLONE|SYNC_UNVERSIONED))==0
1998 && configRcvMask==0
1999 && configSendMask==0
2000 ){
@@ -2852,10 +2854,11 @@
2854 content_enable_dephantomize(1);
2855 }
2856 db_end_transaction(0);
2857 };
2858 transport_stats(&nSent, &nRcvd, 1);
2859 if( pnRcvd ) *pnRcvd = nArtifactRcvd;
2860 if( (rSkew*24.0*3600.0) > 10.0 ){
2861 fossil_warning("*** time skew *** server is fast by %s",
2862 db_timespan_name(rSkew));
2863 g.clockSkewSeen = 1;
2864 }else if( rSkew*24.0*3600.0 < -10.0 ){
@@ -2882,10 +2885,12 @@
2885 }
2886 if( syncFlags & SYNC_VERBOSE ){
2887 fossil_print(
2888 "Uncompressed payload sent: %lld received: %lld\n", nUncSent, nUncRcvd);
2889 }
2890 blob_reset(&send);
2891 blob_reset(&recv);
2892 transport_close(&g.url);
2893 transport_global_shutdown(&g.url);
2894 if( nErr && go==2 ){
2895 db_multi_exec("DROP TABLE onremote; DROP TABLE unk;");
2896 manifest_crosslink_end(MC_PERMIT_HOOKS);
2897
+1 -1
--- src/xfersetup.c
+++ src/xfersetup.c
@@ -80,11 +80,11 @@
8080
@
8181
if( P("sync") ){
8282
user_select();
8383
url_enable_proxy(0);
8484
@ <pre class="xfersetup">
85
- client_sync(syncFlags, 0, 0, 0);
85
+ client_sync(syncFlags, 0, 0, 0, 0);
8686
@ </pre>
8787
}
8888
}
8989
9090
style_finish_page();
9191
--- src/xfersetup.c
+++ src/xfersetup.c
@@ -80,11 +80,11 @@
80 @
81 if( P("sync") ){
82 user_select();
83 url_enable_proxy(0);
84 @ <pre class="xfersetup">
85 client_sync(syncFlags, 0, 0, 0);
86 @ </pre>
87 }
88 }
89
90 style_finish_page();
91
--- src/xfersetup.c
+++ src/xfersetup.c
@@ -80,11 +80,11 @@
80 @
81 if( P("sync") ){
82 user_select();
83 url_enable_proxy(0);
84 @ <pre class="xfersetup">
85 client_sync(syncFlags, 0, 0, 0, 0);
86 @ </pre>
87 }
88 }
89
90 style_finish_page();
91

Keyboard Shortcuts

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