changeset 24914:cb144bfc61ea

localrepo: make requirements always be a set in localrepo.__init__ The init function used to create a local list, and then convert it to a set before assigning it as a data attribute. This change simplifies the function by having it always be a set, requiring no conversion.
author Drew Gottlieb <drgott@google.com>
date Tue, 21 Apr 2015 17:16:10 -0700
parents e3a928bd1cd4
children 1c40408770f7
files mercurial/localrepo.py
diffstat 1 files changed, 7 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/localrepo.py	Tue Apr 21 16:55:30 2015 -0700
+++ b/mercurial/localrepo.py	Tue Apr 21 17:16:10 2015 -0700
@@ -242,14 +242,14 @@
                 if not self.wvfs.exists():
                     self.wvfs.makedirs()
                 self.vfs.makedir(notindexed=True)
-                requirements = self._baserequirements(create)
+                requirements = set(self._baserequirements(create))
                 if self.ui.configbool('format', 'usestore', True):
                     self.vfs.mkdir("store")
-                    requirements.append("store")
+                    requirements.add("store")
                     if self.ui.configbool('format', 'usefncache', True):
-                        requirements.append("fncache")
+                        requirements.add("fncache")
                         if self.ui.configbool('format', 'dotencode', True):
-                            requirements.append('dotencode')
+                            requirements.add('dotencode')
                     # create an invalid changelog
                     self.vfs.append(
                         "00changelog.i",
@@ -257,10 +257,9 @@
                         ' dummy changelog to prevent using the old repo layout'
                     )
                 if self.ui.configbool('format', 'generaldelta', False):
-                    requirements.append("generaldelta")
+                    requirements.add("generaldelta")
                 if self.ui.configbool('experimental', 'manifestv2', False):
-                    requirements.append("manifestv2")
-                requirements = set(requirements)
+                    requirements.add("manifestv2")
             else:
                 raise error.RepoError(_("repository %s not found") % path)
         elif create:
@@ -1828,7 +1827,7 @@
             # new requirements = old non-format requirements +
             #                    new format-related
             # requirements from the streamed-in repository
-            requirements.update(set(self.requirements) - self.supportedformats)
+            requirements.update(self.requirements - self.supportedformats)
             self._applyrequirements(requirements)
             self._writerequirements()