Hi Daniel,

> svn_config_get_config() reads from disk.  You'd do that just once (and
> stash the result in the client context, if svn_cmdline_init() or someone
> else doesn't do that for you), and then ["config"] it.  (In the C level
> that's just an apr_hash_get().)
> 
> Have a look at what the svn* binaries do.
Ah, thanks for the pointers, I think I got it now. A closer looks hows
that ctx.config was even filled already, but a bit further down. I've
attached a patch to fix this, which now allows me to disable
gnome-keyring from ~/.subversion/config when running the example.

> If you don't find a better way (even after asking) I'll also be happy
> with a test that does a strstr() on the repr() of the objects.
It turned out that the type is just exported as
svn.core.svn_auth_provider_object_t, so the change is trivial. See the
other attached patch.

Gr.

Matthijs
Improve the testcase for the python binding for
svn_auth_get_platform_specific_client_providers.

This test was introduced in r1241530, but it only checked if a list was
returned. Now also the type of the elements of the list is checked.

* subversion/bindings/swig/python/tests/client.py
  (test_platform_providers): Improve testcase.

Patch by: Matthijs Kooijman <matth...@stdin.nl>

Index: subversion-trunk/subversion/bindings/swig/python/tests/client.py
===================================================================
--- subversion-trunk.orig/subversion/bindings/swig/python/tests/client.py	2012-02-07 20:13:48.666552472 +0100
+++ subversion-trunk/subversion/bindings/swig/python/tests/client.py	2012-02-07 20:35:39.329660618 +0100
@@ -378,6 +378,7 @@
     providers = core.svn_auth_get_platform_specific_client_providers(None, None)
     # Not much more we can test in this minimal environment.
     self.assert_(isinstance(providers, list))
+    self.assert_(all(map(lambda x: isinstance(x, core.svn_auth_provider_object_t), providers)))
 
   def testGnomeKeyring(self):
     # This tests setting the gnome-keyring unlock prompt function as an
Let the get-location-segments.py example pass a proper config to
svn_auth_get_platform_specific_client_providers.

This call was introduced in r1241530, but it did not properly pass a
configuration option.

* tools/examples/get-location-segments.py
  (main): Pass config to
    svn_auth_get_platform_specific_client_providers.

Index: subversion-trunk/tools/examples/get-location-segments.py
===================================================================
--- subversion-trunk.orig/tools/examples/get-location-segments.py	2012-02-07 20:13:48.714552733 +0100
+++ subversion-trunk/tools/examples/get-location-segments.py	2012-02-07 20:41:34.691594619 +0100
@@ -128,12 +128,11 @@
 
   core.svn_config_ensure(None)
   ctx = client.svn_client_create_context()
+  ctx.config = core.svn_config_get_config(None)
 
   # Make sure that these are at the start of the list, so passwords from
   # gnome-keyring / kwallet are checked before asking for new passwords.
-  # Note that we don't pass our config here, since we can't seem to access
-  # ctx.config.config (ctx.config is opaque).
-  providers = core.svn_auth_get_platform_specific_client_providers(None, None)
+  providers = core.svn_auth_get_platform_specific_client_providers(ctx.config['config'], None)
   providers.extend([
     client.get_simple_provider(),
     core.svn_auth_get_ssl_server_trust_file_provider(),
@@ -146,7 +145,6 @@
   ])
 
   ctx.auth_baton = core.svn_auth_open(providers)
-  ctx.config = core.svn_config_get_config(None)
 
   if hasattr(core, 'svn_auth_set_gnome_keyring_unlock_prompt_func'):
     core.svn_auth_set_gnome_keyring_unlock_prompt_func(ctx.auth_baton, prompt_func_gnome_keyring_prompt)

Attachment: signature.asc
Description: Digital signature

Reply via email to