sparse-revlog: disable sparse-revlog if config disable general-delta
authorBoris Feld <boris.feld@octobus.net>
Mon, 12 Nov 2018 01:42:03 +0100
changeset 53650 a714eee1ac28e38be0252355f5323bbb28f09cfb
parent 53649 597fe8d811049f5c4a4f34e88f2d23d8f7703daf
child 53651 0d62c3149fb9943a7c2518e3f47ea0161d37b993
push id1079
push usergszorc@mozilla.com
push dateMon, 10 Dec 2018 19:44:59 +0000
sparse-revlog: disable sparse-revlog if config disable general-delta Sparse-revlog requires general-delta in order to work. If general-delta is explicitly disabled through configuration, we should honor that and also disabled sparse-revlog. This change will be more relevant when sparse-revlog is enabled by default. Differential Revision: https://phab.mercurial-scm.org/D5311
mercurial/localrepo.py
mercurial/scmutil.py
--- a/mercurial/localrepo.py
+++ b/mercurial/localrepo.py
@@ -2901,21 +2901,21 @@ def newreporequirements(ui, createopts):
                                  'compression engines'))
 
     # zlib is the historical default and doesn't need an explicit requirement.
     if compengine != 'zlib':
         requirements.add('exp-compression-%s' % compengine)
 
     if scmutil.gdinitconfig(ui):
         requirements.add('generaldelta')
+        # experimental config: format.sparse-revlog
+        if ui.configbool('format', 'sparse-revlog'):
+            requirements.add(SPARSEREVLOG_REQUIREMENT)
     if ui.configbool('experimental', 'treemanifest'):
         requirements.add('treemanifest')
-    # experimental config: format.sparse-revlog
-    if ui.configbool('format', 'sparse-revlog'):
-        requirements.add(SPARSEREVLOG_REQUIREMENT)
 
     revlogv2 = ui.config('experimental', 'revlogv2')
     if revlogv2 == 'enable-unstable-format-and-corrupt-my-data':
         requirements.remove('revlogv1')
         # generaldelta is implied by revlogv2.
         requirements.discard('generaldelta')
         requirements.add(REVLOGV2_REQUIREMENT)
     # experimental config: format.internal-phase
--- a/mercurial/scmutil.py
+++ b/mercurial/scmutil.py
@@ -1445,18 +1445,17 @@ class progress(object):
         self.ui.progress(self.topic, self.pos, item, self.unit,
                          self.total)
 
 def gdinitconfig(ui):
     """helper function to know if a repo should be created as general delta
     """
     # experimental config: format.generaldelta
     return (ui.configbool('format', 'generaldelta')
-            or ui.configbool('format', 'usegeneraldelta')
-            or ui.configbool('format', 'sparse-revlog'))
+            or ui.configbool('format', 'usegeneraldelta'))
 
 def gddeltaconfig(ui):
     """helper function to know if incoming delta should be optimised
     """
     # experimental config: format.generaldelta
     return ui.configbool('format', 'generaldelta')
 
 class simplekeyvaluefile(object):