comparison mercurial/util.py @ 13062:e1002cf9fe54 stable

parsedate: abort on negative dates (issue2513) catches "hg commit -d '-7654321 3600'" (example)
author Adrian Buehlmann <adrian@cadifra.com>
date Wed, 24 Nov 2010 19:31:43 +0100
parents 2649be11ab0b
children e98581d44f0b
comparison
equal deleted inserted replaced
13061:7e734ddad2e7 13062:e1002cf9fe54
1114 # time zone offset. values must fit in signed 32 bits for 1114 # time zone offset. values must fit in signed 32 bits for
1115 # current 32-bit linux runtimes. timezones go from UTC-12 1115 # current 32-bit linux runtimes. timezones go from UTC-12
1116 # to UTC+14 1116 # to UTC+14
1117 if abs(when) > 0x7fffffff: 1117 if abs(when) > 0x7fffffff:
1118 raise Abort(_('date exceeds 32 bits: %d') % when) 1118 raise Abort(_('date exceeds 32 bits: %d') % when)
1119 if when < 0:
1120 raise Abort(_('negative date value: %d') % when)
1119 if offset < -50400 or offset > 43200: 1121 if offset < -50400 or offset > 43200:
1120 raise Abort(_('impossible time zone offset: %d') % offset) 1122 raise Abort(_('impossible time zone offset: %d') % offset)
1121 return when, offset 1123 return when, offset
1122 1124
1123 def matchdate(date): 1125 def matchdate(date):