Fossil SCM

Simplify command line interaction: remove settings from global and provide one less command line option. Altering settings in open fossils can be done with sync -l or cleared with remote-url if necessary.

andybradford 2013-08-12 06:43 ssh-test-http
Commit ed20da74998324afe3534f357491ba11d54b0679
+8 -19
--- src/clone.c
+++ src/clone.c
@@ -96,11 +96,10 @@
9696
** --private Also clone private branches
9797
** --ssl-identity=filename Use the SSL identity if requested by the server
9898
** --ssh-fossil|-f /fossil Use this path as remote fossil command
9999
** --ssh-command|-c 'command' Use this SSH command
100100
** --ssh-fossil-user|-l user Fossil user to use for SSH if different.
101
-** --ssh-use-http|-h on/off Enable http instead of test-http. Default: off
102101
**
103102
** See also: init
104103
*/
105104
void clone_cmd(void){
106105
char *zPassword;
@@ -188,11 +187,10 @@
188187
*/
189188
void clone_ssh_find_options(void){
190189
const char *zSshFossilCmd; /* Path to remote fossil command for SSH */
191190
const char *zSshCmd; /* SSH command string */
192191
const char *zFossilUser; /* Fossil user if login specified for SSH */
193
- const char *zSshUseHttp; /* Use http or test-http mode for SSH */
194192
195193
zSshFossilCmd = find_option("ssh-fossil","f",1);
196194
if( zSshFossilCmd && zSshFossilCmd[0] ){
197195
g.zSshFossilCmd = mprintf("%s", zSshFossilCmd);
198196
}
@@ -202,31 +200,22 @@
202200
}
203201
zFossilUser = find_option("ssh-fossil-user","l",1);
204202
if( zFossilUser && zFossilUser[0] ){
205203
g.zFossilUser = mprintf("%s", zFossilUser);
206204
}
207
- zSshUseHttp = find_option("ssh-use-http","h",1);
208
- if( zSshUseHttp && zSshUseHttp[0] ){
209
- g.zSshUseHttp = mprintf("%s", zSshUseHttp);
210
- }
211205
}
212206
213207
/*
214208
** Set SSH options discovered in global variables (set from command line
215209
** options).
216210
*/
217211
void clone_ssh_db_set_options(void){
218
- if( g.urlIsSsh ){
219
- if( g.zSshFossilCmd && g.zSshFossilCmd[0] ){
220
- db_set("ssh-fossil", g.zSshFossilCmd, 0);
221
- }
222
- if( g.zSshCmd && g.zSshCmd[0] ){
223
- db_set("ssh-command", g.zSshCmd, 0);
224
- }
225
- if( g.zFossilUser && g.zFossilUser[0] ){
226
- db_set("ssh-fossil-user", g.zFossilUser, 0);
227
- }
228
- if( g.zSshUseHttp && g.zSshUseHttp[0] ){
229
- db_set_int("ssh-use-http", is_truth(g.zSshUseHttp), 0);
230
- }
212
+ if( g.zSshFossilCmd && g.zSshFossilCmd[0] ){
213
+ db_set("ssh-fossil", g.zSshFossilCmd, 0);
214
+ }
215
+ if( g.zSshCmd && g.zSshCmd[0] ){
216
+ db_set("ssh-command", g.zSshCmd, 0);
217
+ }
218
+ if( g.zFossilUser && g.zFossilUser[0] ){
219
+ db_set("ssh-fossil-user", g.zFossilUser, 0);
231220
}
232221
}
233222
--- src/clone.c
+++ src/clone.c
@@ -96,11 +96,10 @@
96 ** --private Also clone private branches
97 ** --ssl-identity=filename Use the SSL identity if requested by the server
98 ** --ssh-fossil|-f /fossil Use this path as remote fossil command
99 ** --ssh-command|-c 'command' Use this SSH command
100 ** --ssh-fossil-user|-l user Fossil user to use for SSH if different.
101 ** --ssh-use-http|-h on/off Enable http instead of test-http. Default: off
102 **
103 ** See also: init
104 */
105 void clone_cmd(void){
106 char *zPassword;
@@ -188,11 +187,10 @@
188 */
189 void clone_ssh_find_options(void){
190 const char *zSshFossilCmd; /* Path to remote fossil command for SSH */
191 const char *zSshCmd; /* SSH command string */
192 const char *zFossilUser; /* Fossil user if login specified for SSH */
193 const char *zSshUseHttp; /* Use http or test-http mode for SSH */
194
195 zSshFossilCmd = find_option("ssh-fossil","f",1);
196 if( zSshFossilCmd && zSshFossilCmd[0] ){
197 g.zSshFossilCmd = mprintf("%s", zSshFossilCmd);
198 }
@@ -202,31 +200,22 @@
202 }
203 zFossilUser = find_option("ssh-fossil-user","l",1);
204 if( zFossilUser && zFossilUser[0] ){
205 g.zFossilUser = mprintf("%s", zFossilUser);
206 }
207 zSshUseHttp = find_option("ssh-use-http","h",1);
208 if( zSshUseHttp && zSshUseHttp[0] ){
209 g.zSshUseHttp = mprintf("%s", zSshUseHttp);
210 }
211 }
212
213 /*
214 ** Set SSH options discovered in global variables (set from command line
215 ** options).
216 */
217 void clone_ssh_db_set_options(void){
218 if( g.urlIsSsh ){
219 if( g.zSshFossilCmd && g.zSshFossilCmd[0] ){
220 db_set("ssh-fossil", g.zSshFossilCmd, 0);
221 }
222 if( g.zSshCmd && g.zSshCmd[0] ){
223 db_set("ssh-command", g.zSshCmd, 0);
224 }
225 if( g.zFossilUser && g.zFossilUser[0] ){
226 db_set("ssh-fossil-user", g.zFossilUser, 0);
227 }
228 if( g.zSshUseHttp && g.zSshUseHttp[0] ){
229 db_set_int("ssh-use-http", is_truth(g.zSshUseHttp), 0);
230 }
231 }
232 }
233
--- src/clone.c
+++ src/clone.c
@@ -96,11 +96,10 @@
96 ** --private Also clone private branches
97 ** --ssl-identity=filename Use the SSL identity if requested by the server
98 ** --ssh-fossil|-f /fossil Use this path as remote fossil command
99 ** --ssh-command|-c 'command' Use this SSH command
100 ** --ssh-fossil-user|-l user Fossil user to use for SSH if different.
 
101 **
102 ** See also: init
103 */
104 void clone_cmd(void){
105 char *zPassword;
@@ -188,11 +187,10 @@
187 */
188 void clone_ssh_find_options(void){
189 const char *zSshFossilCmd; /* Path to remote fossil command for SSH */
190 const char *zSshCmd; /* SSH command string */
191 const char *zFossilUser; /* Fossil user if login specified for SSH */
 
192
193 zSshFossilCmd = find_option("ssh-fossil","f",1);
194 if( zSshFossilCmd && zSshFossilCmd[0] ){
195 g.zSshFossilCmd = mprintf("%s", zSshFossilCmd);
196 }
@@ -202,31 +200,22 @@
200 }
201 zFossilUser = find_option("ssh-fossil-user","l",1);
202 if( zFossilUser && zFossilUser[0] ){
203 g.zFossilUser = mprintf("%s", zFossilUser);
204 }
 
 
 
 
205 }
206
207 /*
208 ** Set SSH options discovered in global variables (set from command line
209 ** options).
210 */
211 void clone_ssh_db_set_options(void){
212 if( g.zSshFossilCmd && g.zSshFossilCmd[0] ){
213 db_set("ssh-fossil", g.zSshFossilCmd, 0);
214 }
215 if( g.zSshCmd && g.zSshCmd[0] ){
216 db_set("ssh-command", g.zSshCmd, 0);
217 }
218 if( g.zFossilUser && g.zFossilUser[0] ){
219 db_set("ssh-fossil-user", g.zFossilUser, 0);
 
 
 
 
 
220 }
221 }
222
-6
--- src/db.c
+++ src/db.c
@@ -2135,12 +2135,10 @@
21352135
{ "relative-paths",0, 0, 0, "on" },
21362136
{ "repo-cksum", 0, 0, 0, "on" },
21372137
{ "self-register", 0, 0, 0, "off" },
21382138
{ "ssh-command", 0, 40, 0, "" },
21392139
{ "ssh-fossil", 0, 40, 0, "" },
2140
- { "ssh-fossil-user", 0, 40, 0, "" },
2141
- { "ssh-use-http", 0, 40, 0, "off" },
21422140
{ "ssl-ca-location",0, 40, 0, "" },
21432141
{ "ssl-identity", 0, 40, 0, "" },
21442142
#ifdef FOSSIL_ENABLE_TCL
21452143
{ "tcl", 0, 0, 0, "off" },
21462144
{ "tcl-setup", 0, 40, 0, "" },
@@ -2310,14 +2308,10 @@
23102308
** ssh-command Command used to talk to a remote machine with
23112309
** the "ssh://" protocol.
23122310
**
23132311
** ssh-fossil Remote fossil command to run with the "ssh://" protocol.
23142312
**
2315
-** ssh-fossil-user Fossil user to use instead of the URL user.
2316
-**
2317
-** ssh-use-http Use http instead of test-http. Default: off.
2318
-**
23192313
** ssl-ca-location The full pathname to a file containing PEM encoded
23202314
** CA root certificates, or a directory of certificates
23212315
** with filenames formed from the certificate hashes as
23222316
** required by OpenSSL.
23232317
** If set, this will override the OS default list of
23242318
--- src/db.c
+++ src/db.c
@@ -2135,12 +2135,10 @@
2135 { "relative-paths",0, 0, 0, "on" },
2136 { "repo-cksum", 0, 0, 0, "on" },
2137 { "self-register", 0, 0, 0, "off" },
2138 { "ssh-command", 0, 40, 0, "" },
2139 { "ssh-fossil", 0, 40, 0, "" },
2140 { "ssh-fossil-user", 0, 40, 0, "" },
2141 { "ssh-use-http", 0, 40, 0, "off" },
2142 { "ssl-ca-location",0, 40, 0, "" },
2143 { "ssl-identity", 0, 40, 0, "" },
2144 #ifdef FOSSIL_ENABLE_TCL
2145 { "tcl", 0, 0, 0, "off" },
2146 { "tcl-setup", 0, 40, 0, "" },
@@ -2310,14 +2308,10 @@
2310 ** ssh-command Command used to talk to a remote machine with
2311 ** the "ssh://" protocol.
2312 **
2313 ** ssh-fossil Remote fossil command to run with the "ssh://" protocol.
2314 **
2315 ** ssh-fossil-user Fossil user to use instead of the URL user.
2316 **
2317 ** ssh-use-http Use http instead of test-http. Default: off.
2318 **
2319 ** ssl-ca-location The full pathname to a file containing PEM encoded
2320 ** CA root certificates, or a directory of certificates
2321 ** with filenames formed from the certificate hashes as
2322 ** required by OpenSSL.
2323 ** If set, this will override the OS default list of
2324
--- src/db.c
+++ src/db.c
@@ -2135,12 +2135,10 @@
2135 { "relative-paths",0, 0, 0, "on" },
2136 { "repo-cksum", 0, 0, 0, "on" },
2137 { "self-register", 0, 0, 0, "off" },
2138 { "ssh-command", 0, 40, 0, "" },
2139 { "ssh-fossil", 0, 40, 0, "" },
 
 
2140 { "ssl-ca-location",0, 40, 0, "" },
2141 { "ssl-identity", 0, 40, 0, "" },
2142 #ifdef FOSSIL_ENABLE_TCL
2143 { "tcl", 0, 0, 0, "off" },
2144 { "tcl-setup", 0, 40, 0, "" },
@@ -2310,14 +2308,10 @@
2308 ** ssh-command Command used to talk to a remote machine with
2309 ** the "ssh://" protocol.
2310 **
2311 ** ssh-fossil Remote fossil command to run with the "ssh://" protocol.
2312 **
 
 
 
 
2313 ** ssl-ca-location The full pathname to a file containing PEM encoded
2314 ** CA root certificates, or a directory of certificates
2315 ** with filenames formed from the certificate hashes as
2316 ** required by OpenSSL.
2317 ** If set, this will override the OS default list of
2318
--- src/http_transport.c
+++ src/http_transport.c
@@ -136,11 +136,11 @@
136136
n = blob_size(&zCmd);
137137
blob_append(&zCmd, " ", 1);
138138
shell_escape(&zCmd, zHost);
139139
blob_append(&zCmd, " ", 1);
140140
shell_escape(&zCmd, mprintf("%s", zSshFossilCmd));
141
- if( db_get_boolean("ssh-use-http", 0) ){
141
+ if( url_ssh_use_http() ){
142142
blob_append(&zCmd, " http", 5);
143143
}else{
144144
blob_append(&zCmd, " test-http", 10);
145145
}
146146
if( g.urlPath && g.urlPath[0] ){
147147
--- src/http_transport.c
+++ src/http_transport.c
@@ -136,11 +136,11 @@
136 n = blob_size(&zCmd);
137 blob_append(&zCmd, " ", 1);
138 shell_escape(&zCmd, zHost);
139 blob_append(&zCmd, " ", 1);
140 shell_escape(&zCmd, mprintf("%s", zSshFossilCmd));
141 if( db_get_boolean("ssh-use-http", 0) ){
142 blob_append(&zCmd, " http", 5);
143 }else{
144 blob_append(&zCmd, " test-http", 10);
145 }
146 if( g.urlPath && g.urlPath[0] ){
147
--- src/http_transport.c
+++ src/http_transport.c
@@ -136,11 +136,11 @@
136 n = blob_size(&zCmd);
137 blob_append(&zCmd, " ", 1);
138 shell_escape(&zCmd, zHost);
139 blob_append(&zCmd, " ", 1);
140 shell_escape(&zCmd, mprintf("%s", zSshFossilCmd));
141 if( url_ssh_use_http() ){
142 blob_append(&zCmd, " http", 5);
143 }else{
144 blob_append(&zCmd, " test-http", 10);
145 }
146 if( g.urlPath && g.urlPath[0] ){
147
-2
--- src/main.c
+++ src/main.c
@@ -134,11 +134,10 @@
134134
int fSqlPrint; /* True if -sqlprint flag is present */
135135
int fQuiet; /* True if -quiet flag is present */
136136
int fHttpTrace; /* Trace outbound HTTP requests */
137137
int fSystemTrace; /* Trace calls to fossil_system(), --systemtrace */
138138
int fSshTrace; /* Trace the SSH setup traffic */
139
- char *zSshUseHttp; /* Use http or test-http mode for SSH */
140139
char *zSshFossilCmd; /* Path to remoe fossil command for SSH */
141140
char *zSshCmd; /* SSH command string */
142141
char *zFossilUser; /* Fossil user if different from URL user */
143142
int fNoSync; /* Do not do an autosync ever. --nosync */
144143
char *zPath; /* Name of webpage being served */
@@ -582,11 +581,10 @@
582581
g.fQuiet = find_option("quiet", 0, 0)!=0;
583582
g.fSqlTrace = find_option("sqltrace", 0, 0)!=0;
584583
g.fSqlStats = find_option("sqlstats", 0, 0)!=0;
585584
g.fSystemTrace = find_option("systemtrace", 0, 0)!=0;
586585
g.fSshTrace = find_option("sshtrace", 0, 0)!=0;
587
- g.zSshUseHttp = 0;
588586
g.zSshFossilCmd = 0;
589587
g.zSshCmd = 0;
590588
g.zFossilUser = 0;
591589
if( g.fSqlTrace ) g.fSqlStats = 1;
592590
g.fSqlPrint = find_option("sqlprint", 0, 0)!=0;
593591
--- src/main.c
+++ src/main.c
@@ -134,11 +134,10 @@
134 int fSqlPrint; /* True if -sqlprint flag is present */
135 int fQuiet; /* True if -quiet flag is present */
136 int fHttpTrace; /* Trace outbound HTTP requests */
137 int fSystemTrace; /* Trace calls to fossil_system(), --systemtrace */
138 int fSshTrace; /* Trace the SSH setup traffic */
139 char *zSshUseHttp; /* Use http or test-http mode for SSH */
140 char *zSshFossilCmd; /* Path to remoe fossil command for SSH */
141 char *zSshCmd; /* SSH command string */
142 char *zFossilUser; /* Fossil user if different from URL user */
143 int fNoSync; /* Do not do an autosync ever. --nosync */
144 char *zPath; /* Name of webpage being served */
@@ -582,11 +581,10 @@
582 g.fQuiet = find_option("quiet", 0, 0)!=0;
583 g.fSqlTrace = find_option("sqltrace", 0, 0)!=0;
584 g.fSqlStats = find_option("sqlstats", 0, 0)!=0;
585 g.fSystemTrace = find_option("systemtrace", 0, 0)!=0;
586 g.fSshTrace = find_option("sshtrace", 0, 0)!=0;
587 g.zSshUseHttp = 0;
588 g.zSshFossilCmd = 0;
589 g.zSshCmd = 0;
590 g.zFossilUser = 0;
591 if( g.fSqlTrace ) g.fSqlStats = 1;
592 g.fSqlPrint = find_option("sqlprint", 0, 0)!=0;
593
--- src/main.c
+++ src/main.c
@@ -134,11 +134,10 @@
134 int fSqlPrint; /* True if -sqlprint flag is present */
135 int fQuiet; /* True if -quiet flag is present */
136 int fHttpTrace; /* Trace outbound HTTP requests */
137 int fSystemTrace; /* Trace calls to fossil_system(), --systemtrace */
138 int fSshTrace; /* Trace the SSH setup traffic */
 
139 char *zSshFossilCmd; /* Path to remoe fossil command for SSH */
140 char *zSshCmd; /* SSH command string */
141 char *zFossilUser; /* Fossil user if different from URL user */
142 int fNoSync; /* Do not do an autosync ever. --nosync */
143 char *zPath; /* Name of webpage being served */
@@ -582,11 +581,10 @@
581 g.fQuiet = find_option("quiet", 0, 0)!=0;
582 g.fSqlTrace = find_option("sqltrace", 0, 0)!=0;
583 g.fSqlStats = find_option("sqlstats", 0, 0)!=0;
584 g.fSystemTrace = find_option("systemtrace", 0, 0)!=0;
585 g.fSshTrace = find_option("sshtrace", 0, 0)!=0;
 
586 g.zSshFossilCmd = 0;
587 g.zSshCmd = 0;
588 g.zFossilUser = 0;
589 if( g.fSqlTrace ) g.fSqlStats = 1;
590 g.fSqlPrint = find_option("sqlprint", 0, 0)!=0;
591
+11 -5
--- src/sync.c
+++ src/sync.c
@@ -69,11 +69,11 @@
6969
*/
7070
configSync = CONFIGSET_SHUN;
7171
}
7272
#endif
7373
if( find_option("verbose","v",0)!=0 ) flags |= SYNC_VERBOSE;
74
- is_fossil_user() && url_ssh_use_http() ?
74
+ is_fossil_user() ?
7575
fossil_print("Autosync: (%s) %s\n", get_fossil_user(), g.urlCanonical) :
7676
fossil_print("Autosync: %s\n", g.urlCanonical);
7777
url_enable_proxy("via proxy: ");
7878
rc = client_sync(flags, configSync, 0);
7979
if( rc ) fossil_warning("Autosync failed");
@@ -114,10 +114,13 @@
114114
db_open_config(0);
115115
if( g.argc==2 ){
116116
if( db_get_boolean("auto-shun",1) ) configSync = CONFIGSET_SHUN;
117117
}else if( g.argc==3 ){
118118
zUrl = g.argv[2];
119
+ if( urlFlags & URL_REMEMBER ){
120
+ db_unset("ssh-fossil-user", 0);
121
+ }
119122
}
120123
if( urlFlags & URL_REMEMBER ){
121124
clone_ssh_db_set_options();
122125
}
123126
url_parse(zUrl, urlFlags);
@@ -126,19 +129,19 @@
126129
usage("URL");
127130
}
128131
user_select();
129132
if( g.argc==2 ){
130133
if( ((*pSyncFlags) & (SYNC_PUSH|SYNC_PULL))==(SYNC_PUSH|SYNC_PULL) ){
131
- is_fossil_user() && url_ssh_use_http() ?
134
+ is_fossil_user() ?
132135
fossil_print("Sync with (%s) %s\n",get_fossil_user(),g.urlCanonical):
133136
fossil_print("Sync with %s\n", g.urlCanonical);
134137
}else if( (*pSyncFlags) & SYNC_PUSH ){
135
- is_fossil_user() && url_ssh_use_http() ?
138
+ is_fossil_user() ?
136139
fossil_print("Push to (%s) %s\n", get_fossil_user(), g.urlCanonical):
137140
fossil_print("Push to %s\n", g.urlCanonical);
138141
}else if( (*pSyncFlags) & SYNC_PULL ){
139
- is_fossil_user() && url_ssh_use_http() ?
142
+ is_fossil_user() ?
140143
fossil_print("Pull from (%s) %s\n",get_fossil_user(),g.urlCanonical):
141144
fossil_print("Pull from %s\n", g.urlCanonical);
142145
}
143146
}
144147
url_enable_proxy("via proxy: ");
@@ -267,17 +270,20 @@
267270
usage("remote-url ?URL|off?");
268271
}
269272
if( g.argc==3 ){
270273
db_unset("last-sync-url", 0);
271274
db_unset("last-sync-pw", 0);
275
+ db_unset("ssh-fossil-user", 0);
272276
if( is_false(g.argv[2]) ) return;
273277
url_parse(g.argv[2], URL_REMEMBER|URL_PROMPT_PW);
274278
}
275279
zUrl = db_get("last-sync-url", 0);
276280
if( zUrl==0 ){
277281
fossil_print("off\n");
278282
return;
279283
}else{
280284
url_parse(zUrl, 0);
281
- fossil_print("%s\n", g.urlCanonical);
285
+ is_fossil_user() ?
286
+ fossil_print("(%s) %s\n", get_fossil_user(), g.urlCanonical) :
287
+ fossil_print("%s\n", g.urlCanonical);
282288
}
283289
}
284290
--- src/sync.c
+++ src/sync.c
@@ -69,11 +69,11 @@
69 */
70 configSync = CONFIGSET_SHUN;
71 }
72 #endif
73 if( find_option("verbose","v",0)!=0 ) flags |= SYNC_VERBOSE;
74 is_fossil_user() && url_ssh_use_http() ?
75 fossil_print("Autosync: (%s) %s\n", get_fossil_user(), g.urlCanonical) :
76 fossil_print("Autosync: %s\n", g.urlCanonical);
77 url_enable_proxy("via proxy: ");
78 rc = client_sync(flags, configSync, 0);
79 if( rc ) fossil_warning("Autosync failed");
@@ -114,10 +114,13 @@
114 db_open_config(0);
115 if( g.argc==2 ){
116 if( db_get_boolean("auto-shun",1) ) configSync = CONFIGSET_SHUN;
117 }else if( g.argc==3 ){
118 zUrl = g.argv[2];
 
 
 
119 }
120 if( urlFlags & URL_REMEMBER ){
121 clone_ssh_db_set_options();
122 }
123 url_parse(zUrl, urlFlags);
@@ -126,19 +129,19 @@
126 usage("URL");
127 }
128 user_select();
129 if( g.argc==2 ){
130 if( ((*pSyncFlags) & (SYNC_PUSH|SYNC_PULL))==(SYNC_PUSH|SYNC_PULL) ){
131 is_fossil_user() && url_ssh_use_http() ?
132 fossil_print("Sync with (%s) %s\n",get_fossil_user(),g.urlCanonical):
133 fossil_print("Sync with %s\n", g.urlCanonical);
134 }else if( (*pSyncFlags) & SYNC_PUSH ){
135 is_fossil_user() && url_ssh_use_http() ?
136 fossil_print("Push to (%s) %s\n", get_fossil_user(), g.urlCanonical):
137 fossil_print("Push to %s\n", g.urlCanonical);
138 }else if( (*pSyncFlags) & SYNC_PULL ){
139 is_fossil_user() && url_ssh_use_http() ?
140 fossil_print("Pull from (%s) %s\n",get_fossil_user(),g.urlCanonical):
141 fossil_print("Pull from %s\n", g.urlCanonical);
142 }
143 }
144 url_enable_proxy("via proxy: ");
@@ -267,17 +270,20 @@
267 usage("remote-url ?URL|off?");
268 }
269 if( g.argc==3 ){
270 db_unset("last-sync-url", 0);
271 db_unset("last-sync-pw", 0);
 
272 if( is_false(g.argv[2]) ) return;
273 url_parse(g.argv[2], URL_REMEMBER|URL_PROMPT_PW);
274 }
275 zUrl = db_get("last-sync-url", 0);
276 if( zUrl==0 ){
277 fossil_print("off\n");
278 return;
279 }else{
280 url_parse(zUrl, 0);
281 fossil_print("%s\n", g.urlCanonical);
 
 
282 }
283 }
284
--- src/sync.c
+++ src/sync.c
@@ -69,11 +69,11 @@
69 */
70 configSync = CONFIGSET_SHUN;
71 }
72 #endif
73 if( find_option("verbose","v",0)!=0 ) flags |= SYNC_VERBOSE;
74 is_fossil_user() ?
75 fossil_print("Autosync: (%s) %s\n", get_fossil_user(), g.urlCanonical) :
76 fossil_print("Autosync: %s\n", g.urlCanonical);
77 url_enable_proxy("via proxy: ");
78 rc = client_sync(flags, configSync, 0);
79 if( rc ) fossil_warning("Autosync failed");
@@ -114,10 +114,13 @@
114 db_open_config(0);
115 if( g.argc==2 ){
116 if( db_get_boolean("auto-shun",1) ) configSync = CONFIGSET_SHUN;
117 }else if( g.argc==3 ){
118 zUrl = g.argv[2];
119 if( urlFlags & URL_REMEMBER ){
120 db_unset("ssh-fossil-user", 0);
121 }
122 }
123 if( urlFlags & URL_REMEMBER ){
124 clone_ssh_db_set_options();
125 }
126 url_parse(zUrl, urlFlags);
@@ -126,19 +129,19 @@
129 usage("URL");
130 }
131 user_select();
132 if( g.argc==2 ){
133 if( ((*pSyncFlags) & (SYNC_PUSH|SYNC_PULL))==(SYNC_PUSH|SYNC_PULL) ){
134 is_fossil_user() ?
135 fossil_print("Sync with (%s) %s\n",get_fossil_user(),g.urlCanonical):
136 fossil_print("Sync with %s\n", g.urlCanonical);
137 }else if( (*pSyncFlags) & SYNC_PUSH ){
138 is_fossil_user() ?
139 fossil_print("Push to (%s) %s\n", get_fossil_user(), g.urlCanonical):
140 fossil_print("Push to %s\n", g.urlCanonical);
141 }else if( (*pSyncFlags) & SYNC_PULL ){
142 is_fossil_user() ?
143 fossil_print("Pull from (%s) %s\n",get_fossil_user(),g.urlCanonical):
144 fossil_print("Pull from %s\n", g.urlCanonical);
145 }
146 }
147 url_enable_proxy("via proxy: ");
@@ -267,17 +270,20 @@
270 usage("remote-url ?URL|off?");
271 }
272 if( g.argc==3 ){
273 db_unset("last-sync-url", 0);
274 db_unset("last-sync-pw", 0);
275 db_unset("ssh-fossil-user", 0);
276 if( is_false(g.argv[2]) ) return;
277 url_parse(g.argv[2], URL_REMEMBER|URL_PROMPT_PW);
278 }
279 zUrl = db_get("last-sync-url", 0);
280 if( zUrl==0 ){
281 fossil_print("off\n");
282 return;
283 }else{
284 url_parse(zUrl, 0);
285 is_fossil_user() ?
286 fossil_print("(%s) %s\n", get_fossil_user(), g.urlCanonical) :
287 fossil_print("%s\n", g.urlCanonical);
288 }
289 }
290
+9 -2
--- src/url.c
+++ src/url.c
@@ -77,10 +77,18 @@
7777
7878
if( zUrl==0 ){
7979
zUrl = db_get("last-sync-url", 0);
8080
if( zUrl==0 ) return;
8181
g.urlPasswd = unobscure(db_get("last-sync-pw", 0));
82
+ if( g.zFossilUser==0 ){
83
+ g.zFossilUser = db_get("ssh-fossil-user", 0);
84
+ }else{
85
+ if( g.urlPasswd ) {
86
+ free(g.urlPasswd);
87
+ g.urlPasswd = 0;
88
+ }
89
+ }
8290
bSetUrl = 0;
8391
}
8492
8593
if( strncmp(zUrl, "http://", 7)==0
8694
|| strncmp(zUrl, "https://", 8)==0
@@ -435,12 +443,11 @@
435443
436444
/*
437445
** Return true if http mode is in use for "ssh://" URL.
438446
*/
439447
int url_ssh_use_http(void){
440
- return ( g.zSshUseHttp && g.zSshUseHttp[0] ) ? is_truth(g.zSshUseHttp) :
441
- db_get_boolean("ssh-use-http", 0);
448
+ return get_fossil_user()!=0;
442449
}
443450
444451
/*
445452
** Remember the URL if requested.
446453
*/
447454
--- src/url.c
+++ src/url.c
@@ -77,10 +77,18 @@
77
78 if( zUrl==0 ){
79 zUrl = db_get("last-sync-url", 0);
80 if( zUrl==0 ) return;
81 g.urlPasswd = unobscure(db_get("last-sync-pw", 0));
 
 
 
 
 
 
 
 
82 bSetUrl = 0;
83 }
84
85 if( strncmp(zUrl, "http://", 7)==0
86 || strncmp(zUrl, "https://", 8)==0
@@ -435,12 +443,11 @@
435
436 /*
437 ** Return true if http mode is in use for "ssh://" URL.
438 */
439 int url_ssh_use_http(void){
440 return ( g.zSshUseHttp && g.zSshUseHttp[0] ) ? is_truth(g.zSshUseHttp) :
441 db_get_boolean("ssh-use-http", 0);
442 }
443
444 /*
445 ** Remember the URL if requested.
446 */
447
--- src/url.c
+++ src/url.c
@@ -77,10 +77,18 @@
77
78 if( zUrl==0 ){
79 zUrl = db_get("last-sync-url", 0);
80 if( zUrl==0 ) return;
81 g.urlPasswd = unobscure(db_get("last-sync-pw", 0));
82 if( g.zFossilUser==0 ){
83 g.zFossilUser = db_get("ssh-fossil-user", 0);
84 }else{
85 if( g.urlPasswd ) {
86 free(g.urlPasswd);
87 g.urlPasswd = 0;
88 }
89 }
90 bSetUrl = 0;
91 }
92
93 if( strncmp(zUrl, "http://", 7)==0
94 || strncmp(zUrl, "https://", 8)==0
@@ -435,12 +443,11 @@
443
444 /*
445 ** Return true if http mode is in use for "ssh://" URL.
446 */
447 int url_ssh_use_http(void){
448 return get_fossil_user()!=0;
 
449 }
450
451 /*
452 ** Remember the URL if requested.
453 */
454
+1 -1
--- src/user.c
+++ src/user.c
@@ -164,11 +164,11 @@
164164
const char *url_or_fossil_user(void){
165165
return is_fossil_user() ? get_fossil_user() : g.urlUser;
166166
}
167167
168168
/*
169
-** Return the Fossil user from global variable (set from command line
169
+** Return the Fossil user from global variable (set from command line)
170170
** or ssh-fossil-user database setting.
171171
*/
172172
const char *get_fossil_user(void){
173173
return ( g.zFossilUser && g.zFossilUser[0] ) ? g.zFossilUser :
174174
db_get("ssh-fossil-user", 0);
175175
--- src/user.c
+++ src/user.c
@@ -164,11 +164,11 @@
164 const char *url_or_fossil_user(void){
165 return is_fossil_user() ? get_fossil_user() : g.urlUser;
166 }
167
168 /*
169 ** Return the Fossil user from global variable (set from command line
170 ** or ssh-fossil-user database setting.
171 */
172 const char *get_fossil_user(void){
173 return ( g.zFossilUser && g.zFossilUser[0] ) ? g.zFossilUser :
174 db_get("ssh-fossil-user", 0);
175
--- src/user.c
+++ src/user.c
@@ -164,11 +164,11 @@
164 const char *url_or_fossil_user(void){
165 return is_fossil_user() ? get_fossil_user() : g.urlUser;
166 }
167
168 /*
169 ** Return the Fossil user from global variable (set from command line)
170 ** or ssh-fossil-user database setting.
171 */
172 const char *get_fossil_user(void){
173 return ( g.zFossilUser && g.zFossilUser[0] ) ? g.zFossilUser :
174 db_get("ssh-fossil-user", 0);
175

Keyboard Shortcuts

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