Mercurial > hgsubversion
comparison svnwrap/svn_swig_wrapper.py @ 92:7486c6f6cccc
svnwrap: Fix handling of auth providers so cached credentials can work.
Also fixed things so that svn 1.6 should enable platform-specific auth providers.
| author | Augie Fackler <durin42@gmail.com> |
|---|---|
| date | Wed, 19 Nov 2008 09:41:09 -0600 |
| parents | edeec6829d80 |
| children | 0d3a2a7cefa3 |
comparison
equal
deleted
inserted
replaced
| 91:7d10165cf3d9 | 92:7486c6f6cccc |
|---|---|
| 55 | 55 |
| 56 def _create_auth_baton(pool): | 56 def _create_auth_baton(pool): |
| 57 """Create a Subversion authentication baton. """ | 57 """Create a Subversion authentication baton. """ |
| 58 # Give the client context baton a suite of authentication | 58 # Give the client context baton a suite of authentication |
| 59 # providers.h | 59 # providers.h |
| 60 providers = [ | 60 platform_specific = ['svn_auth_get_gnome_keyring_simple_provider', |
| 61 'svn_auth_get_gnome_keyring_ssl_client_cert_pw_provider', | |
| 62 'svn_auth_get_keychain_simple_provider', | |
| 63 'svn_auth_get_keychain_ssl_client_cert_pw_provider', | |
| 64 'svn_auth_get_kwallet_simple_provider', | |
| 65 'svn_auth_get_kwallet_ssl_client_cert_pw_provider', | |
| 66 'svn_auth_get_ssl_client_cert_file_provider', | |
| 67 'svn_auth_get_windows_simple_provider', | |
| 68 'svn_auth_get_windows_ssl_server_trust_provider', | |
| 69 ] | |
| 70 | |
| 71 providers = [] | |
| 72 | |
| 73 for p in platform_specific: | |
| 74 if hasattr(core, p): | |
| 75 try: | |
| 76 providers.append(getattr(core, p)()) | |
| 77 except RuntimeError: | |
| 78 pass | |
| 79 | |
| 80 providers += [ | |
| 61 client.get_simple_provider(), | 81 client.get_simple_provider(), |
| 62 client.get_username_provider(), | 82 client.get_username_provider(), |
| 63 client.get_ssl_client_cert_file_provider(), | 83 client.get_ssl_client_cert_file_provider(), |
| 64 client.get_ssl_client_cert_pw_file_provider(), | 84 client.get_ssl_client_cert_pw_file_provider(), |
| 65 client.get_ssl_server_trust_file_provider(), | 85 client.get_ssl_server_trust_file_provider(), |
| 86 client.get_simple_prompt_provider(user_pass_prompt, 2), | |
| 66 ] | 87 ] |
| 67 # Platform-dependant authentication methods | 88 |
| 68 if hasattr(client, 'get_windows_simple_provider'): #pragma: no cover | |
| 69 try: | |
| 70 providers.append(client.get_windows_simple_provider()) | |
| 71 except: | |
| 72 pass | |
| 73 if hasattr(client, 'get_keychain_simple_provider'): #pragma: no cover | |
| 74 try: | |
| 75 providers.append(client.get_keychain_simple_provider()) | |
| 76 except: | |
| 77 pass | |
| 78 providers.extend([client.get_simple_prompt_provider(user_pass_prompt, 2), | |
| 79 ]) | |
| 80 return core.svn_auth_open(providers, pool) | 89 return core.svn_auth_open(providers, pool) |
| 81 | 90 |
| 82 | 91 |
| 83 class Revision(object): | 92 class Revision(object): |
| 84 """Wrapper for a Subversion revision. | 93 """Wrapper for a Subversion revision. |
| 126 unified diffs runs the remote server out of open files. | 135 unified diffs runs the remote server out of open files. |
| 127 """ | 136 """ |
| 128 # while we're in here we'll recreate our pool | 137 # while we're in here we'll recreate our pool |
| 129 self.pool = core.Pool() | 138 self.pool = core.Pool() |
| 130 self.client_context = client.create_context() | 139 self.client_context = client.create_context() |
| 131 core.svn_auth_set_parameter(self.auth_baton, | |
| 132 core.SVN_AUTH_PARAM_DEFAULT_USERNAME, | |
| 133 self.uname) | |
| 134 | 140 |
| 135 self.client_context.auth_baton = self.auth_baton | 141 self.client_context.auth_baton = self.auth_baton |
| 136 self.client_context.config = svn_config | 142 self.client_context.config = svn_config |
| 137 callbacks = RaCallbacks() | 143 callbacks = RaCallbacks() |
| 138 callbacks.auth_baton = self.auth_baton | 144 callbacks.auth_baton = self.auth_baton |
