Mercurial > public > mercurial-scm > hg
comparison mercurial/util.py @ 3807:e43b48f0f718
parsedate: allow '' for epoch
author | Matt Mackall <mpm@selenic.com> |
---|---|
date | Wed, 06 Dec 2006 13:13:27 -0600 |
parents | 92a3532a01d9 |
children | d6529582942a |
comparison
equal
deleted
inserted
replaced
3806:92a3532a01d9 | 3807:e43b48f0f718 |
---|---|
1064 | 1064 |
1065 def parsedate(string, formats=None): | 1065 def parsedate(string, formats=None): |
1066 """parse a localized time string and return a (unixtime, offset) tuple. | 1066 """parse a localized time string and return a (unixtime, offset) tuple. |
1067 The date may be a "unixtime offset" string or in one of the specified | 1067 The date may be a "unixtime offset" string or in one of the specified |
1068 formats.""" | 1068 formats.""" |
1069 if not string: | |
1070 return 0, 0 | |
1069 if not formats: | 1071 if not formats: |
1070 formats = defaultdateformats | 1072 formats = defaultdateformats |
1071 try: | 1073 try: |
1072 when, offset = map(int, string.split(' ')) | 1074 when, offset = map(int, string.split(' ')) |
1073 except ValueError: | 1075 except ValueError: |