comparison mercurial/util.py @ 31413:7409eb69731f

util: make strdate's defaults default value a dict It was specified to be an empty list in c6adf2be6069 in 2007. It was correct at the time. But when the function was refactored in 91bc001a592f (2010), it started expecting a dict. I guess this code path is untested? Thanks to Yuya for spotting this.
author Gregory Szorc <gregory.szorc@gmail.com>
date Tue, 14 Mar 2017 08:51:35 -0700
parents 8b6927eb7efd
children 807387581d89
comparison
equal deleted inserted replaced
31412:10c17f8bfcf3 31413:7409eb69731f
1828 return None, s 1828 return None, s
1829 1829
1830 def strdate(string, format, defaults=None): 1830 def strdate(string, format, defaults=None):
1831 """parse a localized time string and return a (unixtime, offset) tuple. 1831 """parse a localized time string and return a (unixtime, offset) tuple.
1832 if the string cannot be parsed, ValueError is raised.""" 1832 if the string cannot be parsed, ValueError is raised."""
1833 defaults = defaults or [] 1833 defaults = defaults or {}
1834 1834
1835 # NOTE: unixtime = localunixtime + offset 1835 # NOTE: unixtime = localunixtime + offset
1836 offset, date = parsetimezone(string) 1836 offset, date = parsetimezone(string)
1837 1837
1838 # add missing elements from defaults 1838 # add missing elements from defaults