Mercurial > public > mercurial-scm > hg
diff mercurial/ui.py @ 30927:8fa3ab6221b9
ui: rewrite configint in terms of configwith
author | Bryan O'Sullivan <bryano@fb.com> |
---|---|
date | Sun, 12 Feb 2017 21:44:55 -0800 |
parents | 120682fce099 |
children | f61c5680a862 |
line wrap: on
line diff
--- a/mercurial/ui.py Sun Feb 12 21:40:46 2017 -0800 +++ b/mercurial/ui.py Sun Feb 12 21:44:55 2017 -0800 @@ -453,17 +453,11 @@ >>> u.configint(s, 'invalid') Traceback (most recent call last): ... - ConfigError: foo.invalid is not an integer ('somevalue') + ConfigError: foo.invalid is not a valid integer ('somevalue') """ - v = self.config(section, name, None, untrusted) - if v is None: - return default - try: - return int(v) - except ValueError: - raise error.ConfigError(_("%s.%s is not an integer ('%s')") - % (section, name, v)) + return self.configwith(int, section, name, default, 'integer', + untrusted) def configbytes(self, section, name, default=0, untrusted=False): """parse a configuration element as a quantity in bytes