Mercurial > hg
comparison mercurial/ui.py @ 32449:0ed730f3301c
ui: fix ui.configdate for invalid dates
a7dce526c462 introduced util._parsedate with the aim to be used in
ui.configdate but ui.configdate was using util.parsedate instead. It have the
impact of raising an AbortError in case of an invalid date instead of a
ConfigError exception. Fix ui.configdate to use the right function and add a
test for invalid dates.
Thanks to Yuya for the catch!
author | Boris Feld <boris.feld@octobus.net> |
---|---|
date | Tue, 23 May 2017 15:44:50 +0200 |
parents | 420e93b0d9dc |
children | bb18728ea617 |
comparison
equal
deleted
inserted
replaced
32448:91a2ec8e7fa0 | 32449:0ed730f3301c |
---|---|
605 >>> u.setconfig(s, 'date', '0 0') | 605 >>> u.setconfig(s, 'date', '0 0') |
606 >>> u.configdate(s, 'date') | 606 >>> u.configdate(s, 'date') |
607 (0, 0) | 607 (0, 0) |
608 """ | 608 """ |
609 if self.config(section, name, default, untrusted): | 609 if self.config(section, name, default, untrusted): |
610 return self.configwith(util.parsedate, section, name, default, | 610 return self.configwith(util.rawparsedate, section, name, default, |
611 'date', untrusted) | 611 'date', untrusted) |
612 return default | 612 return default |
613 | 613 |
614 def hasconfig(self, section, name, untrusted=False): | 614 def hasconfig(self, section, name, untrusted=False): |
615 return self._data(untrusted).hasitem(section, name) | 615 return self._data(untrusted).hasitem(section, name) |