comparison hgsubversion/svnrepo.py @ 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 ae01b360320b
children 27c4daf50520
comparison
equal deleted inserted replaced
1535:4dad506e51cc 1536:ed7c66b8cea6
139 self.path = path 139 self.path = path
140 if peerapi == 1: 140 if peerapi == 1:
141 self._capabilities = set(['lookup', 'subversion']) 141 self._capabilities = set(['lookup', 'subversion'])
142 elif peerapi == 0: 142 elif peerapi == 0:
143 self.capabilities = set(['lookup', 'subversion']) 143 self.capabilities = set(['lookup', 'subversion'])
144 pws = self.ui.config('hgsubversion', 'password_stores', None)
145 if pws is not None:
146 # Split pws at comas and strip neighbouring whitespace (whitespace
147 # at the beginning and end of pws has already been removed by the
148 # config parser).
149 self.password_stores = re.split(r'\s*,\s*', pws)
150 else:
151 self.password_stores = None
152 144
153 if peerapi == 1: 145 if peerapi == 1:
154 def capabilities(self): 146 def capabilities(self):
155 return self._capabilities 147 return self._capabilities
156 elif peerapi == 0: 148 elif peerapi == 0:
157 def _capabilities(self): 149 def _capabilities(self):
158 return self.capabilities 150 return self.capabilities
151
152 @property
153 def password_stores(self):
154 pws = self.ui.config('hgsubversion', 'password_stores', None)
155 if pws is not None:
156 # Split pws at comas and strip neighbouring whitespace (whitespace
157 # at the beginning and end of pws has already been removed by the
158 # config parser).
159 return re.split(r'\s*,\s*', pws)
160 return None
159 161
160 @propertycache 162 @propertycache
161 def svnauth(self): 163 def svnauth(self):
162 # DO NOT default the user to hg's getuser(). If you provide 164 # DO NOT default the user to hg's getuser(). If you provide
163 # *any* default username to Subversion, it won't use any remembered 165 # *any* default username to Subversion, it won't use any remembered