changeset 1536:ed7c66b8cea6

svnrepo: move password_stores config to a property The config registrar doesn't load extension config values until after a repo is created, meaning you can't access non-core config items in a repository constructor.
author Augie Fackler <raf@durin42.com>
date Wed, 25 Oct 2017 22:11:15 -0400
parents 4dad506e51cc
children 27c4daf50520
files hgsubversion/svnrepo.py
diffstat 1 files changed, 10 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/hgsubversion/svnrepo.py
+++ b/hgsubversion/svnrepo.py
@@ -141,14 +141,6 @@ class svnremoterepo(peerrepository):
             self._capabilities = set(['lookup', 'subversion'])
         elif peerapi == 0:
             self.capabilities = set(['lookup', 'subversion'])
-        pws = self.ui.config('hgsubversion', 'password_stores', None)
-        if pws is not None:
-            # Split pws at comas and strip neighbouring whitespace (whitespace
-            # at the beginning and end of pws has already been removed by the
-            # config parser).
-            self.password_stores = re.split(r'\s*,\s*', pws)
-        else:
-            self.password_stores = None
 
     if peerapi == 1:
         def capabilities(self):
@@ -157,6 +149,16 @@ class svnremoterepo(peerrepository):
         def _capabilities(self):
             return self.capabilities
 
+    @property
+    def password_stores(self):
+        pws = self.ui.config('hgsubversion', 'password_stores', None)
+        if pws is not None:
+            # Split pws at comas and strip neighbouring whitespace (whitespace
+            # at the beginning and end of pws has already been removed by the
+            # config parser).
+            return re.split(r'\s*,\s*', pws)
+        return None
+
     @propertycache
     def svnauth(self):
         # DO NOT default the user to hg's getuser(). If you provide