Fossil SCM

Merge the selectRemoteUser branch into trunk, so that now the username in the remote_url is a potential source of the user name.

drh 2012-09-19 10:28 trunk merge
Commit 24b2c6688a9fe574bbbb7ccb9a9e84395364e9ee
1 file changed +10
+10
--- src/user.c
+++ src/user.c
@@ -306,13 +306,17 @@
306306
**
307307
** (4) Try the USER environment variable.
308308
**
309309
** (5) Try the USERNAME environment variable.
310310
**
311
+** (6) Check if the user can be extracted from the remote URL.
312
+**
311313
** The user name is stored in g.zLogin. The uid is in g.userUid.
312314
*/
313315
void user_select(void){
316
+ char *zUrl;
317
+
314318
if( g.userUid ) return;
315319
if( g.zLogin ){
316320
if( attempt_user(g.zLogin)==0 ){
317321
fossil_fatal("no such user: %s", g.zLogin);
318322
}else{
@@ -325,10 +329,16 @@
325329
if( attempt_user(db_get("default-user", 0)) ) return;
326330
327331
if( attempt_user(fossil_getenv("USER")) ) return;
328332
329333
if( attempt_user(fossil_getenv("USERNAME")) ) return;
334
+
335
+ zUrl = db_get("last-sync-url", 0);
336
+ if( zUrl ){
337
+ url_parse(zUrl);
338
+ if( attempt_user(g.urlUser) ) return;
339
+ }
330340
331341
fossil_print(
332342
"Cannot figure out who you are! Consider using the --user\n"
333343
"command line option, setting your USER environment variable,\n"
334344
"or setting a default user with \"fossil user default USER\".\n"
335345
--- src/user.c
+++ src/user.c
@@ -306,13 +306,17 @@
306 **
307 ** (4) Try the USER environment variable.
308 **
309 ** (5) Try the USERNAME environment variable.
310 **
 
 
311 ** The user name is stored in g.zLogin. The uid is in g.userUid.
312 */
313 void user_select(void){
 
 
314 if( g.userUid ) return;
315 if( g.zLogin ){
316 if( attempt_user(g.zLogin)==0 ){
317 fossil_fatal("no such user: %s", g.zLogin);
318 }else{
@@ -325,10 +329,16 @@
325 if( attempt_user(db_get("default-user", 0)) ) return;
326
327 if( attempt_user(fossil_getenv("USER")) ) return;
328
329 if( attempt_user(fossil_getenv("USERNAME")) ) return;
 
 
 
 
 
 
330
331 fossil_print(
332 "Cannot figure out who you are! Consider using the --user\n"
333 "command line option, setting your USER environment variable,\n"
334 "or setting a default user with \"fossil user default USER\".\n"
335
--- src/user.c
+++ src/user.c
@@ -306,13 +306,17 @@
306 **
307 ** (4) Try the USER environment variable.
308 **
309 ** (5) Try the USERNAME environment variable.
310 **
311 ** (6) Check if the user can be extracted from the remote URL.
312 **
313 ** The user name is stored in g.zLogin. The uid is in g.userUid.
314 */
315 void user_select(void){
316 char *zUrl;
317
318 if( g.userUid ) return;
319 if( g.zLogin ){
320 if( attempt_user(g.zLogin)==0 ){
321 fossil_fatal("no such user: %s", g.zLogin);
322 }else{
@@ -325,10 +329,16 @@
329 if( attempt_user(db_get("default-user", 0)) ) return;
330
331 if( attempt_user(fossil_getenv("USER")) ) return;
332
333 if( attempt_user(fossil_getenv("USERNAME")) ) return;
334
335 zUrl = db_get("last-sync-url", 0);
336 if( zUrl ){
337 url_parse(zUrl);
338 if( attempt_user(g.urlUser) ) return;
339 }
340
341 fossil_print(
342 "Cannot figure out who you are! Consider using the --user\n"
343 "command line option, setting your USER environment variable,\n"
344 "or setting a default user with \"fossil user default USER\".\n"
345

Keyboard Shortcuts

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