# HG changeset patch # User Drew Gottlieb # Date 2015-04-22 19:06:44 # Node ID 1c40408770f7410ee2da2fea6e19e87be42bf38a # Parent cb144bfc61eaba782d95bb1abf54685ab8ec6c47 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. diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py --- a/mercurial/localrepo.py +++ b/mercurial/localrepo.py @@ -291,7 +291,8 @@ class localrepository(object): 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 @@ class localrepository(object): 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 @@ class localrepository(object): # 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: