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
|
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
|
+
+
-
-
+
+
-
-
-
+
|
** 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.
*/
void autosync(int flags){
const char *zUrl;
const char *zAutosync;
const char *zPw;
if( g.fNoSync ){
return;
}
zAutosync = db_get("autosync", 0);
if( zAutosync ){
if( (flags & AUTOSYNC_PUSH)!=0 && memcmp(zAutosync,"pull",4)==0 ){
return; /* Do not auto-push when autosync=pullonly */
}
if( is_false(zAutosync) ){
return; /* 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; /* No default server */
}
zPw = db_get("last-sync-pw", 0);
url_parse(zUrl);
if( g.urlPort!=g.urlDfltPort ){
printf("Autosync: %s://%s:%d%s\n",
if( g.urlUser!=0 && g.urlPasswd==0 ){
g.urlPasswd = mprintf("%s", zPw);
g.urlProtocol, g.urlName, g.urlPort, g.urlPath);
}else{
printf("Autosync: %s://%s%s\n", g.urlProtocol, g.urlName, g.urlPath);
}
printf("Autosync: %s\n", g.urlCanonical);
url_enable_proxy("via proxy: ");
client_sync((flags & AUTOSYNC_PUSH)!=0, 1, 0, 0, 0);
}
/*
** This routine processes the command-line argument for push, pull,
** and sync. If a command-line argument is given, that is the URL
|