Patchwork [10,of,10] localrepo: move applyopenerreqs to baselocalrepository

login
register
mail settings
Submitter Jun Wu
Date Feb. 10, 2017, 1:46 a.m.
Message ID <90cfe2f9473ab2330059.1486691184@localhost.localdomain>
Download mbox | patch
Permalink /patch/18383/
State Deferred
Headers show

Comments

Jun Wu - Feb. 10, 2017, 1:46 a.m.
# HG changeset patch
# User Jun Wu <quark@fb.com>
# Date 1486689613 28800
#      Thu Feb 09 17:20:13 2017 -0800
# Node ID 90cfe2f9473ab23300591f5904ba51c98cddca16
# Parent  2c2051dfbf9079a294cded41ada42b67dd3c37f5
# Available At https://bitbucket.org/quark-zju/hg-draft
#              hg pull https://bitbucket.org/quark-zju/hg-draft -r 90cfe2f9473a
localrepo: move applyopenerreqs to baselocalrepository

See previous patches for why.

Patch

diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
--- a/mercurial/localrepo.py
+++ b/mercurial/localrepo.py
@@ -252,4 +252,5 @@  class baselocalrepository(object):
     _basesupported = supportedformats | set(('store', 'fncache', 'shared',
                                              'dotencode'))
+    openerreqs = set(('revlogv1', 'generaldelta', 'treemanifest', 'manifestv2'))
 
     def __init__(self, baseui, path, create=False):
@@ -293,4 +294,30 @@  class baselocalrepository(object):
         self.sjoin = self.store.join
         self.vfs.createmode = self.store.createmode
+        self._applyopenerreqs()
+
+    def _applyopenerreqs(self):
+        self.svfs.options = dict((r, 1) for r in self.requirements
+                                           if r in self.openerreqs)
+        # experimental config: format.chunkcachesize
+        chunkcachesize = self.ui.configint('format', 'chunkcachesize')
+        if chunkcachesize is not None:
+            self.svfs.options['chunkcachesize'] = chunkcachesize
+        # experimental config: format.maxchainlen
+        maxchainlen = self.ui.configint('format', 'maxchainlen')
+        if maxchainlen is not None:
+            self.svfs.options['maxchainlen'] = maxchainlen
+        # experimental config: format.manifestcachesize
+        manifestcachesize = self.ui.configint('format', 'manifestcachesize')
+        if manifestcachesize is not None:
+            self.svfs.options['manifestcachesize'] = manifestcachesize
+        # experimental config: format.aggressivemergedeltas
+        aggressivemergedeltas = self.ui.configbool('format',
+            'aggressivemergedeltas', False)
+        self.svfs.options['aggressivemergedeltas'] = aggressivemergedeltas
+        self.svfs.options['lazydeltabase'] = not scmutil.gddeltaconfig(self.ui)
+
+        for r in self.requirements:
+            if r.startswith('exp-compression-'):
+                self.svfs.options['compengine'] = r[len('exp-compression-'):]
 
     def _loadextensions(self):
@@ -324,5 +351,4 @@  class baselocalrepository(object):
 class localrepository(baselocalrepository):
 
-    openerreqs = set(('revlogv1', 'generaldelta', 'treemanifest', 'manifestv2'))
     filtername = None
 
@@ -341,5 +367,4 @@  class localrepository(baselocalrepositor
                                                 realfs=False)
 
-        self._applyopenerreqs()
         if create:
             self._writerequirements()
@@ -437,29 +462,4 @@  class localrepository(baselocalrepositor
         return caps
 
-    def _applyopenerreqs(self):
-        self.svfs.options = dict((r, 1) for r in self.requirements
-                                           if r in self.openerreqs)
-        # experimental config: format.chunkcachesize
-        chunkcachesize = self.ui.configint('format', 'chunkcachesize')
-        if chunkcachesize is not None:
-            self.svfs.options['chunkcachesize'] = chunkcachesize
-        # experimental config: format.maxchainlen
-        maxchainlen = self.ui.configint('format', 'maxchainlen')
-        if maxchainlen is not None:
-            self.svfs.options['maxchainlen'] = maxchainlen
-        # experimental config: format.manifestcachesize
-        manifestcachesize = self.ui.configint('format', 'manifestcachesize')
-        if manifestcachesize is not None:
-            self.svfs.options['manifestcachesize'] = manifestcachesize
-        # experimental config: format.aggressivemergedeltas
-        aggressivemergedeltas = self.ui.configbool('format',
-            'aggressivemergedeltas', False)
-        self.svfs.options['aggressivemergedeltas'] = aggressivemergedeltas
-        self.svfs.options['lazydeltabase'] = not scmutil.gddeltaconfig(self.ui)
-
-        for r in self.requirements:
-            if r.startswith('exp-compression-'):
-                self.svfs.options['compengine'] = r[len('exp-compression-'):]
-
     def _writerequirements(self):
         scmutil.writerequires(self.vfs, self.requirements)