Mercurial > hg
comparison mercurial/profiling.py @ 32978:41b081ac2145
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.
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Wed, 21 Jun 2017 10:46:18 +0200 |
parents | cb6436e051ca |
children | 5d8942dbe49e |
comparison
equal
deleted
inserted
replaced
32977:27ba0d8dc26c | 32978:41b081ac2145 |
---|---|
124 displayformat = statprof.DisplayFormats.Hotpath | 124 displayformat = statprof.DisplayFormats.Hotpath |
125 | 125 |
126 kwargs = {} | 126 kwargs = {} |
127 | 127 |
128 def fraction(s): | 128 def fraction(s): |
129 if isinstance(s, (float, int)): | |
130 return float(s) | |
129 if s.endswith('%'): | 131 if s.endswith('%'): |
130 v = float(s[:-1]) / 100 | 132 v = float(s[:-1]) / 100 |
131 else: | 133 else: |
132 v = float(s) | 134 v = float(s) |
133 if 0 <= v <= 1: | 135 if 0 <= v <= 1: |