##// 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 1595 d = t - tz
1596 1596 if d > 0x7fffffff:
1597 1597 d = 0x7fffffff
1598 elif d < -0x7fffffff:
1599 d = -0x7fffffff
1598 elif d < -0x80000000:
1599 d = -0x80000000
1600 1600 # Never use time.gmtime() and datetime.datetime.fromtimestamp()
1601 1601 # because they use the gmtime() system call which is buggy on Windows
1602 1602 # for negative values.
@@ -1720,7 +1720,7 b' def parsedate(date, formats=None, bias=N'
1720 1720 # time zone offset. values must fit in signed 32 bits for
1721 1721 # current 32-bit linux runtimes. timezones go from UTC-12
1722 1722 # to UTC+14
1723 if abs(when) > 0x7fffffff:
1723 if when < -0x80000000 or when > 0x7fffffff:
1724 1724 raise Abort(_('date exceeds 32 bits: %d') % when)
1725 1725 if offset < -50400 or offset > 43200:
1726 1726 raise Abort(_('impossible time zone offset: %d') % offset)
@@ -31,17 +31,17 b' commit date test'
31 31 abort: date exceeds 32 bits: -111111111111
32 32 [255]
33 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 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 37 $ hg log -T '{rev} {date|isodatesec}\n' -l2
38 3 1901-12-13 20:45:53 +0000
39 2 1901-12-13 20:45:53 +0000
40 $ hg commit -d '1901-12-13 20:45:52 +0000' -m commit-7
41 abort: date exceeds 32 bits: -2147483648
38 3 1901-12-13 20:45:52 +0000
39 2 1901-12-13 20:45:52 +0000
40 $ hg commit -d '1901-12-13 20:45:51 +0000' -m commit-7
41 abort: date exceeds 32 bits: -2147483649
42 42 [255]
43 $ hg commit -d '-2147483648 0' -m commit-7
44 abort: date exceeds 32 bits: -2147483648
43 $ hg commit -d '-2147483649 0' -m commit-7
44 abort: date exceeds 32 bits: -2147483649
45 45 [255]
46 46
47 47 commit added file that has been deleted
@@ -67,7 +67,7 b' commit added file that has been deleted'
67 67 dir/file
68 68 committing manifest
69 69 committing changelog
70 committed changeset 4:76aab26859d7
70 committed changeset 4:1957363f1ced
71 71
72 72 $ echo > dir.file
73 73 $ hg add
@@ -91,7 +91,7 b' commit added file that has been deleted'
91 91 dir/file
92 92 committing manifest
93 93 committing changelog
94 committed changeset 5:9a50557f1baf
94 committed changeset 5:a31d8f87544a
95 95 $ cd ..
96 96
97 97 $ hg commit -m commit-14 does-not-exist
@@ -115,7 +115,7 b' commit added file that has been deleted'
115 115 dir/file
116 116 committing manifest
117 117 committing changelog
118 committed changeset 6:4b4c75bf422d
118 committed changeset 6:32d054c9d085
119 119
120 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