Show More
@@ -1585,9 +1585,6 b" def datestr(date=None, format='%a %b %d " | |||
|
1585 | 1585 | number of seconds away from UTC. if timezone is false, do not |
|
1586 | 1586 | append time zone to string.""" |
|
1587 | 1587 | t, tz = date or makedate() |
|
1588 | if t < 0: | |
|
1589 | t = 0 # time.gmtime(lt) fails on Windows for lt < -43200 | |
|
1590 | tz = 0 | |
|
1591 | 1588 | if "%1" in format or "%2" in format or "%z" in format: |
|
1592 | 1589 | sign = (tz > 0) and "-" or "+" |
|
1593 | 1590 | minutes = abs(tz) // 60 |
@@ -1595,12 +1592,16 b" def datestr(date=None, format='%a %b %d " | |||
|
1595 | 1592 | format = format.replace("%z", "%1%2") |
|
1596 | 1593 | format = format.replace("%1", "%c%02d" % (sign, q)) |
|
1597 | 1594 | format = format.replace("%2", "%02d" % r) |
|
1598 | try: | |
|
1599 | t = time.gmtime(float(t) - tz) | |
|
1600 | except ValueError: | |
|
1601 | # time was out of range | |
|
1602 | t = time.gmtime(sys.maxint) | |
|
1603 | s = time.strftime(format, t) | |
|
1595 | d = t - tz | |
|
1596 | if d > 0x7fffffff: | |
|
1597 | d = 0x7fffffff | |
|
1598 | elif d < -0x7fffffff: | |
|
1599 | d = -0x7fffffff | |
|
1600 | # Never use time.gmtime() and datetime.datetime.fromtimestamp() | |
|
1601 | # because they use the gmtime() system call which is buggy on Windows | |
|
1602 | # for negative values. | |
|
1603 | t = datetime.datetime(1970, 1, 1) + datetime.timedelta(seconds=d) | |
|
1604 | s = t.strftime(format) | |
|
1604 | 1605 | return s |
|
1605 | 1606 | |
|
1606 | 1607 | def shortdate(date=None): |
@@ -1721,8 +1722,6 b' def parsedate(date, formats=None, bias=N' | |||
|
1721 | 1722 | # to UTC+14 |
|
1722 | 1723 | if abs(when) > 0x7fffffff: |
|
1723 | 1724 | raise Abort(_('date exceeds 32 bits: %d') % when) |
|
1724 | if when < 0: | |
|
1725 | raise Abort(_('negative date value: %d') % when) | |
|
1726 | 1725 | if offset < -50400 or offset > 43200: |
|
1727 | 1726 | raise Abort(_('impossible time zone offset: %d') % offset) |
|
1728 | 1727 | return when, offset |
@@ -27,8 +27,21 b' commit date test' | |||
|
27 | 27 | $ hg commit -d '111111111111 0' -m commit-7 |
|
28 | 28 | abort: date exceeds 32 bits: 111111111111 |
|
29 | 29 | [255] |
|
30 |
$ hg commit -d '- |
|
|
31 | abort: negative date value: -7654321 | |
|
30 | $ hg commit -d '-111111111111 0' -m commit-7 | |
|
31 | abort: date exceeds 32 bits: -111111111111 | |
|
32 | [255] | |
|
33 | $ echo foo >> foo | |
|
34 | $ hg commit -d '1901-12-13 20:45:53 +0000' -m commit-7-2 | |
|
35 | $ echo foo >> foo | |
|
36 | $ hg commit -d '-2147483647 0' -m commit-7-3 | |
|
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 | |
|
42 | [255] | |
|
43 | $ hg commit -d '-2147483648 0' -m commit-7 | |
|
44 | abort: date exceeds 32 bits: -2147483648 | |
|
32 | 45 | [255] |
|
33 | 46 | |
|
34 | 47 | commit added file that has been deleted |
@@ -54,7 +67,7 b' commit added file that has been deleted' | |||
|
54 | 67 | dir/file |
|
55 | 68 | committing manifest |
|
56 | 69 | committing changelog |
|
57 |
committed changeset |
|
|
70 | committed changeset 4:76aab26859d7 | |
|
58 | 71 | |
|
59 | 72 |
$ |
|
60 | 73 | $ hg add |
@@ -78,7 +91,7 b' commit added file that has been deleted' | |||
|
78 | 91 | dir/file |
|
79 | 92 | committing manifest |
|
80 | 93 | committing changelog |
|
81 |
committed changeset |
|
|
94 | committed changeset 5:9a50557f1baf | |
|
82 | 95 | $ cd .. |
|
83 | 96 | |
|
84 | 97 | $ hg commit -m commit-14 does-not-exist |
@@ -102,7 +115,7 b' commit added file that has been deleted' | |||
|
102 | 115 | dir/file |
|
103 | 116 | committing manifest |
|
104 | 117 | committing changelog |
|
105 |
committed changeset 4 |
|
|
118 | committed changeset 6:4b4c75bf422d | |
|
106 | 119 | |
|
107 | 120 | An empty date was interpreted as epoch origin |
|
108 | 121 |
General Comments 0
You need to be logged in to leave comments.
Login now