localrepo: make _applyrequirements more specific
Localrepo's _applyrequirements function isn't very straightforward about what
it does. Its purpose is to both act as a setter for the requirements attribute,
and to apply appropriate requirements to the opener's configuration.
This change makes the function just focus on the latter responsibility. We
rename it as such, and make setting the requirements attribute the
responsibility of the caller.
--- a/mercurial/localrepo.py Tue Apr 21 17:16:10 2015 -0700
+++ b/mercurial/localrepo.py Wed Apr 22 12:06:44 2015 -0700
@@ -291,7 +291,8 @@
self.sopener = self.svfs
self.sjoin = self.store.join
self.vfs.createmode = self.store.createmode
- self._applyrequirements(requirements)
+ self.requirements = requirements
+ self._applyopenerreqs()
if create:
self._writerequirements()
@@ -334,9 +335,8 @@
caps.add('bundle2=' + urllib.quote(capsblob))
return caps
- def _applyrequirements(self, requirements):
- self.requirements = requirements
- self.svfs.options = dict((r, 1) for r in requirements
+ def _applyopenerreqs(self):
+ self.svfs.options = dict((r, 1) for r in self.requirements
if r in self.openerreqs)
chunkcachesize = self.ui.configint('format', 'chunkcachesize')
if chunkcachesize is not None:
@@ -1828,7 +1828,8 @@
# new format-related
# requirements from the streamed-in repository
requirements.update(self.requirements - self.supportedformats)
- self._applyrequirements(requirements)
+ self.requirements = requirements
+ self._applyopenerreqs()
self._writerequirements()
if rbranchmap: