[MERGE] Prompt for user names if they are not in the configuration.
Vincent Ladeuil
v.ladeuil+lp at free.fr
Tue Mar 31 16:36:08 BST 2009
>>>>> "Jelmer" == Jelmer Vernooij <jelmer at samba.org> writes:
<snip/>
Jelmer> === modified file 'bzrlib/config.py'
Jelmer> --- bzrlib/config.py 2009-03-23 14:59:43 +0000
Jelmer> +++ bzrlib/config.py 2009-03-31 14:22:01 +0000
Jelmer> @@ -1152,6 +1152,17 @@
Jelmer> user = credentials['user']
Jelmer> else:
Jelmer> user = None
Jelmer> + # Prompt user if we couldn't find a username
Jelmer> + if user is None:
Jelmer> + if prompt is None:
Jelmer> + # Create a default prompt suitable for most cases
Jelmer> + prompt = scheme.upper() + ' %(host)s username'
Jelmer> + # Special handling for optional fields in the prompt
Jelmer> + if port is not None:
Jelmer> + prompt_host = '%s:%d' % (host, port)
Jelmer> + else:
Jelmer> + prompt_host = host
Jelmer> + user = ui.ui_factory.get_username(prompt, host=prompt_host)
Jelmer> return user
You can't do that here unconditionally or you'll break the actual
bzr policy of defaulting to getpass.getuser().
The best way is probably to add an optional argument to get_user
that only http will use.
Vincent
More information about the bazaar
mailing list