##// END OF EJS Templates
date: fix boundary check of negative integer
Florent Gallaire -
r28864:b0811a9f default
parent child Browse files
Show More
@@ -1595,8 +1595,8 b" def datestr(date=None, format='%a %b %d "
1595 d = t - tz
1595 d = t - tz
1596 if d > 0x7fffffff:
1596 if d > 0x7fffffff:
1597 d = 0x7fffffff
1597 d = 0x7fffffff
1598 elif d < -0x7fffffff:
1598 elif d < -0x80000000:
1599 d = -0x7fffffff
1599 d = -0x80000000
1600 # Never use time.gmtime() and datetime.datetime.fromtimestamp()
1600 # Never use time.gmtime() and datetime.datetime.fromtimestamp()
1601 # because they use the gmtime() system call which is buggy on Windows
1601 # because they use the gmtime() system call which is buggy on Windows
1602 # for negative values.
1602 # for negative values.
@@ -1720,7 +1720,7 b' def parsedate(date, formats=None, bias=N'
1720 # time zone offset. values must fit in signed 32 bits for
1720 # time zone offset. values must fit in signed 32 bits for
1721 # current 32-bit linux runtimes. timezones go from UTC-12
1721 # current 32-bit linux runtimes. timezones go from UTC-12
1722 # to UTC+14
1722 # to UTC+14
1723 if abs(when) > 0x7fffffff:
1723 if when < -0x80000000 or when > 0x7fffffff:
1724 raise Abort(_('date exceeds 32 bits: %d') % when)
1724 raise Abort(_('date exceeds 32 bits: %d') % when)
1725 if offset < -50400 or offset > 43200:
1725 if offset < -50400 or offset > 43200:
1726 raise Abort(_('impossible time zone offset: %d') % offset)
1726 raise Abort(_('impossible time zone offset: %d') % offset)
@@ -31,17 +31,17 b' commit date test'
31 abort: date exceeds 32 bits: -111111111111
31 abort: date exceeds 32 bits: -111111111111
32 [255]
32 [255]
33 $ echo foo >> foo
33 $ echo foo >> foo
34 $ hg commit -d '1901-12-13 20:45:53 +0000' -m commit-7-2
34 $ hg commit -d '1901-12-13 20:45:52 +0000' -m commit-7-2
35 $ echo foo >> foo
35 $ echo foo >> foo
36 $ hg commit -d '-2147483647 0' -m commit-7-3
36 $ hg commit -d '-2147483648 0' -m commit-7-3
37 $ hg log -T '{rev} {date|isodatesec}\n' -l2
37 $ hg log -T '{rev} {date|isodatesec}\n' -l2
38 3 1901-12-13 20:45:53 +0000
38 3 1901-12-13 20:45:52 +0000
39 2 1901-12-13 20:45:53 +0000
39 2 1901-12-13 20:45:52 +0000
40 $ hg commit -d '1901-12-13 20:45:52 +0000' -m commit-7
40 $ hg commit -d '1901-12-13 20:45:51 +0000' -m commit-7
41 abort: date exceeds 32 bits: -2147483648
41 abort: date exceeds 32 bits: -2147483649
42 [255]
42 [255]
43 $ hg commit -d '-2147483648 0' -m commit-7
43 $ hg commit -d '-2147483649 0' -m commit-7
44 abort: date exceeds 32 bits: -2147483648
44 abort: date exceeds 32 bits: -2147483649
45 [255]
45 [255]
46
46
47 commit added file that has been deleted
47 commit added file that has been deleted
@@ -67,7 +67,7 b' commit added file that has been deleted'
67 dir/file
67 dir/file
68 committing manifest
68 committing manifest
69 committing changelog
69 committing changelog
70 committed changeset 4:76aab26859d7
70 committed changeset 4:1957363f1ced
71
71
72 $ echo > dir.file
72 $ echo > dir.file
73 $ hg add
73 $ hg add
@@ -91,7 +91,7 b' commit added file that has been deleted'
91 dir/file
91 dir/file
92 committing manifest
92 committing manifest
93 committing changelog
93 committing changelog
94 committed changeset 5:9a50557f1baf
94 committed changeset 5:a31d8f87544a
95 $ cd ..
95 $ cd ..
96
96
97 $ hg commit -m commit-14 does-not-exist
97 $ hg commit -m commit-14 does-not-exist
@@ -115,7 +115,7 b' commit added file that has been deleted'
115 dir/file
115 dir/file
116 committing manifest
116 committing manifest
117 committing changelog
117 committing changelog
118 committed changeset 6:4b4c75bf422d
118 committed changeset 6:32d054c9d085
119
119
120 An empty date was interpreted as epoch origin
120 An empty date was interpreted as epoch origin
121
121
General Comments 0
You need to be logged in to leave comments. Login now