comparison mercurial/util.py @ 3808:92a3532a01d9

parsedate: use Abort rather than ValueError
author Matt Mackall <mpm@selenic.com>
date Wed, 06 Dec 2006 13:13:26 -0600
parents 1427949b8f80
children e43b48f0f718
comparison
equal deleted inserted replaced
3807:299d6cce6c0b 3808:92a3532a01d9
1077 except ValueError: 1077 except ValueError:
1078 pass 1078 pass
1079 else: 1079 else:
1080 break 1080 break
1081 else: 1081 else:
1082 raise ValueError(_('invalid date: %r ' 1082 raise Abort(_('invalid date: %r ') % string)
1083 'see hg(1) manual page for details')
1084 % string)
1085 # validate explicit (probably user-specified) date and 1083 # validate explicit (probably user-specified) date and
1086 # time zone offset. values must fit in signed 32 bits for 1084 # time zone offset. values must fit in signed 32 bits for
1087 # current 32-bit linux runtimes. timezones go from UTC-12 1085 # current 32-bit linux runtimes. timezones go from UTC-12
1088 # to UTC+14 1086 # to UTC+14
1089 if abs(when) > 0x7fffffff: 1087 if abs(when) > 0x7fffffff:
1090 raise ValueError(_('date exceeds 32 bits: %d') % when) 1088 raise Abort(_('date exceeds 32 bits: %d') % when)
1091 if offset < -50400 or offset > 43200: 1089 if offset < -50400 or offset > 43200:
1092 raise ValueError(_('impossible time zone offset: %d') % offset) 1090 raise Abort(_('impossible time zone offset: %d') % offset)
1093 return when, offset 1091 return when, offset
1094 1092
1095 def shortuser(user): 1093 def shortuser(user):
1096 """Return a short representation of a user name or email address.""" 1094 """Return a short representation of a user name or email address."""
1097 f = user.find('@') 1095 f = user.find('@')