[PATCH] profiling: cope with configwith default value handling changes

Pierre-Yves David pierre-yves.david at ens-lyon.org
Wed Jun 21 08:52:31 UTC 2017


# HG changeset patch
# User Pierre-Yves David <pierre-yves.david at octobus.net>
# Date 1498034778 -7200
#      Wed Jun 21 10:46:18 2017 +0200
# Node ID cf8da7517159c14b11c326830d4162c76fbe431d
# Parent  6ff6eb33f3537af9ce1fcf0444dc1329986db5db
# EXP-Topic config.fix
# Available At https://www.mercurial-scm.org/repo/users/marmoute/mercurial/
#              hg pull https://www.mercurial-scm.org/repo/users/marmoute/mercurial/ -r cf8da7517159
profiling: cope with configwith default value handling changes

Changeset 6ff6eb33f353 change 'configwith' behavior so that the default value is
run through the conversion function. In parallel a new user of 'configwith' got
introduced unaware of this coming behavior change. This broke profiling.

We resolve the situation by having the new conversion function cope with a
default value already using the right type.

diff --git a/mercurial/profiling.py b/mercurial/profiling.py
--- a/mercurial/profiling.py
+++ b/mercurial/profiling.py
@@ -126,6 +126,8 @@ def statprofile(ui, fp):
         kwargs = {}
 
         def fraction(s):
+            if isinstance(s, (float, int)):
+                return float(s)
             if s.endswith('%'):
                 v = float(s[:-1]) / 100
             else:


More information about the Mercurial-devel mailing list