##// END OF EJS Templates
parsedate: use Abort rather than ValueError
Matt Mackall -
r3806:92a3532a default
parent child Browse files
Show More
@@ -1079,17 +1079,15 b' def parsedate(string, formats=None):'
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):
@@ -3,7 +3,7 b' changeset 3:107ce1ee2b43 backs out chang'
3 merging with changeset 2:e6c3abc120e7
3 merging with changeset 2:e6c3abc120e7
4 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
4 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
5 (branch merge, don't forget to commit)
5 (branch merge, don't forget to commit)
6 abort: invalid date: 'should fail' see hg(1) manual page for details
6 abort: invalid date: 'should fail'
7 transaction abort!
7 transaction abort!
8 rollback completed
8 rollback completed
9 abort: date exceeds 32 bits: 100000000000000000
9 abort: date exceeds 32 bits: 100000000000000000
General Comments 0
You need to be logged in to leave comments. Login now