Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/ui.py @ 10243:cd3e5c47d663 stable
ui: just return it if it's already a bool
author | Dirkjan Ochtman <dirkjan@ochtman.nl> |
---|---|
date | Wed, 13 Jan 2010 11:53:55 +0100 |
parents | 500d09be7ace |
children | c4c0502be198 25e572394f5c |
comparison
equal
deleted
inserted
replaced
10242:ecd0a5c8bbe5 | 10243:cd3e5c47d663 |
---|---|
129 | 129 |
130 def configbool(self, section, name, default=False, untrusted=False): | 130 def configbool(self, section, name, default=False, untrusted=False): |
131 v = self.config(section, name, None, untrusted) | 131 v = self.config(section, name, None, untrusted) |
132 if v is None: | 132 if v is None: |
133 return default | 133 return default |
134 if isinstance(v, bool): | |
135 return v | |
134 if v.lower() not in _booleans: | 136 if v.lower() not in _booleans: |
135 raise error.ConfigError(_("%s.%s not a boolean ('%s')") | 137 raise error.ConfigError(_("%s.%s not a boolean ('%s')") |
136 % (section, name, v)) | 138 % (section, name, v)) |
137 return _booleans[v.lower()] | 139 return _booleans[v.lower()] |
138 | 140 |