[PATCH 7 of 8] configitems: register 'patch.fuzz' as first example for 'configint'

Pierre-Yves David pierre-yves.david at ens-lyon.org
Wed Jun 21 04:55:08 EDT 2017


# HG changeset patch
# User Pierre-Yves David <pierre-yves.david at octobus.net>
# Date 1497698230 -7200
#      Sat Jun 17 13:17:10 2017 +0200
# Node ID 71c55875e1d4342eb1165a81e45dd8ac42b546fa
# Parent  e04301d9657950913afc147026a67a50a40d3e75
# EXP-Topic config.register
# Available At https://www.mercurial-scm.org/repo/users/marmoute/mercurial/
#              hg pull https://www.mercurial-scm.org/repo/users/marmoute/mercurial/ -r 71c55875e1d4
configitems: register 'patch.fuzz' as first example for 'configint'

This exercise the default value handling in 'configint'.

diff --git a/mercurial/configitems.py b/mercurial/configitems.py
--- a/mercurial/configitems.py
+++ b/mercurial/configitems.py
@@ -36,6 +36,9 @@ def coreconfigitem(*args, **kwargs):
 
 # Registering actual config items
 
+coreconfigitem('patch', 'fuzz',
+    default=2,
+)
 coreconfigitem('ui', 'interactive',
     default=None,
 )
diff --git a/mercurial/patch.py b/mercurial/patch.py
--- a/mercurial/patch.py
+++ b/mercurial/patch.py
@@ -803,7 +803,7 @@ class patchfile(object):
         for x, s in enumerate(self.lines):
             self.hash.setdefault(s, []).append(x)
 
-        for fuzzlen in xrange(self.ui.configint("patch", "fuzz", 2) + 1):
+        for fuzzlen in xrange(self.ui.configint("patch", "fuzz") + 1):
             for toponly in [True, False]:
                 old, oldstart, new, newstart = h.fuzzit(fuzzlen, toponly)
                 oldstart = oldstart + self.offset + self.skew


More information about the Mercurial-devel mailing list