# HG changeset patch # User Bryan O'Sullivan # Date 1486964695 28800 # Node ID 8fa3ab6221b99562b00f9a6a05518ce58746442b # Parent 120682fce099797e8f15cf8b0852d503c802e3c0 ui: rewrite configint in terms of configwith diff -r 120682fce099 -r 8fa3ab6221b9 mercurial/ui.py --- 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 diff -r 120682fce099 -r 8fa3ab6221b9 tests/test-convert-git.t --- a/tests/test-convert-git.t Sun Feb 12 21:40:46 2017 -0800 +++ b/tests/test-convert-git.t Sun Feb 12 21:44:55 2017 -0800 @@ -330,7 +330,7 @@ input validation $ hg convert --config convert.git.similarity=foo --datesort git-repo2 fullrepo - abort: convert.git.similarity is not an integer ('foo') + abort: convert.git.similarity is not a valid integer ('foo') [255] $ hg convert --config convert.git.similarity=-1 --datesort git-repo2 fullrepo abort: similarity must be between 0 and 100