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.
Commit
ed20da74998324afe3534f357491ba11d54b0679
Parent
0c1942432551ca5…
7 files changed
+8
-19
-6
+1
-1
-2
+11
-5
+9
-2
+1
-1
+8
-19
| --- src/clone.c | ||
| +++ src/clone.c | ||
| @@ -96,11 +96,10 @@ | ||
| 96 | 96 | ** --private Also clone private branches |
| 97 | 97 | ** --ssl-identity=filename Use the SSL identity if requested by the server |
| 98 | 98 | ** --ssh-fossil|-f /fossil Use this path as remote fossil command |
| 99 | 99 | ** --ssh-command|-c 'command' Use this SSH command |
| 100 | 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 | 101 | ** |
| 103 | 102 | ** See also: init |
| 104 | 103 | */ |
| 105 | 104 | void clone_cmd(void){ |
| 106 | 105 | char *zPassword; |
| @@ -188,11 +187,10 @@ | ||
| 188 | 187 | */ |
| 189 | 188 | void clone_ssh_find_options(void){ |
| 190 | 189 | const char *zSshFossilCmd; /* Path to remote fossil command for SSH */ |
| 191 | 190 | const char *zSshCmd; /* SSH command string */ |
| 192 | 191 | const char *zFossilUser; /* Fossil user if login specified for SSH */ |
| 193 | - const char *zSshUseHttp; /* Use http or test-http mode for SSH */ | |
| 194 | 192 | |
| 195 | 193 | zSshFossilCmd = find_option("ssh-fossil","f",1); |
| 196 | 194 | if( zSshFossilCmd && zSshFossilCmd[0] ){ |
| 197 | 195 | g.zSshFossilCmd = mprintf("%s", zSshFossilCmd); |
| 198 | 196 | } |
| @@ -202,31 +200,22 @@ | ||
| 202 | 200 | } |
| 203 | 201 | zFossilUser = find_option("ssh-fossil-user","l",1); |
| 204 | 202 | if( zFossilUser && zFossilUser[0] ){ |
| 205 | 203 | g.zFossilUser = mprintf("%s", zFossilUser); |
| 206 | 204 | } |
| 207 | - zSshUseHttp = find_option("ssh-use-http","h",1); | |
| 208 | - if( zSshUseHttp && zSshUseHttp[0] ){ | |
| 209 | - g.zSshUseHttp = mprintf("%s", zSshUseHttp); | |
| 210 | - } | |
| 211 | 205 | } |
| 212 | 206 | |
| 213 | 207 | /* |
| 214 | 208 | ** Set SSH options discovered in global variables (set from command line |
| 215 | 209 | ** options). |
| 216 | 210 | */ |
| 217 | 211 | 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); | |
| 231 | 220 | } |
| 232 | 221 | } |
| 233 | 222 |
| --- 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 |
M
src/db.c
-6
| --- src/db.c | ||
| +++ src/db.c | ||
| @@ -2135,12 +2135,10 @@ | ||
| 2135 | 2135 | { "relative-paths",0, 0, 0, "on" }, |
| 2136 | 2136 | { "repo-cksum", 0, 0, 0, "on" }, |
| 2137 | 2137 | { "self-register", 0, 0, 0, "off" }, |
| 2138 | 2138 | { "ssh-command", 0, 40, 0, "" }, |
| 2139 | 2139 | { "ssh-fossil", 0, 40, 0, "" }, |
| 2140 | - { "ssh-fossil-user", 0, 40, 0, "" }, | |
| 2141 | - { "ssh-use-http", 0, 40, 0, "off" }, | |
| 2142 | 2140 | { "ssl-ca-location",0, 40, 0, "" }, |
| 2143 | 2141 | { "ssl-identity", 0, 40, 0, "" }, |
| 2144 | 2142 | #ifdef FOSSIL_ENABLE_TCL |
| 2145 | 2143 | { "tcl", 0, 0, 0, "off" }, |
| 2146 | 2144 | { "tcl-setup", 0, 40, 0, "" }, |
| @@ -2310,14 +2308,10 @@ | ||
| 2310 | 2308 | ** ssh-command Command used to talk to a remote machine with |
| 2311 | 2309 | ** the "ssh://" protocol. |
| 2312 | 2310 | ** |
| 2313 | 2311 | ** ssh-fossil Remote fossil command to run with the "ssh://" protocol. |
| 2314 | 2312 | ** |
| 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 | 2313 | ** ssl-ca-location The full pathname to a file containing PEM encoded |
| 2320 | 2314 | ** CA root certificates, or a directory of certificates |
| 2321 | 2315 | ** with filenames formed from the certificate hashes as |
| 2322 | 2316 | ** required by OpenSSL. |
| 2323 | 2317 | ** If set, this will override the OS default list of |
| 2324 | 2318 |
| --- 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 |
+1
-1
| --- src/http_transport.c | ||
| +++ src/http_transport.c | ||
| @@ -136,11 +136,11 @@ | ||
| 136 | 136 | n = blob_size(&zCmd); |
| 137 | 137 | blob_append(&zCmd, " ", 1); |
| 138 | 138 | shell_escape(&zCmd, zHost); |
| 139 | 139 | blob_append(&zCmd, " ", 1); |
| 140 | 140 | shell_escape(&zCmd, mprintf("%s", zSshFossilCmd)); |
| 141 | - if( db_get_boolean("ssh-use-http", 0) ){ | |
| 141 | + if( url_ssh_use_http() ){ | |
| 142 | 142 | blob_append(&zCmd, " http", 5); |
| 143 | 143 | }else{ |
| 144 | 144 | blob_append(&zCmd, " test-http", 10); |
| 145 | 145 | } |
| 146 | 146 | if( g.urlPath && g.urlPath[0] ){ |
| 147 | 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( 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 @@ | ||
| 134 | 134 | int fSqlPrint; /* True if -sqlprint flag is present */ |
| 135 | 135 | int fQuiet; /* True if -quiet flag is present */ |
| 136 | 136 | int fHttpTrace; /* Trace outbound HTTP requests */ |
| 137 | 137 | int fSystemTrace; /* Trace calls to fossil_system(), --systemtrace */ |
| 138 | 138 | int fSshTrace; /* Trace the SSH setup traffic */ |
| 139 | - char *zSshUseHttp; /* Use http or test-http mode for SSH */ | |
| 140 | 139 | char *zSshFossilCmd; /* Path to remoe fossil command for SSH */ |
| 141 | 140 | char *zSshCmd; /* SSH command string */ |
| 142 | 141 | char *zFossilUser; /* Fossil user if different from URL user */ |
| 143 | 142 | int fNoSync; /* Do not do an autosync ever. --nosync */ |
| 144 | 143 | char *zPath; /* Name of webpage being served */ |
| @@ -582,11 +581,10 @@ | ||
| 582 | 581 | g.fQuiet = find_option("quiet", 0, 0)!=0; |
| 583 | 582 | g.fSqlTrace = find_option("sqltrace", 0, 0)!=0; |
| 584 | 583 | g.fSqlStats = find_option("sqlstats", 0, 0)!=0; |
| 585 | 584 | g.fSystemTrace = find_option("systemtrace", 0, 0)!=0; |
| 586 | 585 | g.fSshTrace = find_option("sshtrace", 0, 0)!=0; |
| 587 | - g.zSshUseHttp = 0; | |
| 588 | 586 | g.zSshFossilCmd = 0; |
| 589 | 587 | g.zSshCmd = 0; |
| 590 | 588 | g.zFossilUser = 0; |
| 591 | 589 | if( g.fSqlTrace ) g.fSqlStats = 1; |
| 592 | 590 | g.fSqlPrint = find_option("sqlprint", 0, 0)!=0; |
| 593 | 591 |
| --- 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 @@ | ||
| 69 | 69 | */ |
| 70 | 70 | configSync = CONFIGSET_SHUN; |
| 71 | 71 | } |
| 72 | 72 | #endif |
| 73 | 73 | if( find_option("verbose","v",0)!=0 ) flags |= SYNC_VERBOSE; |
| 74 | - is_fossil_user() && url_ssh_use_http() ? | |
| 74 | + is_fossil_user() ? | |
| 75 | 75 | fossil_print("Autosync: (%s) %s\n", get_fossil_user(), g.urlCanonical) : |
| 76 | 76 | fossil_print("Autosync: %s\n", g.urlCanonical); |
| 77 | 77 | url_enable_proxy("via proxy: "); |
| 78 | 78 | rc = client_sync(flags, configSync, 0); |
| 79 | 79 | if( rc ) fossil_warning("Autosync failed"); |
| @@ -114,10 +114,13 @@ | ||
| 114 | 114 | db_open_config(0); |
| 115 | 115 | if( g.argc==2 ){ |
| 116 | 116 | if( db_get_boolean("auto-shun",1) ) configSync = CONFIGSET_SHUN; |
| 117 | 117 | }else if( g.argc==3 ){ |
| 118 | 118 | zUrl = g.argv[2]; |
| 119 | + if( urlFlags & URL_REMEMBER ){ | |
| 120 | + db_unset("ssh-fossil-user", 0); | |
| 121 | + } | |
| 119 | 122 | } |
| 120 | 123 | if( urlFlags & URL_REMEMBER ){ |
| 121 | 124 | clone_ssh_db_set_options(); |
| 122 | 125 | } |
| 123 | 126 | url_parse(zUrl, urlFlags); |
| @@ -126,19 +129,19 @@ | ||
| 126 | 129 | usage("URL"); |
| 127 | 130 | } |
| 128 | 131 | user_select(); |
| 129 | 132 | if( g.argc==2 ){ |
| 130 | 133 | if( ((*pSyncFlags) & (SYNC_PUSH|SYNC_PULL))==(SYNC_PUSH|SYNC_PULL) ){ |
| 131 | - is_fossil_user() && url_ssh_use_http() ? | |
| 134 | + is_fossil_user() ? | |
| 132 | 135 | fossil_print("Sync with (%s) %s\n",get_fossil_user(),g.urlCanonical): |
| 133 | 136 | fossil_print("Sync with %s\n", g.urlCanonical); |
| 134 | 137 | }else if( (*pSyncFlags) & SYNC_PUSH ){ |
| 135 | - is_fossil_user() && url_ssh_use_http() ? | |
| 138 | + is_fossil_user() ? | |
| 136 | 139 | fossil_print("Push to (%s) %s\n", get_fossil_user(), g.urlCanonical): |
| 137 | 140 | fossil_print("Push to %s\n", g.urlCanonical); |
| 138 | 141 | }else if( (*pSyncFlags) & SYNC_PULL ){ |
| 139 | - is_fossil_user() && url_ssh_use_http() ? | |
| 142 | + is_fossil_user() ? | |
| 140 | 143 | fossil_print("Pull from (%s) %s\n",get_fossil_user(),g.urlCanonical): |
| 141 | 144 | fossil_print("Pull from %s\n", g.urlCanonical); |
| 142 | 145 | } |
| 143 | 146 | } |
| 144 | 147 | url_enable_proxy("via proxy: "); |
| @@ -267,17 +270,20 @@ | ||
| 267 | 270 | usage("remote-url ?URL|off?"); |
| 268 | 271 | } |
| 269 | 272 | if( g.argc==3 ){ |
| 270 | 273 | db_unset("last-sync-url", 0); |
| 271 | 274 | db_unset("last-sync-pw", 0); |
| 275 | + db_unset("ssh-fossil-user", 0); | |
| 272 | 276 | if( is_false(g.argv[2]) ) return; |
| 273 | 277 | url_parse(g.argv[2], URL_REMEMBER|URL_PROMPT_PW); |
| 274 | 278 | } |
| 275 | 279 | zUrl = db_get("last-sync-url", 0); |
| 276 | 280 | if( zUrl==0 ){ |
| 277 | 281 | fossil_print("off\n"); |
| 278 | 282 | return; |
| 279 | 283 | }else{ |
| 280 | 284 | 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); | |
| 282 | 288 | } |
| 283 | 289 | } |
| 284 | 290 |
| --- 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 @@ | ||
| 77 | 77 | |
| 78 | 78 | if( zUrl==0 ){ |
| 79 | 79 | zUrl = db_get("last-sync-url", 0); |
| 80 | 80 | if( zUrl==0 ) return; |
| 81 | 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 | + } | |
| 82 | 90 | bSetUrl = 0; |
| 83 | 91 | } |
| 84 | 92 | |
| 85 | 93 | if( strncmp(zUrl, "http://", 7)==0 |
| 86 | 94 | || strncmp(zUrl, "https://", 8)==0 |
| @@ -435,12 +443,11 @@ | ||
| 435 | 443 | |
| 436 | 444 | /* |
| 437 | 445 | ** Return true if http mode is in use for "ssh://" URL. |
| 438 | 446 | */ |
| 439 | 447 | 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; | |
| 442 | 449 | } |
| 443 | 450 | |
| 444 | 451 | /* |
| 445 | 452 | ** Remember the URL if requested. |
| 446 | 453 | */ |
| 447 | 454 |
| --- 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 @@ | ||
| 164 | 164 | const char *url_or_fossil_user(void){ |
| 165 | 165 | return is_fossil_user() ? get_fossil_user() : g.urlUser; |
| 166 | 166 | } |
| 167 | 167 | |
| 168 | 168 | /* |
| 169 | -** Return the Fossil user from global variable (set from command line | |
| 169 | +** Return the Fossil user from global variable (set from command line) | |
| 170 | 170 | ** or ssh-fossil-user database setting. |
| 171 | 171 | */ |
| 172 | 172 | const char *get_fossil_user(void){ |
| 173 | 173 | return ( g.zFossilUser && g.zFossilUser[0] ) ? g.zFossilUser : |
| 174 | 174 | db_get("ssh-fossil-user", 0); |
| 175 | 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 |
| --- 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 |