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

login
register
mail settings
Submitter Pierre-Yves David
Date June 21, 2017, 8:55 a.m.
Message ID <71c55875e1d4342eb116.1498035308@nodosa.octopoid.net>
Download mbox | patch
Permalink /patch/21591/
State Accepted
Headers show

Comments

Pierre-Yves David - June 21, 2017, 8:55 a.m.
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david@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'.

Patch

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