changeset 26906:e40af07e518e

scmutil: extract general delta config handling in a function General delta is currently controlled by a single option, we will introduce a new one in the next changeset. We extract the logic in a function while it is simple.
author Pierre-Yves David <pierre-yves.david@fb.com>
date Mon, 02 Nov 2015 16:52:34 +0000
parents 8aacac09e222
children dfab6edb98e3
files mercurial/localrepo.py mercurial/scmutil.py
diffstat 2 files changed, 9 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/localrepo.py	Tue Nov 10 19:52:30 2015 +0800
+++ b/mercurial/localrepo.py	Mon Nov 02 16:52:34 2015 +0000
@@ -258,8 +258,7 @@
                         '\0\0\0\2' # represents revlogv2
                         ' dummy changelog to prevent using the old repo layout'
                     )
-                # experimental config: format.generaldelta
-                if self.ui.configbool('format', 'generaldelta', False):
+                if scmutil.gdinitconfig(self.ui):
                     self.requirements.add("generaldelta")
                 if self.ui.configbool('experimental', 'treemanifest', False):
                     self.requirements.add("treemanifest")
--- a/mercurial/scmutil.py	Tue Nov 10 19:52:30 2015 +0800
+++ b/mercurial/scmutil.py	Mon Nov 02 16:52:34 2015 +0000
@@ -1170,3 +1170,11 @@
     subprocess."""
     return _locksub(repo, repo.currentwlock(), 'HG_WLOCK_LOCKER', cmd, *args,
                     **kwargs)
+
+def gdinitconfig(ui):
+    """helper function to know if a repo should be created as general delta
+
+    This currently depends on a single config option but this will get more
+    complicated soon."""
+    # experimental config: format.generaldelta
+    return ui.configbool('format', 'generaldelta', False)