changeset 28162:3784d9eb7245

localrepo: use local variable for requirements assignment A future patch will refactor requirements determination into a standalone function. To prepare for this, refactor the requirements code to assign to a local variable instead of to self.requirements.
author Gregory Szorc <gregory.szorc@gmail.com>
date Sat, 13 Feb 2016 14:42:17 -0800
parents 3324345a498e
children 5d3495e394d5
files mercurial/localrepo.py
diffstat 1 files changed, 9 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/localrepo.py	Tue Feb 09 23:35:21 2016 +0000
+++ b/mercurial/localrepo.py	Sat Feb 13 14:42:17 2016 -0800
@@ -285,14 +285,14 @@
                 if not self.wvfs.exists():
                     self.wvfs.makedirs()
                 self.vfs.makedir(notindexed=True)
-                self.requirements.update(self._baserequirements(create))
+                requirements = set(self._baserequirements(create))
                 if self.ui.configbool('format', 'usestore', True):
                     self.vfs.mkdir("store")
-                    self.requirements.add("store")
+                    requirements.add("store")
                     if self.ui.configbool('format', 'usefncache', True):
-                        self.requirements.add("fncache")
+                        requirements.add("fncache")
                         if self.ui.configbool('format', 'dotencode', True):
-                            self.requirements.add('dotencode')
+                            requirements.add('dotencode')
                     # create an invalid changelog
                     self.vfs.append(
                         "00changelog.i",
@@ -300,11 +300,13 @@
                         ' dummy changelog to prevent using the old repo layout'
                     )
                 if scmutil.gdinitconfig(self.ui):
-                    self.requirements.add("generaldelta")
+                    requirements.add("generaldelta")
                 if self.ui.configbool('experimental', 'treemanifest', False):
-                    self.requirements.add("treemanifest")
+                    requirements.add("treemanifest")
                 if self.ui.configbool('experimental', 'manifestv2', False):
-                    self.requirements.add("manifestv2")
+                    requirements.add("manifestv2")
+
+                self.requirements = requirements
             else:
                 raise error.RepoError(_("repository %s not found") % path)
         elif create: