Mercurial > hg
comparison mercurial/localrepo.py @ 19928:d1ac3790e10a
localrepo: invoke only feature setup functions for enabled extensions
Before this patch, each feature setup functions for localrepository
class should examine whether corresponding extension is enabled or not
by themselves.
This patch invokes only feature setup functions defined in module of
enabled extensions, and it makes implementation of feature setup
functions easier and simpler.
author | FUJIWARA Katsunori <foozy@lares.dti.ne.jp> |
---|---|
date | Thu, 17 Oct 2013 21:45:17 +0900 |
parents | fc3fbca35085 |
children | 4b06b2a445a1 |
comparison
equal
deleted
inserted
replaced
19927:76c83107a724 | 19928:d1ac3790e10a |
---|---|
151 'dotencode')) | 151 'dotencode')) |
152 openerreqs = set(('revlogv1', 'generaldelta')) | 152 openerreqs = set(('revlogv1', 'generaldelta')) |
153 requirements = ['revlogv1'] | 153 requirements = ['revlogv1'] |
154 filtername = None | 154 filtername = None |
155 | 155 |
156 # a list of (ui, featureset) functions. | |
157 # only functions defined in module of enabled extensions are invoked | |
156 featuresetupfuncs = set() | 158 featuresetupfuncs = set() |
157 | 159 |
158 def _baserequirements(self, create): | 160 def _baserequirements(self, create): |
159 return self.requirements[:] | 161 return self.requirements[:] |
160 | 162 |
179 except IOError: | 181 except IOError: |
180 pass | 182 pass |
181 | 183 |
182 if self.featuresetupfuncs: | 184 if self.featuresetupfuncs: |
183 self.supported = set(self._basesupported) # use private copy | 185 self.supported = set(self._basesupported) # use private copy |
186 extmods = set(m.__name__ for n, m | |
187 in extensions.extensions(self.ui)) | |
184 for setupfunc in self.featuresetupfuncs: | 188 for setupfunc in self.featuresetupfuncs: |
185 setupfunc(self.ui, self.supported) | 189 if setupfunc.__module__ in extmods: |
190 setupfunc(self.ui, self.supported) | |
186 else: | 191 else: |
187 self.supported = self._basesupported | 192 self.supported = self._basesupported |
188 | 193 |
189 if not self.vfs.isdir(): | 194 if not self.vfs.isdir(): |
190 if create: | 195 if create: |