comparison mercurial/util.py @ 6086:e85deb6dcf9d

better handle errors with date parsing (issue983) Windows cannot always handle a 1970-01-01 parameter to time.mktime().
author Dirkjan Ochtman <dirkjan@ochtman.nl>
date Wed, 13 Feb 2008 16:46:43 +0100
parents 3c3b126e5619
children 152b6c5c1574
comparison
equal deleted inserted replaced
6085:e1f11b8a1e9e 6086:e85deb6dcf9d
1592 defaults[part] = datestr(now, "%" + part[0], False) 1592 defaults[part] = datestr(now, "%" + part[0], False)
1593 1593
1594 for format in formats: 1594 for format in formats:
1595 try: 1595 try:
1596 when, offset = strdate(string, format, defaults) 1596 when, offset = strdate(string, format, defaults)
1597 except ValueError: 1597 except (ValueError, OverflowError):
1598 pass 1598 pass
1599 else: 1599 else:
1600 break 1600 break
1601 else: 1601 else:
1602 raise Abort(_('invalid date: %r ') % string) 1602 raise Abort(_('invalid date: %r ') % string)