[PATCH 1 of 2 V3 mainline] scmutil: extract general delta config handling in a function
Pierre-Yves David
pierre-yves.david at ens-lyon.org
Wed Nov 11 01:55:04 UTC 2015
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david at fb.com>
# Date 1446483154 0
# Mon Nov 02 16:52:34 2015 +0000
# Node ID a21c430969a1159c590394b4f77301e2675f191a
# Parent 8b2fbe3f59b1b969878691cb472369ad0067f165
# EXP-Topic generaldelta
# Available At http://hg.netv6.net/marmoute-wip/mercurial/
# hg pull http://hg.netv6.net/marmoute-wip/mercurial/ -r a21c430969a1
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.
diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
--- a/mercurial/localrepo.py
+++ b/mercurial/localrepo.py
@@ -256,12 +256,11 @@ class localrepository(object):
self.vfs.append(
"00changelog.i",
'\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")
if self.ui.configbool('experimental', 'manifestv2', False):
self.requirements.add("manifestv2")
diff --git a/mercurial/scmutil.py b/mercurial/scmutil.py
--- a/mercurial/scmutil.py
+++ b/mercurial/scmutil.py
@@ -1168,5 +1168,13 @@ def wlocksub(repo, cmd, *args, **kwargs)
This can only be called while the wlock is held. This takes all the
arguments that ui.system does, and returns the exit code of the
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)
More information about the Mercurial-devel
mailing list