tags:

views:

153

answers:

2

I'm new to Python and PySVN in general, and I'm trying to export my SVN repository using pysvn. Here's my code:

#set up svn login data
def svn_credentials (realm, username, may_save):
return True, svn_login_name, svn_login_password, False

#establish connection
svn_client = pysvn.Client ()
svn_client.callback_get_login = svn_credentials

#export data
svn_client.export('server-path-goes-here', 'client-path-goes-here', force=True)

Which works fine, but if the password is wrong or the user name is unknown, this code just sits. I believe it's being presented with a user login prompt on the SVN side, but I'm at a loss as to how to check whats happening with callback_get_login. Any help would be greatly appreciated.

A: 

Are you using SSH? In which case, perhaps it's SSH presenting the login prompt and PySVN can't do much about that. You could try messing with the SSH configuration on the client side to disable keyboard interactive prompts:

http://www.ssh.com/support/documentation/online/ssh/adminguide/32/Configuring_the_Server_and_Client.html

ars
It's actually calling out to Unfuddle over https, so I'm kind of limited in what I can do server side (although you have prompted me into wondering if Unfuddle's API might be worth looking at... hmm)
Geoff
A: 

If the credentials are wrong pysvn will call the callback, if the credentials are still wrong it will call it again, and again, and it will just keep doing that until the credentials are correct.

For an automated script you are probably better off not setting the callback and instead setting the default username and password by calling set_default_username and set_default_password on the pysvn.Client instance.

With that setup incorrect credentials will result in pysvn propagating an exception suggesting that you set the callback which you can catch and turn into a meaningful error message.

tolomea