changeset 29668:09a5699cc3cb stable

convert: move svn config initializer out of the module level The svn_config_get_config config call was being called at the module level, but had the potential to throw permission denied errors if ~/.subversion/servers was not readable. This could happen in certain test environments where the user permissions were very particular. This prevented the remotenames extension from loading, since it imports convert's hg module, which imports convert's subversion module, which calls this. The config is only ever used from this one constructor, so let's just move it in to there.
author Durham Goode <durham@fb.com>
date Mon, 01 Aug 2016 17:38:01 -0700
parents 2fd3549c8a5f
children b8f9cdca8807
files hgext/convert/transport.py
diffstat 1 files changed, 4 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/convert/transport.py	Thu Aug 04 19:53:46 2016 +0800
+++ b/hgext/convert/transport.py	Mon Aug 01 17:38:01 2016 -0700
@@ -34,8 +34,7 @@
 # won't work worth a darn against those libraries anyway!
 svn.ra.initialize()
 
-svn_config = svn.core.svn_config_get_config(None)
-
+svn_config = None
 
 def _create_auth_baton(pool):
     """Create a Subversion authentication baton. """
@@ -88,6 +87,9 @@
                 svn.core.svn_auth_set_parameter(
                     ab, svn.core.SVN_AUTH_PARAM_DEFAULT_PASSWORD, self.password)
             self.client.auth_baton = ab
+            global svn_config
+            if svn_config is None:
+                svn_config = svn.core.svn_config_get_config(None)
             self.client.config = svn_config
             try:
                 self.ra = svn.client.open_ra_session(