Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
| Comment: | Further work on getting a "commit" or "update" to continue operating after an autosync failure. The "commit" command prompts to verify that you want to continue. |
|---|---|
| Timelines: | family | ancestors | descendants | both | trunk |
| Files: | files | file ages | folders |
| SHA1: |
0cc4875fde9f492b2f04bbc2b0954179 |
| User & Date: | drh 2010-11-19 22:29:25.000 |
Context
|
2010-11-23
| ||
| 22:18 | Fix the ticket-change artifact generator so that it puts all fields with the "+" prefix on their name first, where they ought to be. check-in: e1dac0e4f6 user: drh tags: trunk | |
|
2010-11-19
| ||
| 22:29 | Further work on getting a "commit" or "update" to continue operating after an autosync failure. The "commit" command prompts to verify that you want to continue. check-in: 0cc4875fde user: drh tags: trunk | |
| 19:48 | Work toward getting and "update" or "commit" to continue even after an auto-sync failure. check-in: 9286aaf778 user: drh tags: trunk | |
Changes
Changes to src/checkin.c.
| ︙ | ︙ | |||
805 806 807 808 809 810 811 |
g.markPrivate = 1;
}
/*
** Autosync if autosync is enabled and this is not a private check-in.
*/
if( !g.markPrivate ){
| | > > > > > > > | 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 |
g.markPrivate = 1;
}
/*
** Autosync if autosync is enabled and this is not a private check-in.
*/
if( !g.markPrivate ){
if( autosync(AUTOSYNC_PULL) ){
Blob ans;
blob_zero(&ans);
prompt_user("continue in spite of sync failure (y/N)? ", &ans);
if( blob_str(&ans)[0]!='y' ){
fossil_exit(1);
}
}
}
/* Require confirmation to continue with the check-in if there is
** clock skew
*/
if( g.clockSkewSeen ){
Blob ans;
|
| ︙ | ︙ |
Changes to src/http_socket.c.
| ︙ | ︙ | |||
150 151 152 153 154 155 156 |
struct hostent *pHost;
pHost = gethostbyname(g.urlName);
if( pHost!=0 ){
memcpy(&addr.sin_addr,pHost->h_addr_list[0],pHost->h_length);
}else
#endif
{
| | | 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 |
struct hostent *pHost;
pHost = gethostbyname(g.urlName);
if( pHost!=0 ){
memcpy(&addr.sin_addr,pHost->h_addr_list[0],pHost->h_length);
}else
#endif
{
socket_set_errmsg("can't resolve host name: %s", g.urlName);
return 1;
}
}
addrIsInit = 1;
/* Set the Global.zIpAddr variable to the server we are talking to.
** This is used to populate the ipaddr column of the rcvfrom table,
|
| ︙ | ︙ |
Changes to src/sync.c.
| ︙ | ︙ | |||
30 31 32 33 34 35 36 37 | #endif /* INTERFACE */ /* ** If the respository is configured for autosyncing, then do an ** autosync. This will be a pull if the argument is true or a push ** if the argument is false. */ | > > | > | | | | | > > | 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 |
#endif /* INTERFACE */
/*
** If the respository is configured for autosyncing, then do an
** autosync. This will be a pull if the argument is true or a push
** if the argument is false.
**
** Return the number of errors.
*/
int autosync(int flags){
const char *zUrl;
const char *zAutosync;
const char *zPw;
int rc;
int configSync = 0; /* configuration changes transferred */
if( g.fNoSync ){
return 0;
}
zAutosync = db_get("autosync", 0);
if( zAutosync ){
if( (flags & AUTOSYNC_PUSH)!=0 && memcmp(zAutosync,"pull",4)==0 ){
return 0; /* Do not auto-push when autosync=pullonly */
}
if( is_false(zAutosync) ){
return 0; /* Autosync is completely off */
}
}else{
/* Autosync defaults on. To make it default off, "return" here. */
}
zUrl = db_get("last-sync-url", 0);
if( zUrl==0 ){
return 0; /* No default server */
}
zPw = unobscure(db_get("last-sync-pw", 0));
url_parse(zUrl);
if( g.urlUser!=0 && g.urlPasswd==0 ){
g.urlPasswd = mprintf("%s", zPw);
}
#if 0 /* Disabled for now */
if( (flags & AUTOSYNC_PULL)!=0 && db_get_boolean("auto-shun",1) ){
/* When doing an automatic pull, also automatically pull shuns from
** the server if pull_shuns is enabled.
**
** TODO: What happens if the shun list gets really big?
** Maybe the shunning list should only be pulled on every 10th
** autosync, or something?
*/
configSync = CONFIGSET_SHUN;
}
#endif
printf("Autosync: %s\n", g.urlCanonical);
url_enable_proxy("via proxy: ");
rc = client_sync((flags & AUTOSYNC_PUSH)!=0, 1, 0, configSync, 0);
if( rc ) fossil_warning("Autosync failed");
return rc;
}
/*
** This routine processes the command-line argument for push, pull,
** and sync. If a command-line argument is given, that is the URL
** of a server to sync against. If no argument is given, use the
** most recently synced URL. Remember the current URL for next time.
|
| ︙ | ︙ |
Changes to src/xfer.c.
| ︙ | ︙ | |||
973 974 975 976 977 978 979 | ** Sync to the host identified in g.urlName and g.urlPath. This ** routine is called by the client. ** ** Records are pushed to the server if pushFlag is true. Records ** are pulled if pullFlag is true. A full sync occurs if both are ** true. */ | | | 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 |
** Sync to the host identified in g.urlName and g.urlPath. This
** routine is called by the client.
**
** Records are pushed to the server if pushFlag is true. Records
** are pulled if pullFlag is true. A full sync occurs if both are
** true.
*/
int client_sync(
int pushFlag, /* True to do a push (or a sync) */
int pullFlag, /* True to do a pull (or a sync) */
int cloneFlag, /* True if this is a clone */
int configRcvMask, /* Receive these configuration items */
int configSendMask /* Send these configuration items */
){
int go = 1; /* Loop until zero */
|
| ︙ | ︙ | |||
1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 |
Blob recv; /* Reply we got back from the server */
Xfer xfer; /* Transfer data */
int pctDone; /* Percentage done with a message */
int lastPctDone = -1; /* Last displayed pctDone */
double rArrivalTime; /* Time at which a message arrived */
const char *zSCode = db_get("server-code", "x");
const char *zPCode = db_get("project-code", 0);
if( db_get_boolean("dont-push", 0) ) pushFlag = 0;
if( pushFlag + pullFlag + cloneFlag == 0
| > | | 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 |
Blob recv; /* Reply we got back from the server */
Xfer xfer; /* Transfer data */
int pctDone; /* Percentage done with a message */
int lastPctDone = -1; /* Last displayed pctDone */
double rArrivalTime; /* Time at which a message arrived */
const char *zSCode = db_get("server-code", "x");
const char *zPCode = db_get("project-code", 0);
int nErr = 0; /* Number of errors */
if( db_get_boolean("dont-push", 0) ) pushFlag = 0;
if( pushFlag + pullFlag + cloneFlag == 0
&& configRcvMask==0 && configSendMask==0 ) return 0;
transport_stats(0, 0, 1);
socket_global_init();
memset(&xfer, 0, sizeof(xfer));
xfer.pIn = &recv;
xfer.pOut = &send;
xfer.mxSend = db_get_int("max-upload", 250000);
|
| ︙ | ︙ | |||
1124 1125 1126 1127 1128 1129 1130 |
xfer.nDeltaSent = 0;
xfer.nGimmeSent = 0;
xfer.nIGotSent = 0;
if( !g.cgiOutput && !g.fQuiet ){
printf("waiting for server...");
}
fflush(stdout);
| | > > > | 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 |
xfer.nDeltaSent = 0;
xfer.nGimmeSent = 0;
xfer.nIGotSent = 0;
if( !g.cgiOutput && !g.fQuiet ){
printf("waiting for server...");
}
fflush(stdout);
if( http_exchange(&send, &recv, cloneFlag==0 || nCycle>0) ){
nErr++;
break;
}
lastPctDone = -1;
blob_reset(&send);
rArrivalTime = db_double(0.0, "SELECT julianday('now')");
/* Begin constructing the next message (which might never be
** sent) by beginning with the pull or push cards
*/
|
| ︙ | ︙ | |||
1350 1351 1352 1353 1354 1355 1356 |
if( nCycle<2 ){
if( !g.dontKeepUrl ) db_unset("last-sync-pw", 0);
go = 1;
}
}else{
blob_appendf(&xfer.err, "\rserver says: %s", zMsg);
}
| | > > | > > | > > | 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 |
if( nCycle<2 ){
if( !g.dontKeepUrl ) db_unset("last-sync-pw", 0);
go = 1;
}
}else{
blob_appendf(&xfer.err, "\rserver says: %s", zMsg);
}
fossil_warning("\rError: %s", zMsg);
nErr++;
break;
}
}else
/* Unknown message */
{
if( blob_str(&xfer.aToken[0])[0]=='<' ){
fossil_warning(
"server replies with HTML instead of fossil sync protocol:\n%b",
&recv
);
nErr++;
break;
}
blob_appendf(&xfer.err, "unknown command: %b", &xfer.aToken[0]);
}
if( blob_size(&xfer.err) ){
fossil_warning("%b", &xfer.err);
nErr++;
break;
}
blobarray_reset(xfer.aToken, xfer.nToken);
blob_reset(&xfer.line);
}
if( origConfigRcvMask & (CONFIGSET_TKT|CONFIGSET_USER) ){
configure_finalize_receive();
}
|
| ︙ | ︙ | |||
1421 1422 1423 1424 1425 1426 1427 1428 |
nSent, nRcvd);
transport_close();
transport_global_shutdown();
db_multi_exec("DROP TABLE onremote");
manifest_crosslink_end();
content_enable_dephantomize(1);
db_end_transaction(0);
}
| > | 1431 1432 1433 1434 1435 1436 1437 1438 1439 |
nSent, nRcvd);
transport_close();
transport_global_shutdown();
db_multi_exec("DROP TABLE onremote");
manifest_crosslink_end();
content_enable_dephantomize(1);
db_end_transaction(0);
return nErr;
}
|