[rfc] branch/merge/push/pull operations with remote location (sftp/ftp) that require password and GUI

Alexander Belchenko bialix at ukr.net
Sat Oct 28 11:17:20 BST 2006

John Arbash Meinel пишет:
> Alexander Belchenko wrote:
>> I hacking Olive (Bazaar GUI) a bit and wondering how to implement
>> password dialog for operations with remote locations that require
>> authentications.
>> Current bzr code seems to be intended to use password request only with
>> console UI. I'd like to understand how to implement custom password
>> dialog. This is probably should be done like for progress bar?
> For ssh, we have the problem that if we spawn a subprocess, we can't
> actually give it the password. This is because at least openssh connects
> directly to the terminal to ask the user (and I would assume others do
> too). This is a security measure, and also what allows you to do:
>   "ssh host command | local_processing"
> And still get a password prompt.
> However, I believe for paramiko (and since you are on win32, it is
> fairly likely), then you can do password prompting through
>   bzrlib.ui.ui_factory.get_password(prompt='%(user)s@%(host)s',
>     user=foo, host=bar)

Why not use always paramiko and no ssh?

> We use that for some of the http code, and if we aren't using it, we
> should be elsewhere.
> The prompt is intended to be a plain string with %(var)s values, and the
> parameters are passed in as **kwargs.
> It was hoped that this would provide enough flexibility in case the
> front-end wanted to have a bit of leeway in how it represented the
> request to users.
> So my suggestion would be to override bzrlib.ui.ui_factory with whatever
> GraphicalUIFactory that you have. This should also allow you to do
> progress bars (bzrlib.ui.ui_factory.nested_progress_bar(), etc).

Actually, Szilveszter (author of Olive) already implement Dialog to
enter password and it works good. He's not implement progress bar.

When I thinking about progress bar I think that for really long
operations (e.g. initial checkout of bzr.dev) it's worth to provide
CANCEL button on progress bar panel.
But what the best way to integrate CANCEL with bzrlib code?

I think that simple solution could be to raise some custom exception
when user clicks CANCEL (IIUC, this exception should be raised from
within method that invoked by bzrlib to update progress bar). And in
main GUI code that invoke long bzrlib operation just catch this error.

I'm slightly worrying about state of bzrlib after this termination. Is
it safe way or I need to use something different?


More information about the bazaar mailing list