Patchwork [1,of,2,V2,mainline] scmutil: extract general delta config handling in a function

mail settings
Submitter Pierre-Yves David
Date Nov. 8, 2015, 5 p.m.
Message ID <>
Download mbox | patch
Permalink /patch/11328/
State Superseded
Commit e40af07e518ed39ec4c663279369114b7c346158
Headers show


Pierre-Yves David - Nov. 8, 2015, 5 p.m.
# HG changeset patch
# User Pierre-Yves David <>
# Date 1446483154 0
#      Mon Nov 02 16:52:34 2015 +0000
# Node ID 69c64edb25dd96a23564db5b23b8b432b343ec88
# Parent  9850e1f19c056631f30cff7ed1667aebc7b468ae
# EXP-Topic generaldelta
# Available At
#              hg pull -r 69c64edb25dd
scmutil: extract general delta config handling in a function

This is currently a single boolean, but we want to add a "accept" value that
will trigger general delta format without being aggressive about re-computation
of delta for incoming bundle.

We extract the logic in a function while it is simple.


diff --git a/mercurial/ b/mercurial/
--- a/mercurial/
+++ b/mercurial/
@@ -256,12 +256,11 @@  class localrepository(object):
                         '\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.gdconfig(self.ui):
                 if self.ui.configbool('experimental', 'treemanifest', False):
                 if self.ui.configbool('experimental', 'manifestv2', False):
diff --git a/mercurial/ b/mercurial/
--- a/mercurial/
+++ b/mercurial/
@@ -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
     return _locksub(repo, repo.currentwlock(), 'HG_WLOCK_LOCKER', cmd, *args,
+def gdconfig(ui):
+    """helper function to retrieve general delta setting
+    The need for such function is triggered by a soon to come third possible
+    value to the config option."""
+    # experimental config: format.generaldelta
+    return ui.configbool('format', 'generaldelta', False)