[MERGE] Prompt for user names if they are not in the configuration.
Jelmer Vernooij
jelmer at samba.org
Tue Mar 31 18:35:57 BST 2009
Hi Vincent,
On Tue, Mar 31, 2009 at 05:36:08PM +0200, Vincent Ladeuil wrote:
> >>>>> "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().
Thanks for the review.
Can we perhaps have get_username() default to getpass.getuser() ? I'm
thinking of a prompt like:
HTTP www.foo.com username [jelmer]:
Where just pressing <enter> will use "jelmer".
Where exactly does bzr default to getpass.getuser() atm? It seems
strange to assume that the user has the same username on a remote FTP
server as on the local machine.
Cheers,
Jelmer
--
More information about the bazaar
mailing list