Mercurial > hg-stable
comparison mercurial/ui.py @ 32982:6599b7372387
config: use the new '_unset' value for 'configdate'
This should let 'configdate' delegate all special processing of the default
config value to the main 'config' method.
The default value for date (None) is still enforced in this method if no other
default were passed.
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Sat, 17 Jun 2017 12:54:45 +0200 |
parents | 88b3a38d39e3 |
children | 36e16797df32 |
comparison
equal
deleted
inserted
replaced
32981:88b3a38d39e3 | 32982:6599b7372387 |
---|---|
647 return config.parselist(v) | 647 return config.parselist(v) |
648 elif v is None: | 648 elif v is None: |
649 return [] | 649 return [] |
650 return v | 650 return v |
651 | 651 |
652 def configdate(self, section, name, default=None, untrusted=False): | 652 def configdate(self, section, name, default=_unset, untrusted=False): |
653 """parse a configuration element as a tuple of ints | 653 """parse a configuration element as a tuple of ints |
654 | 654 |
655 >>> u = ui(); s = 'foo' | 655 >>> u = ui(); s = 'foo' |
656 >>> u.setconfig(s, 'date', '0 0') | 656 >>> u.setconfig(s, 'date', '0 0') |
657 >>> u.configdate(s, 'date') | 657 >>> u.configdate(s, 'date') |
658 (0, 0) | 658 (0, 0) |
659 """ | 659 """ |
660 if self.config(section, name, default, untrusted): | 660 if self.config(section, name, default, untrusted): |
661 return self.configwith(util.parsedate, section, name, default, | 661 return self.configwith(util.parsedate, section, name, default, |
662 'date', untrusted) | 662 'date', untrusted) |
663 if default is _unset: | |
664 return None | |
663 return default | 665 return default |
664 | 666 |
665 def hasconfig(self, section, name, untrusted=False): | 667 def hasconfig(self, section, name, untrusted=False): |
666 return self._data(untrusted).hasitem(section, name) | 668 return self._data(untrusted).hasitem(section, name) |
667 | 669 |