Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/ui.py @ 27696:e70c97cc9243
config: add hasconfig method and supporting plumbing
We add the hasconfig method to make it possible to distinguish between a
config value that was never supplied and one that is empty.
author | Bryan O'Sullivan <bos@serpentine.com> |
---|---|
date | Thu, 07 Jan 2016 19:45:03 -0800 |
parents | 56c2caffde3d |
children | 89003c49315c 3b4537ba80e9 |
comparison
equal
deleted
inserted
replaced
27695:fb0cc863d172 | 27696:e70c97cc9243 |
---|---|
504 if isinstance(result, basestring): | 504 if isinstance(result, basestring): |
505 result = _configlist(result.lstrip(' ,\n')) | 505 result = _configlist(result.lstrip(' ,\n')) |
506 if result is None: | 506 if result is None: |
507 result = default or [] | 507 result = default or [] |
508 return result | 508 return result |
509 | |
510 def hasconfig(self, section, name, untrusted=False): | |
511 return self._data(untrusted).hasitem(section, name) | |
509 | 512 |
510 def has_section(self, section, untrusted=False): | 513 def has_section(self, section, untrusted=False): |
511 '''tell whether section exists in config.''' | 514 '''tell whether section exists in config.''' |
512 return section in self._data(untrusted) | 515 return section in self._data(untrusted) |
513 | 516 |