##// END OF EJS Templates
test-parse-date: defines explicit start/end dates for DST...
Sébastien Brissaud -
r28441:79d8e792 default
parent child Browse files
Show More
@@ -1,258 +1,260 b''
1 1 This runs with TZ="GMT"
2 2
3 3 $ hg init
4 4 $ echo "test-parse-date" > a
5 5 $ hg add a
6 6 $ hg ci -d "2006-02-01 13:00:30" -m "rev 0"
7 7 $ echo "hi!" >> a
8 8 $ hg ci -d "2006-02-01 13:00:30 -0500" -m "rev 1"
9 9 $ hg tag -d "2006-04-15 13:30" "Hi"
10 10 $ hg backout --merge -d "2006-04-15 13:30 +0200" -m "rev 3" 1
11 11 reverting a
12 12 created new head
13 13 changeset 3:107ce1ee2b43 backs out changeset 1:25a1420a55f8
14 14 merging with changeset 3:107ce1ee2b43
15 15 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
16 16 (branch merge, don't forget to commit)
17 17 $ hg ci -d "1150000000 14400" -m "rev 4 (merge)"
18 18 $ echo "fail" >> a
19 19 $ hg ci -d "should fail" -m "fail"
20 20 abort: invalid date: 'should fail'
21 21 [255]
22 22 $ hg ci -d "100000000000000000 1400" -m "fail"
23 23 abort: date exceeds 32 bits: 100000000000000000
24 24 [255]
25 25 $ hg ci -d "100000 1400000" -m "fail"
26 26 abort: impossible time zone offset: 1400000
27 27 [255]
28 28
29 29 Check with local timezone other than GMT and with DST
30 30
31 $ TZ="PST+8PDT"
31 $ TZ="PST+8PDT+7,M4.1.0/02:00:00,M10.5.0/02:00:00"
32 32 $ export TZ
33 33
34 34 PST=UTC-8 / PDT=UTC-7
35 Summer time begins on April's first Sunday at 2:00am,
36 and ends on October's last Sunday at 2:00am.
35 37
36 38 $ hg debugrebuildstate
37 39 $ echo "a" > a
38 40 $ hg ci -d "2006-07-15 13:30" -m "summer@UTC-7"
39 41 $ hg debugrebuildstate
40 42 $ echo "b" > a
41 43 $ hg ci -d "2006-07-15 13:30 +0500" -m "summer@UTC+5"
42 44 $ hg debugrebuildstate
43 45 $ echo "c" > a
44 46 $ hg ci -d "2006-01-15 13:30" -m "winter@UTC-8"
45 47 $ hg debugrebuildstate
46 48 $ echo "d" > a
47 49 $ hg ci -d "2006-01-15 13:30 +0500" -m "winter@UTC+5"
48 50 $ hg log --template '{date|date}\n'
49 51 Sun Jan 15 13:30:00 2006 +0500
50 52 Sun Jan 15 13:30:00 2006 -0800
51 53 Sat Jul 15 13:30:00 2006 +0500
52 54 Sat Jul 15 13:30:00 2006 -0700
53 55 Sun Jun 11 00:26:40 2006 -0400
54 56 Sat Apr 15 13:30:00 2006 +0200
55 57 Sat Apr 15 13:30:00 2006 +0000
56 58 Wed Feb 01 13:00:30 2006 -0500
57 59 Wed Feb 01 13:00:30 2006 +0000
58 60
59 61 Test issue1014 (fractional timezones)
60 62
61 63 $ hg debugdate "1000000000 -16200" # 0430
62 64 internal: 1000000000 -16200
63 65 standard: Sun Sep 09 06:16:40 2001 +0430
64 66 $ hg debugdate "1000000000 -15300" # 0415
65 67 internal: 1000000000 -15300
66 68 standard: Sun Sep 09 06:01:40 2001 +0415
67 69 $ hg debugdate "1000000000 -14400" # 0400
68 70 internal: 1000000000 -14400
69 71 standard: Sun Sep 09 05:46:40 2001 +0400
70 72 $ hg debugdate "1000000000 0" # GMT
71 73 internal: 1000000000 0
72 74 standard: Sun Sep 09 01:46:40 2001 +0000
73 75 $ hg debugdate "1000000000 14400" # -0400
74 76 internal: 1000000000 14400
75 77 standard: Sat Sep 08 21:46:40 2001 -0400
76 78 $ hg debugdate "1000000000 15300" # -0415
77 79 internal: 1000000000 15300
78 80 standard: Sat Sep 08 21:31:40 2001 -0415
79 81 $ hg debugdate "1000000000 16200" # -0430
80 82 internal: 1000000000 16200
81 83 standard: Sat Sep 08 21:16:40 2001 -0430
82 84 $ hg debugdate "Sat Sep 08 21:16:40 2001 +0430"
83 85 internal: 999967600 -16200
84 86 standard: Sat Sep 08 21:16:40 2001 +0430
85 87 $ hg debugdate "Sat Sep 08 21:16:40 2001 -0430"
86 88 internal: 1000000000 16200
87 89 standard: Sat Sep 08 21:16:40 2001 -0430
88 90
89 91 Test 12-hours times
90 92
91 93 $ hg debugdate "2006-02-01 1:00:30PM +0000"
92 94 internal: 1138798830 0
93 95 standard: Wed Feb 01 13:00:30 2006 +0000
94 96 $ hg debugdate "1:00:30PM" > /dev/null
95 97
96 98 Normal range
97 99
98 100 $ hg log -d -1
99 101
100 102 Negative range
101 103
102 104 $ hg log -d "--2"
103 105 abort: -2 must be nonnegative (see "hg help dates")
104 106 [255]
105 107
106 108 Whitespace only
107 109
108 110 $ hg log -d " "
109 111 abort: dates cannot consist entirely of whitespace
110 112 [255]
111 113
112 114 Test date formats with '>' or '<' accompanied by space characters
113 115
114 116 $ hg log -d '>' --template '{date|date}\n'
115 117 abort: invalid day spec, use '>DATE'
116 118 [255]
117 119 $ hg log -d '<' --template '{date|date}\n'
118 120 abort: invalid day spec, use '<DATE'
119 121 [255]
120 122
121 123 $ hg log -d ' >' --template '{date|date}\n'
122 124 abort: invalid day spec, use '>DATE'
123 125 [255]
124 126 $ hg log -d ' <' --template '{date|date}\n'
125 127 abort: invalid day spec, use '<DATE'
126 128 [255]
127 129
128 130 $ hg log -d '> ' --template '{date|date}\n'
129 131 abort: invalid day spec, use '>DATE'
130 132 [255]
131 133 $ hg log -d '< ' --template '{date|date}\n'
132 134 abort: invalid day spec, use '<DATE'
133 135 [255]
134 136
135 137 $ hg log -d ' > ' --template '{date|date}\n'
136 138 abort: invalid day spec, use '>DATE'
137 139 [255]
138 140 $ hg log -d ' < ' --template '{date|date}\n'
139 141 abort: invalid day spec, use '<DATE'
140 142 [255]
141 143
142 144 $ hg log -d '>02/01' --template '{date|date}\n'
143 145 $ hg log -d '<02/01' --template '{date|date}\n'
144 146 Sun Jan 15 13:30:00 2006 +0500
145 147 Sun Jan 15 13:30:00 2006 -0800
146 148 Sat Jul 15 13:30:00 2006 +0500
147 149 Sat Jul 15 13:30:00 2006 -0700
148 150 Sun Jun 11 00:26:40 2006 -0400
149 151 Sat Apr 15 13:30:00 2006 +0200
150 152 Sat Apr 15 13:30:00 2006 +0000
151 153 Wed Feb 01 13:00:30 2006 -0500
152 154 Wed Feb 01 13:00:30 2006 +0000
153 155
154 156 $ hg log -d ' >02/01' --template '{date|date}\n'
155 157 $ hg log -d ' <02/01' --template '{date|date}\n'
156 158 Sun Jan 15 13:30:00 2006 +0500
157 159 Sun Jan 15 13:30:00 2006 -0800
158 160 Sat Jul 15 13:30:00 2006 +0500
159 161 Sat Jul 15 13:30:00 2006 -0700
160 162 Sun Jun 11 00:26:40 2006 -0400
161 163 Sat Apr 15 13:30:00 2006 +0200
162 164 Sat Apr 15 13:30:00 2006 +0000
163 165 Wed Feb 01 13:00:30 2006 -0500
164 166 Wed Feb 01 13:00:30 2006 +0000
165 167
166 168 $ hg log -d '> 02/01' --template '{date|date}\n'
167 169 $ hg log -d '< 02/01' --template '{date|date}\n'
168 170 Sun Jan 15 13:30:00 2006 +0500
169 171 Sun Jan 15 13:30:00 2006 -0800
170 172 Sat Jul 15 13:30:00 2006 +0500
171 173 Sat Jul 15 13:30:00 2006 -0700
172 174 Sun Jun 11 00:26:40 2006 -0400
173 175 Sat Apr 15 13:30:00 2006 +0200
174 176 Sat Apr 15 13:30:00 2006 +0000
175 177 Wed Feb 01 13:00:30 2006 -0500
176 178 Wed Feb 01 13:00:30 2006 +0000
177 179
178 180 $ hg log -d ' > 02/01' --template '{date|date}\n'
179 181 $ hg log -d ' < 02/01' --template '{date|date}\n'
180 182 Sun Jan 15 13:30:00 2006 +0500
181 183 Sun Jan 15 13:30:00 2006 -0800
182 184 Sat Jul 15 13:30:00 2006 +0500
183 185 Sat Jul 15 13:30:00 2006 -0700
184 186 Sun Jun 11 00:26:40 2006 -0400
185 187 Sat Apr 15 13:30:00 2006 +0200
186 188 Sat Apr 15 13:30:00 2006 +0000
187 189 Wed Feb 01 13:00:30 2006 -0500
188 190 Wed Feb 01 13:00:30 2006 +0000
189 191
190 192 $ hg log -d '>02/01 ' --template '{date|date}\n'
191 193 $ hg log -d '<02/01 ' --template '{date|date}\n'
192 194 Sun Jan 15 13:30:00 2006 +0500
193 195 Sun Jan 15 13:30:00 2006 -0800
194 196 Sat Jul 15 13:30:00 2006 +0500
195 197 Sat Jul 15 13:30:00 2006 -0700
196 198 Sun Jun 11 00:26:40 2006 -0400
197 199 Sat Apr 15 13:30:00 2006 +0200
198 200 Sat Apr 15 13:30:00 2006 +0000
199 201 Wed Feb 01 13:00:30 2006 -0500
200 202 Wed Feb 01 13:00:30 2006 +0000
201 203
202 204 $ hg log -d ' >02/01 ' --template '{date|date}\n'
203 205 $ hg log -d ' <02/01 ' --template '{date|date}\n'
204 206 Sun Jan 15 13:30:00 2006 +0500
205 207 Sun Jan 15 13:30:00 2006 -0800
206 208 Sat Jul 15 13:30:00 2006 +0500
207 209 Sat Jul 15 13:30:00 2006 -0700
208 210 Sun Jun 11 00:26:40 2006 -0400
209 211 Sat Apr 15 13:30:00 2006 +0200
210 212 Sat Apr 15 13:30:00 2006 +0000
211 213 Wed Feb 01 13:00:30 2006 -0500
212 214 Wed Feb 01 13:00:30 2006 +0000
213 215
214 216 $ hg log -d '> 02/01 ' --template '{date|date}\n'
215 217 $ hg log -d '< 02/01 ' --template '{date|date}\n'
216 218 Sun Jan 15 13:30:00 2006 +0500
217 219 Sun Jan 15 13:30:00 2006 -0800
218 220 Sat Jul 15 13:30:00 2006 +0500
219 221 Sat Jul 15 13:30:00 2006 -0700
220 222 Sun Jun 11 00:26:40 2006 -0400
221 223 Sat Apr 15 13:30:00 2006 +0200
222 224 Sat Apr 15 13:30:00 2006 +0000
223 225 Wed Feb 01 13:00:30 2006 -0500
224 226 Wed Feb 01 13:00:30 2006 +0000
225 227
226 228 $ hg log -d ' > 02/01 ' --template '{date|date}\n'
227 229 $ hg log -d ' < 02/01 ' --template '{date|date}\n'
228 230 Sun Jan 15 13:30:00 2006 +0500
229 231 Sun Jan 15 13:30:00 2006 -0800
230 232 Sat Jul 15 13:30:00 2006 +0500
231 233 Sat Jul 15 13:30:00 2006 -0700
232 234 Sun Jun 11 00:26:40 2006 -0400
233 235 Sat Apr 15 13:30:00 2006 +0200
234 236 Sat Apr 15 13:30:00 2006 +0000
235 237 Wed Feb 01 13:00:30 2006 -0500
236 238 Wed Feb 01 13:00:30 2006 +0000
237 239
238 240 Test issue 3764 (interpreting 'today' and 'yesterday')
239 241 $ echo "hello" >> a
240 242 >>> import datetime
241 243 >>> today = datetime.date.today().strftime("%b %d")
242 244 >>> yesterday = (datetime.date.today() - datetime.timedelta(days=1)).strftime("%b %d")
243 245 >>> dates = open('dates', 'w')
244 246 >>> dates.write(today + '\n')
245 247 >>> dates.write(yesterday + '\n')
246 248 >>> dates.close()
247 249 $ hg ci -d "`sed -n '1p' dates`" -m "today is a good day to code"
248 250 $ hg log -d today --template '{desc}\n'
249 251 today is a good day to code
250 252 $ echo "goodbye" >> a
251 253 $ hg ci -d "`sed -n '2p' dates`" -m "the time traveler's code"
252 254 $ hg log -d yesterday --template '{desc}\n'
253 255 the time traveler's code
254 256 $ echo "foo" >> a
255 257 $ hg commit -d now -m 'Explicitly committed now.'
256 258 $ hg log -d today --template '{desc}\n'
257 259 Explicitly committed now.
258 260 today is a good day to code
General Comments 0
You need to be logged in to leave comments. Login now