Patchwork profiling: cope with configwith default value handling changes

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

Comments

Pierre-Yves David - June 21, 2017, 8:52 a.m.
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david@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.
Yuya Nishihara - June 21, 2017, 3:55 p.m.
On Wed, 21 Jun 2017 10:52:31 +0200, Pierre-Yves David wrote:
> # HG changeset patch
> # User Pierre-Yves David <pierre-yves.david@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

Queued, thanks.

Patch

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: