Patchwork [1,of,6] localrepo: eliminate requirements class variable

login
register
mail settings
Submitter Drew Gottlieb
Date May 1, 2015, 11:19 p.m.
Message ID <07d39152e3f49c717296.1430522347@waste.org>
Download mbox | patch
Permalink /patch/8832/
State Accepted
Headers show

Comments

Drew Gottlieb - May 1, 2015, 11:19 p.m.
# HG changeset patch
# User Drew Gottlieb <drgott@google.com>
# Date 1429660530 25200
#      Tue Apr 21 16:55:30 2015 -0700
# Node ID 07d39152e3f49c717296ebbe0e543319404f1447
# Parent  e9edd53770fb77a9787a3e6592a3bf0a29c1bd80
localrepo: eliminate requirements class variable

Localrepo's requirements class variable was introduced in b090601a80d1 to make
requirements modifiable by extensions. A main access point, _baserequirements,
still exists, but this change undoes making the class variable to begin with.

Without this simplification, there is a class variable with a default value
that is only copied, but never directly used. This behavior is moved directly
into the _baserequirements function.
Matt Mackall - May 4, 2015, 5:36 p.m.
On Fri, 2015-05-01 at 18:19 -0500, Drew Gottlieb wrote:
> # HG changeset patch
> # User Drew Gottlieb <drgott@google.com>
> # Date 1429660530 25200
> #      Tue Apr 21 16:55:30 2015 -0700
> # Node ID 07d39152e3f49c717296ebbe0e543319404f1447
> # Parent  e9edd53770fb77a9787a3e6592a3bf0a29c1bd80
> localrepo: eliminate requirements class variable

I've queued this with the "(API)" flag added, thanks.

Patch

diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
--- a/mercurial/localrepo.py
+++ b/mercurial/localrepo.py
@@ -196,7 +196,6 @@ 
     _basesupported = supportedformats | set(('store', 'fncache', 'shared',
                                              'dotencode'))
     openerreqs = set(('revlogv1', 'generaldelta', 'manifestv2'))
-    requirements = ['revlogv1']
     filtername = None
 
     # a list of (ui, featureset) functions.
@@ -204,7 +203,7 @@ 
     featuresetupfuncs = set()
 
     def _baserequirements(self, create):
-        return self.requirements[:]
+        return ['revlogv1']
 
     def __init__(self, baseui, path=None, create=False):
         self.wvfs = scmutil.vfs(path, expandpath=True, realpath=True)