Index: src/clone.c ================================================================== --- src/clone.c +++ src/clone.c @@ -105,10 +105,11 @@ ** admin user. This can be overridden using the -A|--admin-user ** parameter. ** ** Options: ** --admin-user|-A USERNAME Make USERNAME the administrator +** --once Don't save url. ** --private Also clone private branches ** --ssl-identity=filename Use the SSL identity if requested by the server ** --ssh-command|-c 'command' Use this SSH command ** ** See also: init @@ -116,12 +117,14 @@ void clone_cmd(void){ char *zPassword; const char *zDefaultUser; /* Optional name of the default user */ int nErr = 0; int bPrivate = 0; /* Also clone private branches */ + int urlFlags = URL_PROMPT_PW | URL_REMEMBER; if( find_option("private",0,0)!=0 ) bPrivate = SYNC_PRIVATE; + if( find_option("once",0,0)!=0) urlFlags &= ~URL_REMEMBER; clone_ssh_find_options(); url_proxy_options(); if( g.argc < 4 ){ usage("?OPTIONS? FILE-OR-URL NEW-REPOSITORY"); } @@ -130,11 +133,11 @@ fossil_fatal("file already exists: %s", g.argv[3]); } zDefaultUser = find_option("admin-user","A",1); - url_parse(g.argv[2], URL_PROMPT_PW|URL_ASK_REMEMBER_PW); + url_parse(g.argv[2], urlFlags); if( zDefaultUser==0 && g.urlUser!=0 ) zDefaultUser = g.urlUser; if( g.urlIsFile ){ file_copy(g.urlName, g.argv[3]); db_close(1); db_open_repository(g.argv[3]); Index: src/sync.c ================================================================== --- src/sync.c +++ src/sync.c @@ -54,10 +54,11 @@ if( g.urlUser!=0 && g.urlPasswd==0 ){ g.urlPasswd = unobscure(db_get("last-sync-pw", 0)); g.urlFlags |= URL_PROMPT_PW; url_prompt_for_password(); } + url_remember(); #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. ** @@ -115,10 +116,11 @@ } if( urlFlags & URL_REMEMBER ){ clone_ssh_db_set_options(); } url_parse(zUrl, urlFlags); + url_remember(); if( g.urlProtocol==0 ){ if( urlOptional ) fossil_exit(0); usage("URL"); } user_select(); @@ -262,16 +264,17 @@ } if( g.argc==3 ){ db_unset("last-sync-url", 0); db_unset("last-sync-pw", 0); if( is_false(g.argv[2]) ) return; - url_parse(g.argv[2], URL_REMEMBER|URL_PROMPT_PW); + url_parse(g.argv[2], URL_REMEMBER|URL_PROMPT_PW|URL_ASK_REMEMBER_PW); } + url_remember(); zUrl = db_get("last-sync-url", 0); if( zUrl==0 ){ fossil_print("off\n"); return; }else{ url_parse(zUrl, 0); fossil_print("%s\n", g.urlCanonical); } } Index: src/url.c ================================================================== --- src/url.c +++ src/url.c @@ -17,10 +17,16 @@ ** ** This file contains code for parsing URLs that appear on the command-line */ #include "config.h" #include "url.h" +#include +#ifdef _WIN32 +#include +#define isatty(d) _isatty(d) +#define fileno(s) _fileno(s) +#endif #if INTERFACE /* ** Flags for url_parse() */ @@ -64,24 +70,23 @@ ** ** http://userid:password@host:port/path ** ** SSH url format is: ** -** ssh://userid:password@host:port/path?fossil=path/to/fossil.exe +** ssh://userid@host:port/path?fossil=path/to/fossil.exe ** */ void url_parse(const char *zUrl, unsigned int urlFlags){ int i, j, c; char *zFile = 0; - int bPrompted = 0; - int bSetUrl = 1; if( zUrl==0 ){ zUrl = db_get("last-sync-url", 0); if( zUrl==0 ) return; - g.urlPasswd = unobscure(db_get("last-sync-pw", 0)); - bSetUrl = 0; + if( g.urlPasswd==0 ){ + g.urlPasswd = unobscure(db_get("last-sync-pw", 0)); + } } if( strncmp(zUrl, "http://", 7)==0 || strncmp(zUrl, "https://", 8)==0 || strncmp(zUrl, "ssh://", 6)==0 @@ -114,18 +119,20 @@ /* Parse up the user-id and password */ for(j=iStart; j