Show More
@@ -1,676 +1,676 b'' | |||
|
1 | 1 | $ fileset() { |
|
2 | 2 | > hg debugfileset "$@" |
|
3 | 3 | > } |
|
4 | 4 | |
|
5 | 5 | $ hg init repo |
|
6 | 6 | $ cd repo |
|
7 | 7 | $ echo a > a1 |
|
8 | 8 | $ echo a > a2 |
|
9 | 9 | $ echo b > b1 |
|
10 | 10 | $ echo b > b2 |
|
11 | 11 | $ hg ci -Am addfiles |
|
12 | 12 | adding a1 |
|
13 | 13 | adding a2 |
|
14 | 14 | adding b1 |
|
15 | 15 | adding b2 |
|
16 | 16 | |
|
17 | 17 | Test operators and basic patterns |
|
18 | 18 | |
|
19 | 19 | $ fileset -v a1 |
|
20 | 20 | (symbol 'a1') |
|
21 | 21 | a1 |
|
22 | 22 | $ fileset -v 'a*' |
|
23 | 23 | (symbol 'a*') |
|
24 | 24 | a1 |
|
25 | 25 | a2 |
|
26 | 26 | $ fileset -v '"re:a\d"' |
|
27 | 27 | (string 're:a\\d') |
|
28 | 28 | a1 |
|
29 | 29 | a2 |
|
30 | 30 | $ fileset -v '!re:"a\d"' |
|
31 | 31 | (not |
|
32 | 32 | (kindpat |
|
33 | 33 | (symbol 're') |
|
34 | 34 | (string 'a\\d'))) |
|
35 | 35 | b1 |
|
36 | 36 | b2 |
|
37 | 37 | $ fileset -v 'path:a1 or glob:b?' |
|
38 | 38 | (or |
|
39 | 39 | (kindpat |
|
40 | 40 | (symbol 'path') |
|
41 | 41 | (symbol 'a1')) |
|
42 | 42 | (kindpat |
|
43 | 43 | (symbol 'glob') |
|
44 | 44 | (symbol 'b?'))) |
|
45 | 45 | a1 |
|
46 | 46 | b1 |
|
47 | 47 | b2 |
|
48 | 48 | $ fileset -v 'a1 or a2' |
|
49 | 49 | (or |
|
50 | 50 | (symbol 'a1') |
|
51 | 51 | (symbol 'a2')) |
|
52 | 52 | a1 |
|
53 | 53 | a2 |
|
54 | 54 | $ fileset 'a1 | a2' |
|
55 | 55 | a1 |
|
56 | 56 | a2 |
|
57 | 57 | $ fileset 'a* and "*1"' |
|
58 | 58 | a1 |
|
59 | 59 | $ fileset 'a* & "*1"' |
|
60 | 60 | a1 |
|
61 | 61 | $ fileset 'not (r"a*")' |
|
62 | 62 | b1 |
|
63 | 63 | b2 |
|
64 | 64 | $ fileset '! ("a*")' |
|
65 | 65 | b1 |
|
66 | 66 | b2 |
|
67 | 67 | $ fileset 'a* - a1' |
|
68 | 68 | a2 |
|
69 | 69 | $ fileset 'a_b' |
|
70 | 70 | $ fileset '"\xy"' |
|
71 | 71 | hg: parse error: invalid \x escape |
|
72 | 72 | [255] |
|
73 | 73 | |
|
74 | 74 | Test invalid syntax |
|
75 | 75 | |
|
76 | 76 | $ fileset -v '"added"()' |
|
77 | 77 | (func |
|
78 | 78 | (string 'added') |
|
79 | 79 | None) |
|
80 | 80 | hg: parse error: not a symbol |
|
81 | 81 | [255] |
|
82 | 82 | $ fileset -v '()()' |
|
83 | 83 | (func |
|
84 | 84 | (group |
|
85 | 85 | None) |
|
86 | 86 | None) |
|
87 | 87 | hg: parse error: not a symbol |
|
88 | 88 | [255] |
|
89 | 89 | $ fileset -v -- '-x' |
|
90 | 90 | (negate |
|
91 | 91 | (symbol 'x')) |
|
92 | 92 | hg: parse error: can't use negate operator in this context |
|
93 | 93 | [255] |
|
94 | 94 | $ fileset -v -- '-()' |
|
95 | 95 | (negate |
|
96 | 96 | (group |
|
97 | 97 | None)) |
|
98 | 98 | hg: parse error: can't use negate operator in this context |
|
99 | 99 | [255] |
|
100 | 100 | |
|
101 | 101 | $ fileset '"path":.' |
|
102 | 102 | hg: parse error: not a symbol |
|
103 | 103 | [255] |
|
104 | 104 | $ fileset 'path:foo bar' |
|
105 | 105 | hg: parse error at 9: invalid token |
|
106 | 106 | [255] |
|
107 | 107 | $ fileset 'foo:bar:baz' |
|
108 | 108 | hg: parse error: not a symbol |
|
109 | 109 | [255] |
|
110 | 110 | $ fileset 'foo:bar()' |
|
111 | 111 | hg: parse error: pattern must be a string |
|
112 | 112 | [255] |
|
113 | 113 | $ fileset 'foo:bar' |
|
114 | 114 | hg: parse error: invalid pattern kind: foo |
|
115 | 115 | [255] |
|
116 | 116 | |
|
117 | 117 | Test files status |
|
118 | 118 | |
|
119 | 119 | $ rm a1 |
|
120 | 120 | $ hg rm a2 |
|
121 | 121 | $ echo b >> b2 |
|
122 | 122 | $ hg cp b1 c1 |
|
123 | 123 | $ echo c > c2 |
|
124 | 124 | $ echo c > c3 |
|
125 | 125 | $ cat > .hgignore <<EOF |
|
126 | 126 | > \.hgignore |
|
127 | 127 | > 2$ |
|
128 | 128 | > EOF |
|
129 | 129 | $ fileset 'modified()' |
|
130 | 130 | b2 |
|
131 | 131 | $ fileset 'added()' |
|
132 | 132 | c1 |
|
133 | 133 | $ fileset 'removed()' |
|
134 | 134 | a2 |
|
135 | 135 | $ fileset 'deleted()' |
|
136 | 136 | a1 |
|
137 | 137 | $ fileset 'missing()' |
|
138 | 138 | a1 |
|
139 | 139 | $ fileset 'unknown()' |
|
140 | 140 | c3 |
|
141 | 141 | $ fileset 'ignored()' |
|
142 | 142 | .hgignore |
|
143 | 143 | c2 |
|
144 | 144 | $ fileset 'hgignore()' |
|
145 | 145 | a2 |
|
146 | 146 | b2 |
|
147 | 147 | $ fileset 'clean()' |
|
148 | 148 | b1 |
|
149 | 149 | $ fileset 'copied()' |
|
150 | 150 | c1 |
|
151 | 151 | |
|
152 | 152 | Test files status in different revisions |
|
153 | 153 | |
|
154 | 154 | $ hg status -m |
|
155 | 155 | M b2 |
|
156 | 156 | $ fileset -r0 'revs("wdir()", modified())' --traceback |
|
157 | 157 | b2 |
|
158 | 158 | $ hg status -a |
|
159 | 159 | A c1 |
|
160 | 160 | $ fileset -r0 'revs("wdir()", added())' |
|
161 | 161 | c1 |
|
162 | 162 | $ hg status --change 0 -a |
|
163 | 163 | A a1 |
|
164 | 164 | A a2 |
|
165 | 165 | A b1 |
|
166 | 166 | A b2 |
|
167 | 167 | $ hg status -mru |
|
168 | 168 | M b2 |
|
169 | 169 | R a2 |
|
170 | 170 | ? c3 |
|
171 | 171 | $ fileset -r0 'added() and revs("wdir()", modified() or removed() or unknown())' |
|
172 | 172 | b2 |
|
173 | 173 | a2 |
|
174 | 174 | $ fileset -r0 'added() or revs("wdir()", added())' |
|
175 | 175 | a1 |
|
176 | 176 | a2 |
|
177 | 177 | b1 |
|
178 | 178 | b2 |
|
179 | 179 | c1 |
|
180 | 180 | |
|
181 | 181 | Test files properties |
|
182 | 182 | |
|
183 | >>> open('bin', 'wb').write(b'\0a') | |
|
183 | >>> open('bin', 'wb').write(b'\0a') and None | |
|
184 | 184 |
$ |
|
185 | 185 |
$ |
|
186 | 186 | bin |
|
187 | 187 | $ echo '^bin$' >> .hgignore |
|
188 | 188 | $ fileset 'binary() and ignored()' |
|
189 | 189 | bin |
|
190 | 190 | $ hg add bin |
|
191 | 191 | $ fileset 'binary()' |
|
192 | 192 | bin |
|
193 | 193 | |
|
194 | 194 | $ fileset 'grep("b{1}")' |
|
195 | 195 | b2 |
|
196 | 196 | c1 |
|
197 | 197 | b1 |
|
198 | 198 | $ fileset 'grep("missingparens(")' |
|
199 | 199 | hg: parse error: invalid match pattern: unbalanced parenthesis |
|
200 | 200 | [255] |
|
201 | 201 | |
|
202 | 202 | #if execbit |
|
203 | 203 | $ chmod +x b2 |
|
204 | 204 | $ fileset 'exec()' |
|
205 | 205 | b2 |
|
206 | 206 | #endif |
|
207 | 207 | |
|
208 | 208 | #if symlink |
|
209 | 209 | $ ln -s b2 b2link |
|
210 | 210 | $ fileset 'symlink() and unknown()' |
|
211 | 211 | b2link |
|
212 | 212 | $ hg add b2link |
|
213 | 213 | #endif |
|
214 | 214 | |
|
215 | 215 | #if no-windows |
|
216 | 216 | $ echo foo > con.xml |
|
217 | 217 | $ fileset 'not portable()' |
|
218 | 218 | con.xml |
|
219 | 219 | $ hg --config ui.portablefilenames=ignore add con.xml |
|
220 | 220 | #endif |
|
221 | 221 | |
|
222 | >>> open('1k', 'wb').write(b' '*1024) | |
|
223 | >>> open('2k', 'wb').write(b' '*2048) | |
|
222 | >>> open('1k', 'wb').write(b' '*1024) and None | |
|
223 | >>> open('2k', 'wb').write(b' '*2048) and None | |
|
224 | 224 |
$ |
|
225 | 225 | $ fileset 'size("bar")' |
|
226 | 226 | hg: parse error: couldn't parse size: bar |
|
227 | 227 | [255] |
|
228 | 228 | $ fileset '(1k, 2k)' |
|
229 | 229 | hg: parse error: can't use a list in this context |
|
230 | 230 | (see hg help "filesets.x or y") |
|
231 | 231 | [255] |
|
232 | 232 | $ fileset 'size(1k)' |
|
233 | 233 | 1k |
|
234 | 234 | $ fileset '(1k or 2k) and size("< 2k")' |
|
235 | 235 | 1k |
|
236 | 236 | $ fileset '(1k or 2k) and size("<=2k")' |
|
237 | 237 | 1k |
|
238 | 238 | 2k |
|
239 | 239 | $ fileset '(1k or 2k) and size("> 1k")' |
|
240 | 240 | 2k |
|
241 | 241 | $ fileset '(1k or 2k) and size(">=1K")' |
|
242 | 242 | 1k |
|
243 | 243 | 2k |
|
244 | 244 | $ fileset '(1k or 2k) and size(".5KB - 1.5kB")' |
|
245 | 245 | 1k |
|
246 | 246 | $ fileset 'size("1M")' |
|
247 | 247 | $ fileset 'size("1 GB")' |
|
248 | 248 | |
|
249 | 249 | Test merge states |
|
250 | 250 | |
|
251 | 251 | $ hg ci -m manychanges |
|
252 | 252 | $ hg file -r . 'set:copied() & modified()' |
|
253 | 253 | [1] |
|
254 | 254 | $ hg up -C 0 |
|
255 | 255 | * files updated, 0 files merged, * files removed, 0 files unresolved (glob) |
|
256 | 256 | $ echo c >> b2 |
|
257 | 257 | $ hg ci -m diverging b2 |
|
258 | 258 | created new head |
|
259 | 259 | $ fileset 'resolved()' |
|
260 | 260 | $ fileset 'unresolved()' |
|
261 | 261 | $ hg merge |
|
262 | 262 | merging b2 |
|
263 | 263 | warning: conflicts while merging b2! (edit, then use 'hg resolve --mark') |
|
264 | 264 | * files updated, 0 files merged, 1 files removed, 1 files unresolved (glob) |
|
265 | 265 | use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon |
|
266 | 266 | [1] |
|
267 | 267 | $ fileset 'resolved()' |
|
268 | 268 | $ fileset 'unresolved()' |
|
269 | 269 | b2 |
|
270 | 270 | $ echo e > b2 |
|
271 | 271 | $ hg resolve -m b2 |
|
272 | 272 | (no more unresolved files) |
|
273 | 273 | $ fileset 'resolved()' |
|
274 | 274 | b2 |
|
275 | 275 | $ fileset 'unresolved()' |
|
276 | 276 | $ hg ci -m merge |
|
277 | 277 | |
|
278 | 278 | Test subrepo predicate |
|
279 | 279 | |
|
280 | 280 | $ hg init sub |
|
281 | 281 | $ echo a > sub/suba |
|
282 | 282 | $ hg -R sub add sub/suba |
|
283 | 283 | $ hg -R sub ci -m sub |
|
284 | 284 | $ echo 'sub = sub' > .hgsub |
|
285 | 285 | $ hg init sub2 |
|
286 | 286 | $ echo b > sub2/b |
|
287 | 287 | $ hg -R sub2 ci -Am sub2 |
|
288 | 288 | adding b |
|
289 | 289 | $ echo 'sub2 = sub2' >> .hgsub |
|
290 | 290 | $ fileset 'subrepo()' |
|
291 | 291 | $ hg add .hgsub |
|
292 | 292 | $ fileset 'subrepo()' |
|
293 | 293 | sub |
|
294 | 294 | sub2 |
|
295 | 295 | $ fileset 'subrepo("sub")' |
|
296 | 296 | sub |
|
297 | 297 | $ fileset 'subrepo("glob:*")' |
|
298 | 298 | sub |
|
299 | 299 | sub2 |
|
300 | 300 | $ hg ci -m subrepo |
|
301 | 301 | |
|
302 | 302 | Test that .hgsubstate is updated as appropriate during a conversion. The |
|
303 | 303 | saverev property is enough to alter the hashes of the subrepo. |
|
304 | 304 | |
|
305 | 305 | $ hg init ../converted |
|
306 | 306 | $ hg --config extensions.convert= convert --config convert.hg.saverev=True \ |
|
307 | 307 | > sub ../converted/sub |
|
308 | 308 | initializing destination ../converted/sub repository |
|
309 | 309 | scanning source... |
|
310 | 310 | sorting... |
|
311 | 311 | converting... |
|
312 | 312 | 0 sub |
|
313 | 313 | $ hg clone -U sub2 ../converted/sub2 |
|
314 | 314 | $ hg --config extensions.convert= convert --config convert.hg.saverev=True \ |
|
315 | 315 | > . ../converted |
|
316 | 316 | scanning source... |
|
317 | 317 | sorting... |
|
318 | 318 | converting... |
|
319 | 319 | 4 addfiles |
|
320 | 320 | 3 manychanges |
|
321 | 321 | 2 diverging |
|
322 | 322 | 1 merge |
|
323 | 323 | 0 subrepo |
|
324 | 324 | no ".hgsubstate" updates will be made for "sub2" |
|
325 | 325 | $ hg up -q -R ../converted -r tip |
|
326 | 326 | $ hg --cwd ../converted cat sub/suba sub2/b -r tip |
|
327 | 327 | a |
|
328 | 328 | b |
|
329 | 329 | $ oldnode=`hg log -r tip -T "{node}\n"` |
|
330 | 330 | $ newnode=`hg log -R ../converted -r tip -T "{node}\n"` |
|
331 | 331 | $ [ "$oldnode" != "$newnode" ] || echo "nothing changed" |
|
332 | 332 | |
|
333 | 333 | Test with a revision |
|
334 | 334 | |
|
335 | 335 | $ hg log -G --template '{rev} {desc}\n' |
|
336 | 336 | @ 4 subrepo |
|
337 | 337 | | |
|
338 | 338 | o 3 merge |
|
339 | 339 | |\ |
|
340 | 340 | | o 2 diverging |
|
341 | 341 | | | |
|
342 | 342 | o | 1 manychanges |
|
343 | 343 | |/ |
|
344 | 344 | o 0 addfiles |
|
345 | 345 | |
|
346 | 346 | $ echo unknown > unknown |
|
347 | 347 | $ fileset -r1 'modified()' |
|
348 | 348 | b2 |
|
349 | 349 | $ fileset -r1 'added() and c1' |
|
350 | 350 | c1 |
|
351 | 351 | $ fileset -r1 'removed()' |
|
352 | 352 | a2 |
|
353 | 353 | $ fileset -r1 'deleted()' |
|
354 | 354 | $ fileset -r1 'unknown()' |
|
355 | 355 | $ fileset -r1 'ignored()' |
|
356 | 356 | $ fileset -r1 'hgignore()' |
|
357 | 357 | b2 |
|
358 | 358 | bin |
|
359 | 359 | $ fileset -r1 'binary()' |
|
360 | 360 | bin |
|
361 | 361 | $ fileset -r1 'size(1k)' |
|
362 | 362 | 1k |
|
363 | 363 | $ fileset -r3 'resolved()' |
|
364 | 364 | $ fileset -r3 'unresolved()' |
|
365 | 365 | |
|
366 | 366 | #if execbit |
|
367 | 367 | $ fileset -r1 'exec()' |
|
368 | 368 | b2 |
|
369 | 369 | #endif |
|
370 | 370 | |
|
371 | 371 | #if symlink |
|
372 | 372 | $ fileset -r1 'symlink()' |
|
373 | 373 | b2link |
|
374 | 374 | #endif |
|
375 | 375 | |
|
376 | 376 | #if no-windows |
|
377 | 377 | $ fileset -r1 'not portable()' |
|
378 | 378 | con.xml |
|
379 | 379 | $ hg forget 'con.xml' |
|
380 | 380 | #endif |
|
381 | 381 | |
|
382 | 382 | $ fileset -r4 'subrepo("re:su.*")' |
|
383 | 383 | sub |
|
384 | 384 | sub2 |
|
385 | 385 | $ fileset -r4 'subrepo(re:su.*)' |
|
386 | 386 | sub |
|
387 | 387 | sub2 |
|
388 | 388 | $ fileset -r4 'subrepo("sub")' |
|
389 | 389 | sub |
|
390 | 390 | $ fileset -r4 'b2 or c1' |
|
391 | 391 | b2 |
|
392 | 392 | c1 |
|
393 | 393 | |
|
394 | >>> open('dos', 'wb').write("dos\r\n") | |
|
395 | >>> open('mixed', 'wb').write("dos\r\nunix\n") | |
|
396 | >>> open('mac', 'wb').write("mac\r") | |
|
394 | >>> open('dos', 'wb').write(b"dos\r\n") and None | |
|
395 | >>> open('mixed', 'wb').write(b"dos\r\nunix\n") and None | |
|
396 | >>> open('mac', 'wb').write(b"mac\r") and None | |
|
397 | 397 | $ hg add dos mixed mac |
|
398 | 398 | |
|
399 | 399 | (remove a1, to examine safety of 'eol' on removed files) |
|
400 | 400 | $ rm a1 |
|
401 | 401 | |
|
402 | 402 | $ fileset 'eol(dos)' |
|
403 | 403 | dos |
|
404 | 404 | mixed |
|
405 | 405 | $ fileset 'eol(unix)' |
|
406 | 406 | mixed |
|
407 | 407 | .hgsub |
|
408 | 408 | .hgsubstate |
|
409 | 409 | b1 |
|
410 | 410 | b2 |
|
411 | 411 | c1 |
|
412 | 412 | $ fileset 'eol(mac)' |
|
413 | 413 | mac |
|
414 | 414 | |
|
415 | 415 | Test safety of 'encoding' on removed files |
|
416 | 416 | |
|
417 | 417 | $ fileset 'encoding("ascii")' |
|
418 | 418 | dos |
|
419 | 419 | mac |
|
420 | 420 | mixed |
|
421 | 421 | .hgsub |
|
422 | 422 | .hgsubstate |
|
423 | 423 | 1k |
|
424 | 424 | 2k |
|
425 | 425 | b1 |
|
426 | 426 | b2 |
|
427 | 427 | b2link (symlink !) |
|
428 | 428 | bin |
|
429 | 429 | c1 |
|
430 | 430 | |
|
431 | 431 | Test detection of unintentional 'matchctx.existing()' invocation |
|
432 | 432 | |
|
433 | 433 | $ cat > $TESTTMP/existingcaller.py <<EOF |
|
434 | 434 | > from mercurial import registrar |
|
435 | 435 | > |
|
436 | 436 | > filesetpredicate = registrar.filesetpredicate() |
|
437 | 437 | > @filesetpredicate('existingcaller()', callexisting=False) |
|
438 | 438 | > def existingcaller(mctx, x): |
|
439 | 439 | > # this 'mctx.existing()' invocation is unintentional |
|
440 | 440 | > return [f for f in mctx.existing()] |
|
441 | 441 | > EOF |
|
442 | 442 | |
|
443 | 443 | $ cat >> .hg/hgrc <<EOF |
|
444 | 444 | > [extensions] |
|
445 | 445 | > existingcaller = $TESTTMP/existingcaller.py |
|
446 | 446 | > EOF |
|
447 | 447 | |
|
448 | 448 | $ fileset 'existingcaller()' 2>&1 | tail -1 |
|
449 | 449 | AssertionError: unexpected existing() invocation |
|
450 | 450 | |
|
451 | 451 | Test 'revs(...)' |
|
452 | 452 | ================ |
|
453 | 453 | |
|
454 | 454 | small reminder of the repository state |
|
455 | 455 | |
|
456 | 456 | $ hg log -G |
|
457 | 457 | @ changeset: 4:* (glob) |
|
458 | 458 | | tag: tip |
|
459 | 459 | | user: test |
|
460 | 460 | | date: Thu Jan 01 00:00:00 1970 +0000 |
|
461 | 461 | | summary: subrepo |
|
462 | 462 | | |
|
463 | 463 | o changeset: 3:* (glob) |
|
464 | 464 | |\ parent: 2:55b05bdebf36 |
|
465 | 465 | | | parent: 1:* (glob) |
|
466 | 466 | | | user: test |
|
467 | 467 | | | date: Thu Jan 01 00:00:00 1970 +0000 |
|
468 | 468 | | | summary: merge |
|
469 | 469 | | | |
|
470 | 470 | | o changeset: 2:55b05bdebf36 |
|
471 | 471 | | | parent: 0:8a9576c51c1f |
|
472 | 472 | | | user: test |
|
473 | 473 | | | date: Thu Jan 01 00:00:00 1970 +0000 |
|
474 | 474 | | | summary: diverging |
|
475 | 475 | | | |
|
476 | 476 | o | changeset: 1:* (glob) |
|
477 | 477 | |/ user: test |
|
478 | 478 | | date: Thu Jan 01 00:00:00 1970 +0000 |
|
479 | 479 | | summary: manychanges |
|
480 | 480 | | |
|
481 | 481 | o changeset: 0:8a9576c51c1f |
|
482 | 482 | user: test |
|
483 | 483 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
484 | 484 | summary: addfiles |
|
485 | 485 | |
|
486 | 486 | $ hg status --change 0 |
|
487 | 487 | A a1 |
|
488 | 488 | A a2 |
|
489 | 489 | A b1 |
|
490 | 490 | A b2 |
|
491 | 491 | $ hg status --change 1 |
|
492 | 492 | M b2 |
|
493 | 493 | A 1k |
|
494 | 494 | A 2k |
|
495 | 495 | A b2link (no-windows !) |
|
496 | 496 | A bin |
|
497 | 497 | A c1 |
|
498 | 498 | A con.xml (no-windows !) |
|
499 | 499 | R a2 |
|
500 | 500 | $ hg status --change 2 |
|
501 | 501 | M b2 |
|
502 | 502 | $ hg status --change 3 |
|
503 | 503 | M b2 |
|
504 | 504 | A 1k |
|
505 | 505 | A 2k |
|
506 | 506 | A b2link (no-windows !) |
|
507 | 507 | A bin |
|
508 | 508 | A c1 |
|
509 | 509 | A con.xml (no-windows !) |
|
510 | 510 | R a2 |
|
511 | 511 | $ hg status --change 4 |
|
512 | 512 | A .hgsub |
|
513 | 513 | A .hgsubstate |
|
514 | 514 | $ hg status |
|
515 | 515 | A dos |
|
516 | 516 | A mac |
|
517 | 517 | A mixed |
|
518 | 518 | R con.xml (no-windows !) |
|
519 | 519 | ! a1 |
|
520 | 520 | ? b2.orig |
|
521 | 521 | ? c3 |
|
522 | 522 | ? unknown |
|
523 | 523 | |
|
524 | 524 | Test files at -r0 should be filtered by files at wdir |
|
525 | 525 | ----------------------------------------------------- |
|
526 | 526 | |
|
527 | 527 | $ fileset -r0 '* and revs("wdir()", *)' |
|
528 | 528 | a1 |
|
529 | 529 | b1 |
|
530 | 530 | b2 |
|
531 | 531 | |
|
532 | 532 | Test that "revs()" work at all |
|
533 | 533 | ------------------------------ |
|
534 | 534 | |
|
535 | 535 | $ fileset "revs('2', modified())" |
|
536 | 536 | b2 |
|
537 | 537 | |
|
538 | 538 | Test that "revs()" work for file missing in the working copy/current context |
|
539 | 539 | ---------------------------------------------------------------------------- |
|
540 | 540 | |
|
541 | 541 | (a2 not in working copy) |
|
542 | 542 | |
|
543 | 543 | $ fileset "revs('0', added())" |
|
544 | 544 | a1 |
|
545 | 545 | a2 |
|
546 | 546 | b1 |
|
547 | 547 | b2 |
|
548 | 548 | |
|
549 | 549 | (none of the file exist in "0") |
|
550 | 550 | |
|
551 | 551 | $ fileset -r 0 "revs('4', added())" |
|
552 | 552 | .hgsub |
|
553 | 553 | .hgsubstate |
|
554 | 554 | |
|
555 | 555 | Call with empty revset |
|
556 | 556 | -------------------------- |
|
557 | 557 | |
|
558 | 558 | $ fileset "revs('2-2', modified())" |
|
559 | 559 | |
|
560 | 560 | Call with revset matching multiple revs |
|
561 | 561 | --------------------------------------- |
|
562 | 562 | |
|
563 | 563 | $ fileset "revs('0+4', added())" |
|
564 | 564 | a1 |
|
565 | 565 | a2 |
|
566 | 566 | b1 |
|
567 | 567 | b2 |
|
568 | 568 | .hgsub |
|
569 | 569 | .hgsubstate |
|
570 | 570 | |
|
571 | 571 | overlapping set |
|
572 | 572 | |
|
573 | 573 | $ fileset "revs('1+2', modified())" |
|
574 | 574 | b2 |
|
575 | 575 | |
|
576 | 576 | test 'status(...)' |
|
577 | 577 | ================= |
|
578 | 578 | |
|
579 | 579 | Simple case |
|
580 | 580 | ----------- |
|
581 | 581 | |
|
582 | 582 | $ fileset "status(3, 4, added())" |
|
583 | 583 | .hgsub |
|
584 | 584 | .hgsubstate |
|
585 | 585 | |
|
586 | 586 | use rev to restrict matched file |
|
587 | 587 | ----------------------------------------- |
|
588 | 588 | |
|
589 | 589 | $ hg status --removed --rev 0 --rev 1 |
|
590 | 590 | R a2 |
|
591 | 591 | $ fileset "status(0, 1, removed())" |
|
592 | 592 | a2 |
|
593 | 593 | $ fileset "* and status(0, 1, removed())" |
|
594 | 594 | $ fileset -r 4 "status(0, 1, removed())" |
|
595 | 595 | a2 |
|
596 | 596 | $ fileset -r 4 "* and status(0, 1, removed())" |
|
597 | 597 | $ fileset "revs('4', * and status(0, 1, removed()))" |
|
598 | 598 | $ fileset "revs('0', * and status(0, 1, removed()))" |
|
599 | 599 | a2 |
|
600 | 600 | |
|
601 | 601 | check wdir() |
|
602 | 602 | ------------ |
|
603 | 603 | |
|
604 | 604 | $ hg status --removed --rev 4 |
|
605 | 605 | R con.xml (no-windows !) |
|
606 | 606 | $ fileset "status(4, 'wdir()', removed())" |
|
607 | 607 | con.xml (no-windows !) |
|
608 | 608 | |
|
609 | 609 | $ hg status --removed --rev 2 |
|
610 | 610 | R a2 |
|
611 | 611 | $ fileset "status('2', 'wdir()', removed())" |
|
612 | 612 | a2 |
|
613 | 613 | |
|
614 | 614 | test backward status |
|
615 | 615 | -------------------- |
|
616 | 616 | |
|
617 | 617 | $ hg status --removed --rev 0 --rev 4 |
|
618 | 618 | R a2 |
|
619 | 619 | $ hg status --added --rev 4 --rev 0 |
|
620 | 620 | A a2 |
|
621 | 621 | $ fileset "status(4, 0, added())" |
|
622 | 622 | a2 |
|
623 | 623 | |
|
624 | 624 | test cross branch status |
|
625 | 625 | ------------------------ |
|
626 | 626 | |
|
627 | 627 | $ hg status --added --rev 1 --rev 2 |
|
628 | 628 | A a2 |
|
629 | 629 | $ fileset "status(1, 2, added())" |
|
630 | 630 | a2 |
|
631 | 631 | |
|
632 | 632 | test with multi revs revset |
|
633 | 633 | --------------------------- |
|
634 | 634 | $ hg status --added --rev 0:1 --rev 3:4 |
|
635 | 635 | A .hgsub |
|
636 | 636 | A .hgsubstate |
|
637 | 637 | A 1k |
|
638 | 638 | A 2k |
|
639 | 639 | A b2link (no-windows !) |
|
640 | 640 | A bin |
|
641 | 641 | A c1 |
|
642 | 642 | A con.xml (no-windows !) |
|
643 | 643 | $ fileset "status('0:1', '3:4', added())" |
|
644 | 644 | .hgsub |
|
645 | 645 | .hgsubstate |
|
646 | 646 | 1k |
|
647 | 647 | 2k |
|
648 | 648 | b2link (no-windows !) |
|
649 | 649 | bin |
|
650 | 650 | c1 |
|
651 | 651 | con.xml (no-windows !) |
|
652 | 652 | |
|
653 | 653 | tests with empty value |
|
654 | 654 | ---------------------- |
|
655 | 655 | |
|
656 | 656 | Fully empty revset |
|
657 | 657 | |
|
658 | 658 | $ fileset "status('', '4', added())" |
|
659 | 659 | hg: parse error: first argument to status must be a revision |
|
660 | 660 | [255] |
|
661 | 661 | $ fileset "status('2', '', added())" |
|
662 | 662 | hg: parse error: second argument to status must be a revision |
|
663 | 663 | [255] |
|
664 | 664 | |
|
665 | 665 | Empty revset will error at the revset layer |
|
666 | 666 | |
|
667 | 667 | $ fileset "status(' ', '4', added())" |
|
668 | 668 | hg: parse error at 1: not a prefix: end |
|
669 | 669 | ( |
|
670 | 670 | ^ here) |
|
671 | 671 | [255] |
|
672 | 672 | $ fileset "status('2', ' ', added())" |
|
673 | 673 | hg: parse error at 1: not a prefix: end |
|
674 | 674 | ( |
|
675 | 675 | ^ here) |
|
676 | 676 | [255] |
@@ -1,848 +1,848 b'' | |||
|
1 | 1 | $ hg init repo |
|
2 | 2 | $ cd repo |
|
3 | 3 | |
|
4 | 4 | New file: |
|
5 | 5 | |
|
6 | 6 | $ hg import -d "1000000 0" -mnew - <<EOF |
|
7 | 7 | > diff --git a/new b/new |
|
8 | 8 | > new file mode 100644 |
|
9 | 9 | > index 0000000..7898192 |
|
10 | 10 | > --- /dev/null |
|
11 | 11 | > +++ b/new |
|
12 | 12 | > @@ -0,0 +1 @@ |
|
13 | 13 | > +a |
|
14 | 14 | > EOF |
|
15 | 15 | applying patch from stdin |
|
16 | 16 | |
|
17 | 17 | $ hg tip -q |
|
18 | 18 | 0:ae3ee40d2079 |
|
19 | 19 | |
|
20 | 20 | New empty file: |
|
21 | 21 | |
|
22 | 22 | $ hg import -d "1000000 0" -mempty - <<EOF |
|
23 | 23 | > diff --git a/empty b/empty |
|
24 | 24 | > new file mode 100644 |
|
25 | 25 | > EOF |
|
26 | 26 | applying patch from stdin |
|
27 | 27 | |
|
28 | 28 | $ hg tip -q |
|
29 | 29 | 1:ab199dc869b5 |
|
30 | 30 | |
|
31 | 31 | $ hg locate empty |
|
32 | 32 | empty |
|
33 | 33 | |
|
34 | 34 | chmod +x: |
|
35 | 35 | |
|
36 | 36 | $ hg import -d "1000000 0" -msetx - <<EOF |
|
37 | 37 | > diff --git a/new b/new |
|
38 | 38 | > old mode 100644 |
|
39 | 39 | > new mode 100755 |
|
40 | 40 | > EOF |
|
41 | 41 | applying patch from stdin |
|
42 | 42 | |
|
43 | 43 | #if execbit |
|
44 | 44 | $ hg tip -q |
|
45 | 45 | 2:3a34410f282e |
|
46 | 46 | $ test -x new |
|
47 | 47 | $ hg rollback -q |
|
48 | 48 | #else |
|
49 | 49 | $ hg tip -q |
|
50 | 50 | 1:ab199dc869b5 |
|
51 | 51 | #endif |
|
52 | 52 | |
|
53 | 53 | Copy and removing x bit: |
|
54 | 54 | |
|
55 | 55 | $ hg import -f -d "1000000 0" -mcopy - <<EOF |
|
56 | 56 | > diff --git a/new b/copy |
|
57 | 57 | > old mode 100755 |
|
58 | 58 | > new mode 100644 |
|
59 | 59 | > similarity index 100% |
|
60 | 60 | > copy from new |
|
61 | 61 | > copy to copy |
|
62 | 62 | > diff --git a/new b/copyx |
|
63 | 63 | > similarity index 100% |
|
64 | 64 | > copy from new |
|
65 | 65 | > copy to copyx |
|
66 | 66 | > EOF |
|
67 | 67 | applying patch from stdin |
|
68 | 68 | |
|
69 | 69 | $ test -f copy |
|
70 | 70 | #if execbit |
|
71 | 71 | $ test ! -x copy |
|
72 | 72 | $ test -x copyx |
|
73 | 73 | $ hg tip -q |
|
74 | 74 | 2:21dfaae65c71 |
|
75 | 75 | #else |
|
76 | 76 | $ hg tip -q |
|
77 | 77 | 2:0efdaa8e3bf3 |
|
78 | 78 | #endif |
|
79 | 79 | |
|
80 | 80 | $ hg up -qCr1 |
|
81 | 81 | $ hg rollback -q |
|
82 | 82 | |
|
83 | 83 | Copy (like above but independent of execbit): |
|
84 | 84 | |
|
85 | 85 | $ hg import -d "1000000 0" -mcopy - <<EOF |
|
86 | 86 | > diff --git a/new b/copy |
|
87 | 87 | > similarity index 100% |
|
88 | 88 | > copy from new |
|
89 | 89 | > copy to copy |
|
90 | 90 | > diff --git a/new b/copyx |
|
91 | 91 | > similarity index 100% |
|
92 | 92 | > copy from new |
|
93 | 93 | > copy to copyx |
|
94 | 94 | > EOF |
|
95 | 95 | applying patch from stdin |
|
96 | 96 | |
|
97 | 97 | $ hg tip -q |
|
98 | 98 | 2:0efdaa8e3bf3 |
|
99 | 99 | $ test -f copy |
|
100 | 100 | |
|
101 | 101 | $ cat copy |
|
102 | 102 | a |
|
103 | 103 | |
|
104 | 104 | $ hg cat copy |
|
105 | 105 | a |
|
106 | 106 | |
|
107 | 107 | Rename: |
|
108 | 108 | |
|
109 | 109 | $ hg import -d "1000000 0" -mrename - <<EOF |
|
110 | 110 | > diff --git a/copy b/rename |
|
111 | 111 | > similarity index 100% |
|
112 | 112 | > rename from copy |
|
113 | 113 | > rename to rename |
|
114 | 114 | > EOF |
|
115 | 115 | applying patch from stdin |
|
116 | 116 | |
|
117 | 117 | $ hg tip -q |
|
118 | 118 | 3:b1f57753fad2 |
|
119 | 119 | |
|
120 | 120 | $ hg locate |
|
121 | 121 | copyx |
|
122 | 122 | empty |
|
123 | 123 | new |
|
124 | 124 | rename |
|
125 | 125 | |
|
126 | 126 | Delete: |
|
127 | 127 | |
|
128 | 128 | $ hg import -d "1000000 0" -mdelete - <<EOF |
|
129 | 129 | > diff --git a/copyx b/copyx |
|
130 | 130 | > deleted file mode 100755 |
|
131 | 131 | > index 7898192..0000000 |
|
132 | 132 | > --- a/copyx |
|
133 | 133 | > +++ /dev/null |
|
134 | 134 | > @@ -1 +0,0 @@ |
|
135 | 135 | > -a |
|
136 | 136 | > EOF |
|
137 | 137 | applying patch from stdin |
|
138 | 138 | |
|
139 | 139 | $ hg tip -q |
|
140 | 140 | 4:1bd1da94b9b2 |
|
141 | 141 | |
|
142 | 142 | $ hg locate |
|
143 | 143 | empty |
|
144 | 144 | new |
|
145 | 145 | rename |
|
146 | 146 | |
|
147 | 147 | $ test -f copyx |
|
148 | 148 | [1] |
|
149 | 149 | |
|
150 | 150 | Regular diff: |
|
151 | 151 | |
|
152 | 152 | $ hg import -d "1000000 0" -mregular - <<EOF |
|
153 | 153 | > diff --git a/rename b/rename |
|
154 | 154 | > index 7898192..72e1fe3 100644 |
|
155 | 155 | > --- a/rename |
|
156 | 156 | > +++ b/rename |
|
157 | 157 | > @@ -1 +1,5 @@ |
|
158 | 158 | > a |
|
159 | 159 | > +a |
|
160 | 160 | > +a |
|
161 | 161 | > +a |
|
162 | 162 | > +a |
|
163 | 163 | > EOF |
|
164 | 164 | applying patch from stdin |
|
165 | 165 | |
|
166 | 166 | $ hg tip -q |
|
167 | 167 | 5:46fe99cb3035 |
|
168 | 168 | |
|
169 | 169 | Copy and modify: |
|
170 | 170 | |
|
171 | 171 | $ hg import -d "1000000 0" -mcopymod - <<EOF |
|
172 | 172 | > diff --git a/rename b/copy2 |
|
173 | 173 | > similarity index 80% |
|
174 | 174 | > copy from rename |
|
175 | 175 | > copy to copy2 |
|
176 | 176 | > index 72e1fe3..b53c148 100644 |
|
177 | 177 | > --- a/rename |
|
178 | 178 | > +++ b/copy2 |
|
179 | 179 | > @@ -1,5 +1,5 @@ |
|
180 | 180 | > a |
|
181 | 181 | > a |
|
182 | 182 | > -a |
|
183 | 183 | > +b |
|
184 | 184 | > a |
|
185 | 185 | > a |
|
186 | 186 | > EOF |
|
187 | 187 | applying patch from stdin |
|
188 | 188 | |
|
189 | 189 | $ hg tip -q |
|
190 | 190 | 6:ffeb3197c12d |
|
191 | 191 | |
|
192 | 192 | $ hg cat copy2 |
|
193 | 193 | a |
|
194 | 194 | a |
|
195 | 195 | b |
|
196 | 196 | a |
|
197 | 197 | a |
|
198 | 198 | |
|
199 | 199 | Rename and modify: |
|
200 | 200 | |
|
201 | 201 | $ hg import -d "1000000 0" -mrenamemod - <<EOF |
|
202 | 202 | > diff --git a/copy2 b/rename2 |
|
203 | 203 | > similarity index 80% |
|
204 | 204 | > rename from copy2 |
|
205 | 205 | > rename to rename2 |
|
206 | 206 | > index b53c148..8f81e29 100644 |
|
207 | 207 | > --- a/copy2 |
|
208 | 208 | > +++ b/rename2 |
|
209 | 209 | > @@ -1,5 +1,5 @@ |
|
210 | 210 | > a |
|
211 | 211 | > a |
|
212 | 212 | > b |
|
213 | 213 | > -a |
|
214 | 214 | > +c |
|
215 | 215 | > a |
|
216 | 216 | > EOF |
|
217 | 217 | applying patch from stdin |
|
218 | 218 | |
|
219 | 219 | $ hg tip -q |
|
220 | 220 | 7:401aede9e6bb |
|
221 | 221 | |
|
222 | 222 | $ hg locate copy2 |
|
223 | 223 | [1] |
|
224 | 224 | $ hg cat rename2 |
|
225 | 225 | a |
|
226 | 226 | a |
|
227 | 227 | b |
|
228 | 228 | c |
|
229 | 229 | a |
|
230 | 230 | |
|
231 | 231 | One file renamed multiple times: |
|
232 | 232 | |
|
233 | 233 | $ hg import -d "1000000 0" -mmultirenames - <<EOF |
|
234 | 234 | > diff --git a/rename2 b/rename3 |
|
235 | 235 | > rename from rename2 |
|
236 | 236 | > rename to rename3 |
|
237 | 237 | > diff --git a/rename2 b/rename3-2 |
|
238 | 238 | > rename from rename2 |
|
239 | 239 | > rename to rename3-2 |
|
240 | 240 | > EOF |
|
241 | 241 | applying patch from stdin |
|
242 | 242 | |
|
243 | 243 | $ hg tip -q |
|
244 | 244 | 8:2ef727e684e8 |
|
245 | 245 | |
|
246 | 246 | $ hg log -vr. --template '{rev} {files} / {file_copies}\n' |
|
247 | 247 | 8 rename2 rename3 rename3-2 / rename3 (rename2)rename3-2 (rename2) |
|
248 | 248 | |
|
249 | 249 | $ hg locate rename2 rename3 rename3-2 |
|
250 | 250 | rename3 |
|
251 | 251 | rename3-2 |
|
252 | 252 | |
|
253 | 253 | $ hg cat rename3 |
|
254 | 254 | a |
|
255 | 255 | a |
|
256 | 256 | b |
|
257 | 257 | c |
|
258 | 258 | a |
|
259 | 259 | |
|
260 | 260 | $ hg cat rename3-2 |
|
261 | 261 | a |
|
262 | 262 | a |
|
263 | 263 | b |
|
264 | 264 | c |
|
265 | 265 | a |
|
266 | 266 | |
|
267 | 267 | $ echo foo > foo |
|
268 | 268 | $ hg add foo |
|
269 | 269 | $ hg ci -m 'add foo' |
|
270 | 270 | |
|
271 | 271 | Binary files and regular patch hunks: |
|
272 | 272 | |
|
273 | 273 | $ hg import -d "1000000 0" -m binaryregular - <<EOF |
|
274 | 274 | > diff --git a/binary b/binary |
|
275 | 275 | > new file mode 100644 |
|
276 | 276 | > index 0000000000000000000000000000000000000000..593f4708db84ac8fd0f5cc47c634f38c013fe9e4 |
|
277 | 277 | > GIT binary patch |
|
278 | 278 | > literal 4 |
|
279 | 279 | > Lc\${NkU|;|M00aO5 |
|
280 | 280 | > |
|
281 | 281 | > diff --git a/foo b/foo2 |
|
282 | 282 | > rename from foo |
|
283 | 283 | > rename to foo2 |
|
284 | 284 | > EOF |
|
285 | 285 | applying patch from stdin |
|
286 | 286 | |
|
287 | 287 | $ hg tip -q |
|
288 | 288 | 10:27377172366e |
|
289 | 289 | |
|
290 | 290 | $ cat foo2 |
|
291 | 291 | foo |
|
292 | 292 | |
|
293 | 293 | $ hg manifest --debug | grep binary |
|
294 | 294 | 045c85ba38952325e126c70962cc0f9d9077bc67 644 binary |
|
295 | 295 | |
|
296 | 296 | Multiple binary files: |
|
297 | 297 | |
|
298 | 298 | $ hg import -d "1000000 0" -m multibinary - <<EOF |
|
299 | 299 | > diff --git a/mbinary1 b/mbinary1 |
|
300 | 300 | > new file mode 100644 |
|
301 | 301 | > index 0000000000000000000000000000000000000000..593f4708db84ac8fd0f5cc47c634f38c013fe9e4 |
|
302 | 302 | > GIT binary patch |
|
303 | 303 | > literal 4 |
|
304 | 304 | > Lc\${NkU|;|M00aO5 |
|
305 | 305 | > |
|
306 | 306 | > diff --git a/mbinary2 b/mbinary2 |
|
307 | 307 | > new file mode 100644 |
|
308 | 308 | > index 0000000000000000000000000000000000000000..112363ac1917b417ffbd7f376ca786a1e5fa7490 |
|
309 | 309 | > GIT binary patch |
|
310 | 310 | > literal 5 |
|
311 | 311 | > Mc\${NkU|\`?^000jF3jhEB |
|
312 | 312 | > |
|
313 | 313 | > EOF |
|
314 | 314 | applying patch from stdin |
|
315 | 315 | |
|
316 | 316 | $ hg tip -q |
|
317 | 317 | 11:18b73a84b4ab |
|
318 | 318 | |
|
319 | 319 | $ hg manifest --debug | grep mbinary |
|
320 | 320 | 045c85ba38952325e126c70962cc0f9d9077bc67 644 mbinary1 |
|
321 | 321 | a874b471193996e7cb034bb301cac7bdaf3e3f46 644 mbinary2 |
|
322 | 322 | |
|
323 | 323 | Binary file and delta hunk (we build the patch using this sed hack to |
|
324 | 324 | avoid an unquoted ^, which check-code says breaks sh on Solaris): |
|
325 | 325 | |
|
326 | 326 | $ sed 's/ caret /^/g;s/ dollarparen /$(/g' > quote-hack.patch <<'EOF' |
|
327 | 327 | > diff --git a/delta b/delta |
|
328 | 328 | > new file mode 100644 |
|
329 | 329 | > index 0000000000000000000000000000000000000000..8c9b7831b231c2600843e303e66b521353a200b3 |
|
330 | 330 | > GIT binary patch |
|
331 | 331 | > literal 3749 |
|
332 | 332 | > zcmV;W4qEYvP)<h;3K|Lk000e1NJLTq006iE002D*0ssI2kt{U(0000PbVXQnQ*UN; |
|
333 | 333 | > zcVTj606}DLVr3vnZDD6+Qe|Oed2z{QJOBU=M@d9MRCwC#oC!>o#}>x{(W-y~UN*tK |
|
334 | 334 | > z%A%sxiUy2Ys)0Vm#ueArYKoYqX;GuiqZpgirM6nCVoYk?YNAz3G~z;BZ~@~&OQEe4 |
|
335 | 335 | > zmGvS5isFJI;Pd_7J+EKxyHZeu` caret t4r2>F;h-+VK3{_{WoGv8dSpFDYDrA%3UX03pt |
|
336 | 336 | > zOaVoi0*W#P6lDr1$`nwPDWE7*rhuYM0Y#YtiZTThWeO<D6i}2YpqR<%$s>bRRaI42 |
|
337 | 337 | > zS3iFIxJ8Q=EnBv1Z7?pBw_bLjJb3V+tgP(Tty_2R-mR#p04x78n2n7MSOFyt4i1iv |
|
338 | 338 | > zjxH`PPEJmgD7U?IK&h;(EGQ@_DJc<@01=4fiNXHcKZ8LhZQ8T}E3U4tUS3}OrcgQW |
|
339 | 339 | > zWdX{K8#l7Ev&#$ysR)G#0*rC+<WGZ3?CtG4bm-ve>Dj$|_qJ`@D*stNP_AFUe&x!Q |
|
340 | 340 | > zJ9q9B7Z=ym)MyZ?Tg1ROunUYr81nV?B@!tYS~5_|%gfW#(_s<4UN1!Q?Dv8d>g#m6 |
|
341 | 341 | > z%*@R2@bI2JdnzxQ!EDU`$eQY!tgI~Zn$prz;gaXNod5*5p(1Bz=P$qfvZ$y?dC@X~ |
|
342 | 342 | > zlAD+NAKhB{=;6bMwzjqn>9mavvKOGd`s%A+fBiL>Q;xJWpa72C+}u{JTHUX>{~}Qj |
|
343 | 343 | > zUb%hyHgN~c?cBLjInvUALMD9g-aXt54ZL8AOCvXL-V6!~ijR*kEG$&Mv?!pE61OlI |
|
344 | 344 | > z8nzMSPE8F7bH|Py*RNl1VUCggq<V)>@_6gkEeiz7{rmTeuNTW6+KVS#0FG%IHf-3L |
|
345 | 345 | > zGiS21vn>WCCr+GLx caret !uNetzB6u3o(w6&1C2?_LW8ij$+$sZ*zZ`|US3H@8N~%&V%Z |
|
346 | 346 | > zAeA0HdhFS=$6|nzn3%YH`SN<>DQRO;Qc caret )dfdvA caret 5u`Xf;Zzu<ZQHgG?28V-#s<;T |
|
347 | 347 | > zzkh#LA)v7gpoE5ou3o*GoUUF%b#iht&kl9d0)><$FE1}ACr68;uCA`6DrGmz_U+rp |
|
348 | 348 | > zL>Rx;X_yhk$fP_yJrTCQ|NgsW0A<985g&c@k-NKly<>mgU8n||ZPPV<`SN8#%$+-T |
|
349 | 349 | > zfP$T!ou8jypFVwnzqhxyUvIxXd-wF~*U!ht=hCH1wzjqn9x#)IrhDa;S0JbK caret z_$W |
|
350 | 350 | > zd(8rX@;7|t*;GJ5h$SZ{v(}+UBEs$4w~?{@9%`_Z<P<kox5bMWuUWH(sF9hONgd$Q |
|
351 | 351 | > zunCgwT@1|CU9+;X caret 4z&|M~@yw23Ay50NFWn=FqF%yLZEUty;AT2??1oV@B)Nt))J7 |
|
352 | 352 | > zh>{5j2@f7T=-an%L_`E)h;mZ4D_5>?7tjQtVPRo2XU-&;mX(!l-MSTJP4XWY82JAC |
|
353 | 353 | > z@57+y&!1=P{Mn{W8)-HzEsgAtd63}Cazc>O6vGb>51%@9DzbyI3?4j~$ijmT95_IS |
|
354 | 354 | > zS#r!LCDW%*4-O7CGnkr$xXR1RQ&UrA<CQt} caret 73NL%zk`)Jk!yxUAt-1r}ggLn-Zq} |
|
355 | 355 | > z*s){8pw68;i+kiG%CpBKYSJLLFyq&*U8}qDp+kpe&6<Vp(Z58%l#~>ZK?&s7y?b}i |
|
356 | 356 | > zuwcOgO%x-27A;y785zknl_{sU;E6v$8{pWmVS{KaJPpu`i;HP$#flY@u~Ua~K3%tN |
|
357 | 357 | > z-LhrNh{9SoHgDd%WXTc$$~Dq{?AWou3!H&?V8K{ caret {P9Ot5vecD?%1&-E-ntBFj87( |
|
358 | 358 | > zy5`QE%QRX7qcHC%1{Ua}M~}L6=`wQUNEQ=I;qc+ZMMXtK2T+0os;jEco;}OV9z1w3 |
|
359 | 359 | > zARqv caret bm-85xnRCng3OT|MyVSmR3ND7 caret ?KaQGG! caret (aTbo1N;Nz;X3Q9FJbwK6`0?Yp |
|
360 | 360 | > zj*X2ac;Pw3!I2|JShDaF>-gJmzm1NLj){rk&o|$E caret WAsfrK=x&@B!`w7Hik81sPz4 |
|
361 | 361 | > zuJTaiCppM>-+c!wPzcUw)5@?J4U-u|pJ~xbWUe-C+60k caret 7>9!)56DbjmA~`OJJ40v |
|
362 | 362 | > zu3hCA7eJXZWeN|1iJLu87$;+fS8+Kq6O`aT)*_x@sY#t7LxwoEcVw*)cWhhQW@l%! |
|
363 | 363 | > z{#Z=y+qcK@%z{p*D=8_Fcg278AnH3fI5;~yGu?9TscxXaaP*4$f<LIv! caret 5Lfr%vKg |
|
364 | 364 | > zpxmunH#%=+ICMvZA~wyNH%~eMl!-g caret R!cYJ#WmLq5N8viz#J%%LPtkO?V)tZ81cp> |
|
365 | 365 | > z{ALK?fNPePmd;289&M8Q3>YwgZX5GcGY&n>K1<x)!`;Qjg&}bb!Lrnl@xH#kS~VYE |
|
366 | 366 | > zpJmIJO`A3iy+Y3X`k>cY-@}Iw2Onq`=!ba3eATgs3yg3Wej=+P-Z8WF#w=RXvS@J3 |
|
367 | 367 | > zEyhVTj-gO?kfDu1g9afo<RkPrYzG#_yF41IFxF%Ylg>9lx6<clPweR-b7Hn+r)e1l |
|
368 | 368 | > zO6c6FbNt@;;*w$z;N|H>h{czme)_4V6UC4hv**kX2@L caret Bgds dollarparen &P7M4dhfmWe)!=B |
|
369 | 369 | > zR3X=Y{P9N}p@-##@1ZNW1YbVaiP~D@8m&<dzEP&cO|87Ju#j*=;wH~Exr>i*Hpp&@ |
|
370 | 370 | > z`9!Sj+O;byD~s8qZ>6QB8uv7Bpn&&?xe;;e<M4F8KEID&pT7QmqoSgq&06adp5T=U |
|
371 | 371 | > z6DH*4=AB7C1D9Amu?ia-wtxSAlmTEO96XHx)-+rKP;ip$pukuSJGW3P1aUmc2yo%) |
|
372 | 372 | > z&<t3F>d1X+1qzaag-%x+eKHx{?Afz3GBQSw9u0lw<mB+I#v11TKRpKWQS+lvVL7=u |
|
373 | 373 | > zHr6)1ynEF<i3kO6A8&ppPMo-F=PnWfXkSj@i*7J6C<F}wR?s(O0niC?t+6;+k}pPq |
|
374 | 374 | > zrok&TPU40rL0ZYDwenNrrmPZ`gjo@DEF`7 caret cKP||pUr;+r)hyn9O37=xA`3%Bj-ih |
|
375 | 375 | > z+1usk<%5G-y+R?tA`qY=)6&vNjL{P?QzHg%P%>`ZxP=QB%DHY6L26?36V_p caret {}n$q |
|
376 | 376 | > z3@9W=KmGI*Ng_Q#AzA%-z|Z caret |#oW(hkfgpuS$RKRhlrarX%efMMCs}GLChec5+y{6 |
|
377 | 377 | > z1Qnxim_C-fmQuaAK_NUHUBV&;1c0V)wji<RcdZ*aAWTwyt>hVnlt caret asFCe0&a@tqp |
|
378 | 378 | > zEEy;$L}D$X6)wfQNl8gu6Z>oB3_RrP=gTyK2@@w#LbQfLNHj>Q&z(C5wUFhK+}0aV |
|
379 | 379 | > zSohlc=7K+spN<ctf}5KgKqNyJDNP9;LZd)nTE=9|6Xdr9%Hzk63-tL2c9FD*rsyYY |
|
380 | 380 | > z!}t+Yljq7-p$X;4_YL?6d;mdY3R##o1e%rlPxrsMh8|;sKTr~ caret QD#sw3&vS$FwlTk |
|
381 | 381 | > zp1#Gw!Qo-$LtvpXt#ApV0g) caret F=qFB`VB!W297x=$mr<$>rco3v$QKih_xN!k6;M=@ |
|
382 | 382 | > zCr?gDNQj7tm@;JwD;Ty&NlBSCYZk(b3dZeN8D4h2{r20dSFc7;(>E&r`s=TVtzpB4 |
|
383 | 383 | > zk+ caret N&zCAiRns(?p6iBlk9v&h{1ve(FNtc)td51M>)TkXhc6{>5C)`fS$&)A1*CP1% |
|
384 | 384 | > zld+peue4aYbg3C0!+4mu+}vE caret j_feX+ZijvffBI7Ofh#RZ*U3<3J5(+nfRCzexqQ5 |
|
385 | 385 | > zgM&##Y4Dd{e%ZKjqrbm@|Ni}l4jo!AqtFynj3Xsd$o caret ?yV4$|UQ(j&UWCH>M=o_&N |
|
386 | 386 | > zmclXc3i|Q#<;#EoG>~V}4unTHbUK}u=y4;rA3S&vzC3 caret aJP!&D4RvvGfoyo(>C>la |
|
387 | 387 | > zijP<=v>X{3Ne&2BXo}DV8l0V-jdv`$am0ubG{Wuh%CTd|l9Q7m;G&|U@#Dvbhlj(d |
|
388 | 388 | > zg6W{3ATxYt#T?)3;SmIgOP4M|Dki~I_TX7SxP0x}wI~DQI7Lhm2BI7gph(aPIFAd; |
|
389 | 389 | > zQ&UsF`Q{rOz+z=87c5v%@5u~d6dWV5OlX`oH3cAH&UlvsZUEo(Q(P|lKs17rXvaiU |
|
390 | 390 | > zQcj}IEufi1+Bnh6&(EhF{7O3vLHp`jjlp0J<M1kh$+$2xGm~Zk7OY7(q=&Rdhq*RG |
|
391 | 391 | > zwrmcd5MnP}xByB_)P@{J>DR9x6;`cUwPM8z){yooNiXPOc9_{W-gtwxE5TUg0vJk6 |
|
392 | 392 | > zO#JGruV&1cL6VGK2?+_YQr4`+EY8;Sm$9U$uuGRN=uj3k7?O9b+R~J7t_y*K64ZnI |
|
393 | 393 | > zM+{aE<b(v?vSmw;9zFP!aE266zHIhlmdI@ caret xa6o2jwdRk54a$>pcRbC29ZyG!Cfdp |
|
394 | 394 | > zutFf`Q`vljgo!(wHf=)F#m2_MIuj;L(2ja2YsQRX+rswV{d<H`Ar;(@%aNa9VPU8Z |
|
395 | 395 | > z;tq*`y}dm#NDJHKlV}uTIm!_vAq5E7!X-p{P=Z=Sh668>PuVS1*6e}OwOiMc;u3OQ |
|
396 | 396 | > z@Bs)w3=lzfKoufH$SFuPG@uZ4NOnM#+=8LnQ2Q4zUd+nM+OT26;lqbN{P07dhH{jH |
|
397 | 397 | > zManE8 caret dLms-Q2;1kB<*Q1a3f8kZr;xX=!Qro@`~@xN*Qj>gx;i;0Z24!~i2uLb`}v |
|
398 | 398 | > zA?R$|wvC+m caret Ups=*(4lDh*=UN8{5h(A?p#D caret 2N$8u4Z55!q?ZAh(iEEng9_Zi>IgO |
|
399 | 399 | > z#~**JC8hE4@n{hO&8btT5F*?nC_%LhA3i)PDhh-pB_&1wGrDIl caret *=8x3n&;akBf caret - |
|
400 | 400 | > zJd&86kq$%%907v caret tgWoQdwI`|oNK%VvU~S#C<o caret F?6c48?Cjj#-4P<>HFD%&|Ni~t |
|
401 | 401 | > zKJ(|#H`$<5W+6ZkBb213rXonKZLB+X> caret L}J@W6osP3piLD_5?R!`S}*{xLBzFiL4@ |
|
402 | 402 | > zX+}l{`A%?f@T5tT%ztu60p;)be`fWC`tP@WpO=?cpf8Xuf1OSj6d3f@Ki(ovDYq%0 |
|
403 | 403 | > z{4ZSe`kOay5@=lAT!}vFzxyemC{sXDrhuYM0Y#ZI1r%ipD9W11{w=@&xgJ}t2x;ep |
|
404 | 404 | > P00000NkvXXu0mjfZ5|Er |
|
405 | 405 | > |
|
406 | 406 | > literal 0 |
|
407 | 407 | > HcmV?d00001 |
|
408 | 408 | > |
|
409 | 409 | > EOF |
|
410 | 410 | $ hg import -d "1000000 0" -m delta quote-hack.patch |
|
411 | 411 | applying quote-hack.patch |
|
412 | 412 | $ rm quote-hack.patch |
|
413 | 413 | |
|
414 | 414 | $ hg manifest --debug | grep delta |
|
415 | 415 | 9600f98bb60ce732634d126aaa4ac1ec959c573e 644 delta |
|
416 | 416 | |
|
417 | 417 | $ hg import -d "1000000 0" -m delta - <<'EOF' |
|
418 | 418 | > diff --git a/delta b/delta |
|
419 | 419 | > index 8c9b7831b231c2600843e303e66b521353a200b3..0021dd95bc0dba53c39ce81377126d43731d68df 100644 |
|
420 | 420 | > GIT binary patch |
|
421 | 421 | > delta 49 |
|
422 | 422 | > zcmZ1~yHs|=21Z8J$r~9bFdA-lVv=EEw4WT$qRf2QSa5SIOAHI6(&k4T8H|kLo4vWB |
|
423 | 423 | > FSO9ZT4bA`n |
|
424 | 424 | > |
|
425 | 425 | > delta 49 |
|
426 | 426 | > zcmV-10M7rV9i<(xumJ(}ld%Di0Xefm0vrMXpOaq%BLm9I%d>?9Tm%6Vv*HM70RcC& |
|
427 | 427 | > HOA1;9yU-AD |
|
428 | 428 | > |
|
429 | 429 | > EOF |
|
430 | 430 | applying patch from stdin |
|
431 | 431 | |
|
432 | 432 | $ hg manifest --debug | grep delta |
|
433 | 433 | 56094bbea136dcf8dbd4088f6af469bde1a98b75 644 delta |
|
434 | 434 | |
|
435 | 435 | Filenames with spaces: |
|
436 | 436 | |
|
437 | 437 | $ sed 's,EOL$,,g' <<EOF | hg import -d "1000000 0" -m spaces - |
|
438 | 438 | > diff --git a/foo bar b/foo bar |
|
439 | 439 | > new file mode 100644 |
|
440 | 440 | > index 0000000..257cc56 |
|
441 | 441 | > --- /dev/null |
|
442 | 442 | > +++ b/foo bar EOL |
|
443 | 443 | > @@ -0,0 +1 @@ |
|
444 | 444 | > +foo |
|
445 | 445 | > EOF |
|
446 | 446 | applying patch from stdin |
|
447 | 447 | |
|
448 | 448 | $ hg tip -q |
|
449 | 449 | 14:4b79479c9a6d |
|
450 | 450 | |
|
451 | 451 | $ cat "foo bar" |
|
452 | 452 | foo |
|
453 | 453 | |
|
454 | 454 | Copy then modify the original file: |
|
455 | 455 | |
|
456 | 456 | $ hg import -d "1000000 0" -m copy-mod-orig - <<EOF |
|
457 | 457 | > diff --git a/foo2 b/foo2 |
|
458 | 458 | > index 257cc56..fe08ec6 100644 |
|
459 | 459 | > --- a/foo2 |
|
460 | 460 | > +++ b/foo2 |
|
461 | 461 | > @@ -1 +1,2 @@ |
|
462 | 462 | > foo |
|
463 | 463 | > +new line |
|
464 | 464 | > diff --git a/foo2 b/foo3 |
|
465 | 465 | > similarity index 100% |
|
466 | 466 | > copy from foo2 |
|
467 | 467 | > copy to foo3 |
|
468 | 468 | > EOF |
|
469 | 469 | applying patch from stdin |
|
470 | 470 | |
|
471 | 471 | $ hg tip -q |
|
472 | 472 | 15:9cbe44af4ae9 |
|
473 | 473 | |
|
474 | 474 | $ cat foo3 |
|
475 | 475 | foo |
|
476 | 476 | |
|
477 | 477 | Move text file and patch as binary |
|
478 | 478 | |
|
479 | 479 | $ echo a > text2 |
|
480 | 480 | $ hg ci -Am0 |
|
481 | 481 | adding text2 |
|
482 | 482 | $ hg import -d "1000000 0" -m rename-as-binary - <<"EOF" |
|
483 | 483 | > diff --git a/text2 b/binary2 |
|
484 | 484 | > rename from text2 |
|
485 | 485 | > rename to binary2 |
|
486 | 486 | > index 78981922613b2afb6025042ff6bd878ac1994e85..10efcb362e9f3b3420fcfbfc0e37f3dc16e29757 |
|
487 | 487 | > GIT binary patch |
|
488 | 488 | > literal 5 |
|
489 | 489 | > Mc$`b*O5$Pw00T?_*Z=?k |
|
490 | 490 | > |
|
491 | 491 | > EOF |
|
492 | 492 | applying patch from stdin |
|
493 | 493 | |
|
494 | 494 | $ cat binary2 |
|
495 | 495 | a |
|
496 | 496 | b |
|
497 | 497 | \x00 (no-eol) (esc) |
|
498 | 498 | |
|
499 | 499 | $ hg st --copies --change . |
|
500 | 500 | A binary2 |
|
501 | 501 | text2 |
|
502 | 502 | R text2 |
|
503 | 503 | |
|
504 | 504 | Invalid base85 content |
|
505 | 505 | |
|
506 | 506 | $ hg rollback |
|
507 | 507 | repository tip rolled back to revision 16 (undo import) |
|
508 | 508 | working directory now based on revision 16 |
|
509 | 509 | $ hg revert -aq |
|
510 | 510 | $ hg import -d "1000000 0" -m invalid-binary - <<"EOF" |
|
511 | 511 | > diff --git a/text2 b/binary2 |
|
512 | 512 | > rename from text2 |
|
513 | 513 | > rename to binary2 |
|
514 | 514 | > index 78981922613b2afb6025042ff6bd878ac1994e85..10efcb362e9f3b3420fcfbfc0e37f3dc16e29757 |
|
515 | 515 | > GIT binary patch |
|
516 | 516 | > literal 5 |
|
517 | 517 | > Mc$`b*O.$Pw00T?_*Z=?k |
|
518 | 518 | > |
|
519 | 519 | > EOF |
|
520 | 520 | applying patch from stdin |
|
521 | 521 | abort: could not decode "binary2" binary patch: bad base85 character at position 6 |
|
522 | 522 | [255] |
|
523 | 523 | |
|
524 | 524 | $ hg revert -aq |
|
525 | 525 | $ hg import -d "1000000 0" -m rename-as-binary - <<"EOF" |
|
526 | 526 | > diff --git a/text2 b/binary2 |
|
527 | 527 | > rename from text2 |
|
528 | 528 | > rename to binary2 |
|
529 | 529 | > index 78981922613b2afb6025042ff6bd878ac1994e85..10efcb362e9f3b3420fcfbfc0e37f3dc16e29757 |
|
530 | 530 | > GIT binary patch |
|
531 | 531 | > literal 6 |
|
532 | 532 | > Mc$`b*O5$Pw00T?_*Z=?k |
|
533 | 533 | > |
|
534 | 534 | > EOF |
|
535 | 535 | applying patch from stdin |
|
536 | 536 | abort: "binary2" length is 5 bytes, should be 6 |
|
537 | 537 | [255] |
|
538 | 538 | |
|
539 | 539 | $ hg revert -aq |
|
540 | 540 | $ hg import -d "1000000 0" -m rename-as-binary - <<"EOF" |
|
541 | 541 | > diff --git a/text2 b/binary2 |
|
542 | 542 | > rename from text2 |
|
543 | 543 | > rename to binary2 |
|
544 | 544 | > index 78981922613b2afb6025042ff6bd878ac1994e85..10efcb362e9f3b3420fcfbfc0e37f3dc16e29757 |
|
545 | 545 | > GIT binary patch |
|
546 | 546 | > Mc$`b*O5$Pw00T?_*Z=?k |
|
547 | 547 | > |
|
548 | 548 | > EOF |
|
549 | 549 | applying patch from stdin |
|
550 | 550 | abort: could not extract "binary2" binary data |
|
551 | 551 | [255] |
|
552 | 552 | |
|
553 | 553 | Simulate a copy/paste turning LF into CRLF (issue2870) |
|
554 | 554 | |
|
555 | 555 | $ hg revert -aq |
|
556 | 556 | $ cat > binary.diff <<"EOF" |
|
557 | 557 | > diff --git a/text2 b/binary2 |
|
558 | 558 | > rename from text2 |
|
559 | 559 | > rename to binary2 |
|
560 | 560 | > index 78981922613b2afb6025042ff6bd878ac1994e85..10efcb362e9f3b3420fcfbfc0e37f3dc16e29757 |
|
561 | 561 | > GIT binary patch |
|
562 | 562 | > literal 5 |
|
563 | 563 | > Mc$`b*O5$Pw00T?_*Z=?k |
|
564 | 564 | > |
|
565 | 565 | > EOF |
|
566 | 566 | >>> fp = open('binary.diff', 'rb') |
|
567 | 567 | >>> data = fp.read() |
|
568 | 568 | >>> fp.close() |
|
569 | >>> open('binary.diff', 'wb').write(data.replace(b'\n', b'\r\n')) | |
|
569 | >>> open('binary.diff', 'wb').write(data.replace(b'\n', b'\r\n')) and None | |
|
570 | 570 |
$ |
|
571 | 571 | $ hg import --no-commit binary.diff |
|
572 | 572 | applying binary.diff |
|
573 | 573 | |
|
574 | 574 | $ cd .. |
|
575 | 575 | |
|
576 | 576 | Consecutive import with renames (issue2459) |
|
577 | 577 | |
|
578 | 578 | $ hg init issue2459 |
|
579 | 579 | $ cd issue2459 |
|
580 | 580 | $ hg import --no-commit --force - <<EOF |
|
581 | 581 | > diff --git a/a b/a |
|
582 | 582 | > new file mode 100644 |
|
583 | 583 | > EOF |
|
584 | 584 | applying patch from stdin |
|
585 | 585 | $ hg import --no-commit --force - <<EOF |
|
586 | 586 | > diff --git a/a b/b |
|
587 | 587 | > rename from a |
|
588 | 588 | > rename to b |
|
589 | 589 | > EOF |
|
590 | 590 | applying patch from stdin |
|
591 | 591 | a has not been committed yet, so no copy data will be stored for b. |
|
592 | 592 | $ hg debugstate |
|
593 | 593 | a 0 -1 unset b |
|
594 | 594 | $ hg ci -m done |
|
595 | 595 | $ cd .. |
|
596 | 596 | |
|
597 | 597 | Renames and strip |
|
598 | 598 | |
|
599 | 599 | $ hg init renameandstrip |
|
600 | 600 | $ cd renameandstrip |
|
601 | 601 | $ echo a > a |
|
602 | 602 | $ hg ci -Am adda |
|
603 | 603 | adding a |
|
604 | 604 | $ hg import --no-commit -p2 - <<EOF |
|
605 | 605 | > diff --git a/foo/a b/foo/b |
|
606 | 606 | > rename from foo/a |
|
607 | 607 | > rename to foo/b |
|
608 | 608 | > EOF |
|
609 | 609 | applying patch from stdin |
|
610 | 610 | $ hg st --copies |
|
611 | 611 | A b |
|
612 | 612 | a |
|
613 | 613 | R a |
|
614 | 614 | |
|
615 | 615 | Prefix with strip, renames, creates etc |
|
616 | 616 | |
|
617 | 617 | $ hg revert -aC |
|
618 | 618 | undeleting a |
|
619 | 619 | forgetting b |
|
620 | 620 | $ rm b |
|
621 | 621 | $ mkdir -p dir/dir2 |
|
622 | 622 | $ echo b > dir/dir2/b |
|
623 | 623 | $ echo c > dir/dir2/c |
|
624 | 624 | $ echo d > dir/d |
|
625 | 625 | $ hg ci -Am addbcd |
|
626 | 626 | adding dir/d |
|
627 | 627 | adding dir/dir2/b |
|
628 | 628 | adding dir/dir2/c |
|
629 | 629 | |
|
630 | 630 | prefix '.' is the same as no prefix |
|
631 | 631 | $ hg import --no-commit --prefix . - <<EOF |
|
632 | 632 | > diff --git a/dir/a b/dir/a |
|
633 | 633 | > --- /dev/null |
|
634 | 634 | > +++ b/dir/a |
|
635 | 635 | > @@ -0,0 +1 @@ |
|
636 | 636 | > +aaaa |
|
637 | 637 | > diff --git a/dir/d b/dir/d |
|
638 | 638 | > --- a/dir/d |
|
639 | 639 | > +++ b/dir/d |
|
640 | 640 | > @@ -1,1 +1,2 @@ |
|
641 | 641 | > d |
|
642 | 642 | > +dddd |
|
643 | 643 | > EOF |
|
644 | 644 | applying patch from stdin |
|
645 | 645 | $ cat dir/a |
|
646 | 646 | aaaa |
|
647 | 647 | $ cat dir/d |
|
648 | 648 | d |
|
649 | 649 | dddd |
|
650 | 650 | $ hg revert -aC |
|
651 | 651 | forgetting dir/a |
|
652 | 652 | reverting dir/d |
|
653 | 653 | $ rm dir/a |
|
654 | 654 | |
|
655 | 655 | prefix with default strip |
|
656 | 656 | $ hg import --no-commit --prefix dir/ - <<EOF |
|
657 | 657 | > diff --git a/a b/a |
|
658 | 658 | > --- /dev/null |
|
659 | 659 | > +++ b/a |
|
660 | 660 | > @@ -0,0 +1 @@ |
|
661 | 661 | > +aaa |
|
662 | 662 | > diff --git a/d b/d |
|
663 | 663 | > --- a/d |
|
664 | 664 | > +++ b/d |
|
665 | 665 | > @@ -1,1 +1,2 @@ |
|
666 | 666 | > d |
|
667 | 667 | > +dd |
|
668 | 668 | > EOF |
|
669 | 669 | applying patch from stdin |
|
670 | 670 | $ cat dir/a |
|
671 | 671 | aaa |
|
672 | 672 | $ cat dir/d |
|
673 | 673 | d |
|
674 | 674 | dd |
|
675 | 675 | $ hg revert -aC |
|
676 | 676 | forgetting dir/a |
|
677 | 677 | reverting dir/d |
|
678 | 678 | $ rm dir/a |
|
679 | 679 | (test that prefixes are relative to the cwd) |
|
680 | 680 | $ mkdir tmpdir |
|
681 | 681 | $ cd tmpdir |
|
682 | 682 | $ hg import --no-commit -p2 --prefix ../dir/ - <<EOF |
|
683 | 683 | > diff --git a/foo/a b/foo/a |
|
684 | 684 | > new file mode 100644 |
|
685 | 685 | > --- /dev/null |
|
686 | 686 | > +++ b/foo/a |
|
687 | 687 | > @@ -0,0 +1 @@ |
|
688 | 688 | > +a |
|
689 | 689 | > diff --git a/foo/dir2/b b/foo/dir2/b2 |
|
690 | 690 | > rename from foo/dir2/b |
|
691 | 691 | > rename to foo/dir2/b2 |
|
692 | 692 | > diff --git a/foo/dir2/c b/foo/dir2/c |
|
693 | 693 | > --- a/foo/dir2/c |
|
694 | 694 | > +++ b/foo/dir2/c |
|
695 | 695 | > @@ -0,0 +1 @@ |
|
696 | 696 | > +cc |
|
697 | 697 | > diff --git a/foo/d b/foo/d |
|
698 | 698 | > deleted file mode 100644 |
|
699 | 699 | > --- a/foo/d |
|
700 | 700 | > +++ /dev/null |
|
701 | 701 | > @@ -1,1 +0,0 @@ |
|
702 | 702 | > -d |
|
703 | 703 | > EOF |
|
704 | 704 | applying patch from stdin |
|
705 | 705 | $ hg st --copies |
|
706 | 706 | M dir/dir2/c |
|
707 | 707 | A dir/a |
|
708 | 708 | A dir/dir2/b2 |
|
709 | 709 | dir/dir2/b |
|
710 | 710 | R dir/d |
|
711 | 711 | R dir/dir2/b |
|
712 | 712 | $ cd .. |
|
713 | 713 | |
|
714 | 714 | Renames, similarity and git diff |
|
715 | 715 | |
|
716 | 716 | $ hg revert -aC |
|
717 | 717 | forgetting dir/a |
|
718 | 718 | undeleting dir/d |
|
719 | 719 | undeleting dir/dir2/b |
|
720 | 720 | forgetting dir/dir2/b2 |
|
721 | 721 | reverting dir/dir2/c |
|
722 | 722 | $ rm dir/a dir/dir2/b2 |
|
723 | 723 | $ hg import --similarity 90 --no-commit - <<EOF |
|
724 | 724 | > diff --git a/a b/b |
|
725 | 725 | > rename from a |
|
726 | 726 | > rename to b |
|
727 | 727 | > EOF |
|
728 | 728 | applying patch from stdin |
|
729 | 729 | $ hg st --copies |
|
730 | 730 | A b |
|
731 | 731 | a |
|
732 | 732 | R a |
|
733 | 733 | $ cd .. |
|
734 | 734 | |
|
735 | 735 | Pure copy with existing destination |
|
736 | 736 | |
|
737 | 737 | $ hg init copytoexisting |
|
738 | 738 | $ cd copytoexisting |
|
739 | 739 | $ echo a > a |
|
740 | 740 | $ echo b > b |
|
741 | 741 | $ hg ci -Am add |
|
742 | 742 | adding a |
|
743 | 743 | adding b |
|
744 | 744 | $ hg import --no-commit - <<EOF |
|
745 | 745 | > diff --git a/a b/b |
|
746 | 746 | > copy from a |
|
747 | 747 | > copy to b |
|
748 | 748 | > EOF |
|
749 | 749 | applying patch from stdin |
|
750 | 750 | abort: cannot create b: destination already exists |
|
751 | 751 | [255] |
|
752 | 752 | $ cat b |
|
753 | 753 | b |
|
754 | 754 | |
|
755 | 755 | Copy and changes with existing destination |
|
756 | 756 | |
|
757 | 757 | $ hg import --no-commit - <<EOF |
|
758 | 758 | > diff --git a/a b/b |
|
759 | 759 | > copy from a |
|
760 | 760 | > copy to b |
|
761 | 761 | > --- a/a |
|
762 | 762 | > +++ b/b |
|
763 | 763 | > @@ -1,1 +1,2 @@ |
|
764 | 764 | > a |
|
765 | 765 | > +b |
|
766 | 766 | > EOF |
|
767 | 767 | applying patch from stdin |
|
768 | 768 | cannot create b: destination already exists |
|
769 | 769 | 1 out of 1 hunks FAILED -- saving rejects to file b.rej |
|
770 | 770 | abort: patch failed to apply |
|
771 | 771 | [255] |
|
772 | 772 | $ cat b |
|
773 | 773 | b |
|
774 | 774 | |
|
775 | 775 | #if symlink |
|
776 | 776 | |
|
777 | 777 | $ ln -s b linkb |
|
778 | 778 | $ hg add linkb |
|
779 | 779 | $ hg ci -m addlinkb |
|
780 | 780 | $ hg import --no-commit - <<EOF |
|
781 | 781 | > diff --git a/linkb b/linkb |
|
782 | 782 | > deleted file mode 120000 |
|
783 | 783 | > --- a/linkb |
|
784 | 784 | > +++ /dev/null |
|
785 | 785 | > @@ -1,1 +0,0 @@ |
|
786 | 786 | > -badhunk |
|
787 | 787 | > \ No newline at end of file |
|
788 | 788 | > EOF |
|
789 | 789 | applying patch from stdin |
|
790 | 790 | patching file linkb |
|
791 | 791 | Hunk #1 FAILED at 0 |
|
792 | 792 | 1 out of 1 hunks FAILED -- saving rejects to file linkb.rej |
|
793 | 793 | abort: patch failed to apply |
|
794 | 794 | [255] |
|
795 | 795 | $ hg st |
|
796 | 796 | ? b.rej |
|
797 | 797 | ? linkb.rej |
|
798 | 798 | |
|
799 | 799 | #endif |
|
800 | 800 | |
|
801 | 801 | Test corner case involving copies and multiple hunks (issue3384) |
|
802 | 802 | |
|
803 | 803 | $ hg revert -qa |
|
804 | 804 | $ hg import --no-commit - <<EOF |
|
805 | 805 | > diff --git a/a b/c |
|
806 | 806 | > copy from a |
|
807 | 807 | > copy to c |
|
808 | 808 | > --- a/a |
|
809 | 809 | > +++ b/c |
|
810 | 810 | > @@ -1,1 +1,2 @@ |
|
811 | 811 | > a |
|
812 | 812 | > +a |
|
813 | 813 | > @@ -2,1 +2,2 @@ |
|
814 | 814 | > a |
|
815 | 815 | > +a |
|
816 | 816 | > diff --git a/a b/a |
|
817 | 817 | > --- a/a |
|
818 | 818 | > +++ b/a |
|
819 | 819 | > @@ -1,1 +1,2 @@ |
|
820 | 820 | > a |
|
821 | 821 | > +b |
|
822 | 822 | > EOF |
|
823 | 823 | applying patch from stdin |
|
824 | 824 | |
|
825 | 825 | Test email metadata |
|
826 | 826 | |
|
827 | 827 | $ hg revert -qa |
|
828 | 828 | $ hg --encoding utf-8 import - <<EOF |
|
829 | 829 | > From: =?UTF-8?q?Rapha=C3=ABl=20Hertzog?= <hertzog@debian.org> |
|
830 | 830 | > Subject: [PATCH] =?UTF-8?q?=C5=A7=E2=82=AC=C3=9F=E1=B9=AA?= |
|
831 | 831 | > |
|
832 | 832 | > diff --git a/a b/a |
|
833 | 833 | > --- a/a |
|
834 | 834 | > +++ b/a |
|
835 | 835 | > @@ -1,1 +1,2 @@ |
|
836 | 836 | > a |
|
837 | 837 | > +a |
|
838 | 838 | > EOF |
|
839 | 839 | applying patch from stdin |
|
840 | 840 | $ hg --encoding utf-8 log -r . |
|
841 | 841 | changeset: *:* (glob) |
|
842 | 842 | tag: tip |
|
843 | 843 | user: Rapha\xc3\xabl Hertzog <hertzog@debian.org> (esc) |
|
844 | 844 | date: * (glob) |
|
845 | 845 | summary: \xc5\xa7\xe2\x82\xac\xc3\x9f\xe1\xb9\xaa (esc) |
|
846 | 846 | |
|
847 | 847 | |
|
848 | 848 | $ cd .. |
@@ -1,294 +1,294 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 | hg: parse error: invalid date: 'should fail' |
|
21 | 21 | [255] |
|
22 | 22 | $ hg ci -d "100000000000000000 1400" -m "fail" |
|
23 | 23 | hg: parse error: date exceeds 32 bits: 100000000000000000 |
|
24 | 24 | [255] |
|
25 | 25 | $ hg ci -d "100000 1400000" -m "fail" |
|
26 | 26 | hg: parse error: 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 | 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 | 35 | Summer time begins on April's first Sunday at 2:00am, |
|
36 | 36 | and ends on October's last Sunday at 2:00am. |
|
37 | 37 | |
|
38 | 38 | $ hg debugrebuildstate |
|
39 | 39 | $ echo "a" > a |
|
40 | 40 | $ hg ci -d "2006-07-15 13:30" -m "summer@UTC-7" |
|
41 | 41 | $ hg debugrebuildstate |
|
42 | 42 | $ echo "b" > a |
|
43 | 43 | $ hg ci -d "2006-07-15 13:30 +0500" -m "summer@UTC+5" |
|
44 | 44 | $ hg debugrebuildstate |
|
45 | 45 | $ echo "c" > a |
|
46 | 46 | $ hg ci -d "2006-01-15 13:30" -m "winter@UTC-8" |
|
47 | 47 | $ hg debugrebuildstate |
|
48 | 48 | $ echo "d" > a |
|
49 | 49 | $ hg ci -d "2006-01-15 13:30 +0500" -m "winter@UTC+5" |
|
50 | 50 | $ hg log --template '{date|date}\n' |
|
51 | 51 | Sun Jan 15 13:30:00 2006 +0500 |
|
52 | 52 | Sun Jan 15 13:30:00 2006 -0800 |
|
53 | 53 | Sat Jul 15 13:30:00 2006 +0500 |
|
54 | 54 | Sat Jul 15 13:30:00 2006 -0700 |
|
55 | 55 | Sun Jun 11 00:26:40 2006 -0400 |
|
56 | 56 | Sat Apr 15 13:30:00 2006 +0200 |
|
57 | 57 | Sat Apr 15 13:30:00 2006 +0000 |
|
58 | 58 | Wed Feb 01 13:00:30 2006 -0500 |
|
59 | 59 | Wed Feb 01 13:00:30 2006 +0000 |
|
60 | 60 | |
|
61 | 61 | Test issue1014 (fractional timezones) |
|
62 | 62 | |
|
63 | 63 | $ hg debugdate "1000000000 -16200" # 0430 |
|
64 | 64 | internal: 1000000000 -16200 |
|
65 | 65 | standard: Sun Sep 09 06:16:40 2001 +0430 |
|
66 | 66 | $ hg debugdate "1000000000 -15300" # 0415 |
|
67 | 67 | internal: 1000000000 -15300 |
|
68 | 68 | standard: Sun Sep 09 06:01:40 2001 +0415 |
|
69 | 69 | $ hg debugdate "1000000000 -14400" # 0400 |
|
70 | 70 | internal: 1000000000 -14400 |
|
71 | 71 | standard: Sun Sep 09 05:46:40 2001 +0400 |
|
72 | 72 | $ hg debugdate "1000000000 0" # GMT |
|
73 | 73 | internal: 1000000000 0 |
|
74 | 74 | standard: Sun Sep 09 01:46:40 2001 +0000 |
|
75 | 75 | $ hg debugdate "1000000000 14400" # -0400 |
|
76 | 76 | internal: 1000000000 14400 |
|
77 | 77 | standard: Sat Sep 08 21:46:40 2001 -0400 |
|
78 | 78 | $ hg debugdate "1000000000 15300" # -0415 |
|
79 | 79 | internal: 1000000000 15300 |
|
80 | 80 | standard: Sat Sep 08 21:31:40 2001 -0415 |
|
81 | 81 | $ hg debugdate "1000000000 16200" # -0430 |
|
82 | 82 | internal: 1000000000 16200 |
|
83 | 83 | standard: Sat Sep 08 21:16:40 2001 -0430 |
|
84 | 84 | $ hg debugdate "Sat Sep 08 21:16:40 2001 +0430" |
|
85 | 85 | internal: 999967600 -16200 |
|
86 | 86 | standard: Sat Sep 08 21:16:40 2001 +0430 |
|
87 | 87 | $ hg debugdate "Sat Sep 08 21:16:40 2001 -0430" |
|
88 | 88 | internal: 1000000000 16200 |
|
89 | 89 | standard: Sat Sep 08 21:16:40 2001 -0430 |
|
90 | 90 | |
|
91 | 91 | Test 12-hours times |
|
92 | 92 | |
|
93 | 93 | $ hg debugdate "2006-02-01 1:00:30PM +0000" |
|
94 | 94 | internal: 1138798830 0 |
|
95 | 95 | standard: Wed Feb 01 13:00:30 2006 +0000 |
|
96 | 96 | $ hg debugdate "1:00:30PM" > /dev/null |
|
97 | 97 | |
|
98 | 98 | Normal range |
|
99 | 99 | |
|
100 | 100 | $ hg log -d -1 |
|
101 | 101 | |
|
102 | 102 | Negative range |
|
103 | 103 | |
|
104 | 104 | $ hg log -d "--2" |
|
105 | 105 | abort: -2 must be nonnegative (see 'hg help dates') |
|
106 | 106 | [255] |
|
107 | 107 | |
|
108 | 108 | Whitespace only |
|
109 | 109 | |
|
110 | 110 | $ hg log -d " " |
|
111 | 111 | abort: dates cannot consist entirely of whitespace |
|
112 | 112 | [255] |
|
113 | 113 | |
|
114 | 114 | Test date formats with '>' or '<' accompanied by space characters |
|
115 | 115 | |
|
116 | 116 | $ hg log -d '>' --template '{date|date}\n' |
|
117 | 117 | abort: invalid day spec, use '>DATE' |
|
118 | 118 | [255] |
|
119 | 119 | $ hg log -d '<' --template '{date|date}\n' |
|
120 | 120 | abort: invalid day spec, use '<DATE' |
|
121 | 121 | [255] |
|
122 | 122 | |
|
123 | 123 | $ hg log -d ' >' --template '{date|date}\n' |
|
124 | 124 | abort: invalid day spec, use '>DATE' |
|
125 | 125 | [255] |
|
126 | 126 | $ hg log -d ' <' --template '{date|date}\n' |
|
127 | 127 | abort: invalid day spec, use '<DATE' |
|
128 | 128 | [255] |
|
129 | 129 | |
|
130 | 130 | $ hg log -d '> ' --template '{date|date}\n' |
|
131 | 131 | abort: invalid day spec, use '>DATE' |
|
132 | 132 | [255] |
|
133 | 133 | $ hg log -d '< ' --template '{date|date}\n' |
|
134 | 134 | abort: invalid day spec, use '<DATE' |
|
135 | 135 | [255] |
|
136 | 136 | |
|
137 | 137 | $ hg log -d ' > ' --template '{date|date}\n' |
|
138 | 138 | abort: invalid day spec, use '>DATE' |
|
139 | 139 | [255] |
|
140 | 140 | $ hg log -d ' < ' --template '{date|date}\n' |
|
141 | 141 | abort: invalid day spec, use '<DATE' |
|
142 | 142 | [255] |
|
143 | 143 | |
|
144 | 144 | $ hg log -d '>02/01' --template '{date|date}\n' |
|
145 | 145 | $ hg log -d '<02/01' --template '{date|date}\n' |
|
146 | 146 | Sun Jan 15 13:30:00 2006 +0500 |
|
147 | 147 | Sun Jan 15 13:30:00 2006 -0800 |
|
148 | 148 | Sat Jul 15 13:30:00 2006 +0500 |
|
149 | 149 | Sat Jul 15 13:30:00 2006 -0700 |
|
150 | 150 | Sun Jun 11 00:26:40 2006 -0400 |
|
151 | 151 | Sat Apr 15 13:30:00 2006 +0200 |
|
152 | 152 | Sat Apr 15 13:30:00 2006 +0000 |
|
153 | 153 | Wed Feb 01 13:00:30 2006 -0500 |
|
154 | 154 | Wed Feb 01 13:00:30 2006 +0000 |
|
155 | 155 | |
|
156 | 156 | $ hg log -d ' >02/01' --template '{date|date}\n' |
|
157 | 157 | $ hg log -d ' <02/01' --template '{date|date}\n' |
|
158 | 158 | Sun Jan 15 13:30:00 2006 +0500 |
|
159 | 159 | Sun Jan 15 13:30:00 2006 -0800 |
|
160 | 160 | Sat Jul 15 13:30:00 2006 +0500 |
|
161 | 161 | Sat Jul 15 13:30:00 2006 -0700 |
|
162 | 162 | Sun Jun 11 00:26:40 2006 -0400 |
|
163 | 163 | Sat Apr 15 13:30:00 2006 +0200 |
|
164 | 164 | Sat Apr 15 13:30:00 2006 +0000 |
|
165 | 165 | Wed Feb 01 13:00:30 2006 -0500 |
|
166 | 166 | Wed Feb 01 13:00:30 2006 +0000 |
|
167 | 167 | |
|
168 | 168 | $ hg log -d '> 02/01' --template '{date|date}\n' |
|
169 | 169 | $ hg log -d '< 02/01' --template '{date|date}\n' |
|
170 | 170 | Sun Jan 15 13:30:00 2006 +0500 |
|
171 | 171 | Sun Jan 15 13:30:00 2006 -0800 |
|
172 | 172 | Sat Jul 15 13:30:00 2006 +0500 |
|
173 | 173 | Sat Jul 15 13:30:00 2006 -0700 |
|
174 | 174 | Sun Jun 11 00:26:40 2006 -0400 |
|
175 | 175 | Sat Apr 15 13:30:00 2006 +0200 |
|
176 | 176 | Sat Apr 15 13:30:00 2006 +0000 |
|
177 | 177 | Wed Feb 01 13:00:30 2006 -0500 |
|
178 | 178 | Wed Feb 01 13:00:30 2006 +0000 |
|
179 | 179 | |
|
180 | 180 | $ hg log -d ' > 02/01' --template '{date|date}\n' |
|
181 | 181 | $ hg log -d ' < 02/01' --template '{date|date}\n' |
|
182 | 182 | Sun Jan 15 13:30:00 2006 +0500 |
|
183 | 183 | Sun Jan 15 13:30:00 2006 -0800 |
|
184 | 184 | Sat Jul 15 13:30:00 2006 +0500 |
|
185 | 185 | Sat Jul 15 13:30:00 2006 -0700 |
|
186 | 186 | Sun Jun 11 00:26:40 2006 -0400 |
|
187 | 187 | Sat Apr 15 13:30:00 2006 +0200 |
|
188 | 188 | Sat Apr 15 13:30:00 2006 +0000 |
|
189 | 189 | Wed Feb 01 13:00:30 2006 -0500 |
|
190 | 190 | Wed Feb 01 13:00:30 2006 +0000 |
|
191 | 191 | |
|
192 | 192 | $ hg log -d '>02/01 ' --template '{date|date}\n' |
|
193 | 193 | $ hg log -d '<02/01 ' --template '{date|date}\n' |
|
194 | 194 | Sun Jan 15 13:30:00 2006 +0500 |
|
195 | 195 | Sun Jan 15 13:30:00 2006 -0800 |
|
196 | 196 | Sat Jul 15 13:30:00 2006 +0500 |
|
197 | 197 | Sat Jul 15 13:30:00 2006 -0700 |
|
198 | 198 | Sun Jun 11 00:26:40 2006 -0400 |
|
199 | 199 | Sat Apr 15 13:30:00 2006 +0200 |
|
200 | 200 | Sat Apr 15 13:30:00 2006 +0000 |
|
201 | 201 | Wed Feb 01 13:00:30 2006 -0500 |
|
202 | 202 | Wed Feb 01 13:00:30 2006 +0000 |
|
203 | 203 | |
|
204 | 204 | $ hg log -d ' >02/01 ' --template '{date|date}\n' |
|
205 | 205 | $ hg log -d ' <02/01 ' --template '{date|date}\n' |
|
206 | 206 | Sun Jan 15 13:30:00 2006 +0500 |
|
207 | 207 | Sun Jan 15 13:30:00 2006 -0800 |
|
208 | 208 | Sat Jul 15 13:30:00 2006 +0500 |
|
209 | 209 | Sat Jul 15 13:30:00 2006 -0700 |
|
210 | 210 | Sun Jun 11 00:26:40 2006 -0400 |
|
211 | 211 | Sat Apr 15 13:30:00 2006 +0200 |
|
212 | 212 | Sat Apr 15 13:30:00 2006 +0000 |
|
213 | 213 | Wed Feb 01 13:00:30 2006 -0500 |
|
214 | 214 | Wed Feb 01 13:00:30 2006 +0000 |
|
215 | 215 | |
|
216 | 216 | $ hg log -d '> 02/01 ' --template '{date|date}\n' |
|
217 | 217 | $ hg log -d '< 02/01 ' --template '{date|date}\n' |
|
218 | 218 | Sun Jan 15 13:30:00 2006 +0500 |
|
219 | 219 | Sun Jan 15 13:30:00 2006 -0800 |
|
220 | 220 | Sat Jul 15 13:30:00 2006 +0500 |
|
221 | 221 | Sat Jul 15 13:30:00 2006 -0700 |
|
222 | 222 | Sun Jun 11 00:26:40 2006 -0400 |
|
223 | 223 | Sat Apr 15 13:30:00 2006 +0200 |
|
224 | 224 | Sat Apr 15 13:30:00 2006 +0000 |
|
225 | 225 | Wed Feb 01 13:00:30 2006 -0500 |
|
226 | 226 | Wed Feb 01 13:00:30 2006 +0000 |
|
227 | 227 | |
|
228 | 228 | $ hg log -d ' > 02/01 ' --template '{date|date}\n' |
|
229 | 229 | $ hg log -d ' < 02/01 ' --template '{date|date}\n' |
|
230 | 230 | Sun Jan 15 13:30:00 2006 +0500 |
|
231 | 231 | Sun Jan 15 13:30:00 2006 -0800 |
|
232 | 232 | Sat Jul 15 13:30:00 2006 +0500 |
|
233 | 233 | Sat Jul 15 13:30:00 2006 -0700 |
|
234 | 234 | Sun Jun 11 00:26:40 2006 -0400 |
|
235 | 235 | Sat Apr 15 13:30:00 2006 +0200 |
|
236 | 236 | Sat Apr 15 13:30:00 2006 +0000 |
|
237 | 237 | Wed Feb 01 13:00:30 2006 -0500 |
|
238 | 238 | Wed Feb 01 13:00:30 2006 +0000 |
|
239 | 239 | |
|
240 | 240 | Test issue 3764 (interpreting 'today' and 'yesterday') |
|
241 | 241 | $ echo "hello" >> a |
|
242 | 242 | >>> import datetime |
|
243 | 243 | >>> today = datetime.date.today().strftime("%b %d") |
|
244 | 244 | >>> yesterday = (datetime.date.today() - datetime.timedelta(days=1)).strftime("%b %d") |
|
245 | 245 | >>> dates = open('dates', 'w') |
|
246 | >>> dates.write(today + '\n') | |
|
247 | >>> dates.write(yesterday + '\n') | |
|
246 | >>> dates.write(today + '\n') and None | |
|
247 | >>> dates.write(yesterday + '\n') and None | |
|
248 | 248 | >>> dates.close() |
|
249 | 249 | $ hg ci -d "`sed -n '1p' dates`" -m "today is a good day to code" |
|
250 | 250 | $ hg log -d today --template '{desc}\n' |
|
251 | 251 | today is a good day to code |
|
252 | 252 | $ echo "goodbye" >> a |
|
253 | 253 | $ hg ci -d "`sed -n '2p' dates`" -m "the time traveler's code" |
|
254 | 254 | $ hg log -d yesterday --template '{desc}\n' |
|
255 | 255 | the time traveler's code |
|
256 | 256 | $ echo "foo" >> a |
|
257 | 257 | $ hg commit -d now -m 'Explicitly committed now.' |
|
258 | 258 | $ hg log -d today --template '{desc}\n' |
|
259 | 259 | Explicitly committed now. |
|
260 | 260 | today is a good day to code |
|
261 | 261 | |
|
262 | 262 | Test parsing various ISO8601 forms |
|
263 | 263 | |
|
264 | 264 | $ hg debugdate "2016-07-27T12:10:21" |
|
265 | 265 | internal: 1469646621 * (glob) |
|
266 | 266 | standard: Wed Jul 27 12:10:21 2016 -0700 |
|
267 | 267 | $ hg debugdate "2016-07-27T12:10:21Z" |
|
268 | 268 | internal: 1469621421 0 |
|
269 | 269 | standard: Wed Jul 27 12:10:21 2016 +0000 |
|
270 | 270 | $ hg debugdate "2016-07-27T12:10:21+00:00" |
|
271 | 271 | internal: 1469621421 0 |
|
272 | 272 | standard: Wed Jul 27 12:10:21 2016 +0000 |
|
273 | 273 | $ hg debugdate "2016-07-27T121021Z" |
|
274 | 274 | internal: 1469621421 0 |
|
275 | 275 | standard: Wed Jul 27 12:10:21 2016 +0000 |
|
276 | 276 | |
|
277 | 277 | $ hg debugdate "2016-07-27 12:10:21" |
|
278 | 278 | internal: 1469646621 * (glob) |
|
279 | 279 | standard: Wed Jul 27 12:10:21 2016 -0700 |
|
280 | 280 | $ hg debugdate "2016-07-27 12:10:21Z" |
|
281 | 281 | internal: 1469621421 0 |
|
282 | 282 | standard: Wed Jul 27 12:10:21 2016 +0000 |
|
283 | 283 | $ hg debugdate "2016-07-27 12:10:21+00:00" |
|
284 | 284 | internal: 1469621421 0 |
|
285 | 285 | standard: Wed Jul 27 12:10:21 2016 +0000 |
|
286 | 286 | $ hg debugdate "2016-07-27 121021Z" |
|
287 | 287 | internal: 1469621421 0 |
|
288 | 288 | standard: Wed Jul 27 12:10:21 2016 +0000 |
|
289 | 289 | |
|
290 | 290 | Test parsing months |
|
291 | 291 | |
|
292 | 292 | $ for i in Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec; do |
|
293 | 293 | > hg log -d "$i 2018" -r null |
|
294 | 294 | > done |
@@ -1,47 +1,47 b'' | |||
|
1 | 1 | $ hg init empty-repo |
|
2 | 2 | $ cd empty-repo |
|
3 | 3 | |
|
4 | 4 | Flags on revlog version 0 are rejected |
|
5 | 5 | |
|
6 | 6 | >>> with open('.hg/store/00changelog.i', 'wb') as fh: |
|
7 | ... fh.write(b'\x00\x01\x00\x00') | |
|
7 | ... fh.write(b'\x00\x01\x00\x00') and None | |
|
8 | 8 | |
|
9 | 9 |
$ |
|
10 | 10 | abort: unknown flags (0x01) in version 0 revlog 00changelog.i! |
|
11 | 11 | [255] |
|
12 | 12 | |
|
13 | 13 | Unknown flags on revlog version 1 are rejected |
|
14 | 14 | |
|
15 | 15 | >>> with open('.hg/store/00changelog.i', 'wb') as fh: |
|
16 | ... fh.write(b'\x00\x04\x00\x01') | |
|
16 | ... fh.write(b'\x00\x04\x00\x01') and None | |
|
17 | 17 | |
|
18 | 18 |
$ |
|
19 | 19 | abort: unknown flags (0x04) in version 1 revlog 00changelog.i! |
|
20 | 20 | [255] |
|
21 | 21 | |
|
22 | 22 | Unknown version is rejected |
|
23 | 23 | |
|
24 | 24 | >>> with open('.hg/store/00changelog.i', 'wb') as fh: |
|
25 | ... fh.write(b'\x00\x00\x00\x02') | |
|
25 | ... fh.write(b'\x00\x00\x00\x02') and None | |
|
26 | 26 | |
|
27 | 27 |
$ |
|
28 | 28 | abort: unknown version (2) in revlog 00changelog.i! |
|
29 | 29 | [255] |
|
30 | 30 | |
|
31 | 31 | $ cd .. |
|
32 | 32 | |
|
33 | 33 | Test for CVE-2016-3630 |
|
34 | 34 | |
|
35 | 35 | $ hg init |
|
36 | 36 | |
|
37 | 37 | >>> open("a.i", "wb").write( |
|
38 | 38 | ... b"""eJxjYGZgZIAAYQYGxhgom+k/FMx8YKx9ZUaKSOyqo4cnuKb8mbqHV5cBCVTMWb1Cwqkhe4Gsg9AD |
|
39 | 39 | ... Joa3dYtcYYYBAQ8Qr4OqZAYRICPTSr5WKd/42rV36d+8/VmrNpv7NP1jQAXrQE4BqQUARngwVA==""" |
|
40 | 40 | ... .decode("base64").decode("zlib")) |
|
41 | 41 | |
|
42 | 42 | $ hg debugindex a.i |
|
43 | 43 | rev linkrev nodeid p1 p2 |
|
44 | 44 | 0 2 99e0332bd498 000000000000 000000000000 |
|
45 | 45 | 1 3 6674f57a23d8 99e0332bd498 000000000000 |
|
46 | 46 | $ hg debugdata a.i 1 2>&1 | egrep 'Error:.*decoded' |
|
47 | 47 | (mercurial\.\w+\.mpatch\.)?mpatchError: patch cannot be decoded (re) |
@@ -1,79 +1,79 b'' | |||
|
1 | 1 | #require symlink |
|
2 | 2 | |
|
3 | 3 | Create extension that can disable symlink support: |
|
4 | 4 | |
|
5 | 5 | $ cat > nolink.py <<EOF |
|
6 | 6 | > from mercurial import extensions, util |
|
7 | 7 | > def setflags(orig, f, l, x): |
|
8 | 8 | > pass |
|
9 | 9 | > def checklink(orig, path): |
|
10 | 10 | > return False |
|
11 | 11 | > def extsetup(ui): |
|
12 | 12 | > extensions.wrapfunction(util, 'setflags', setflags) |
|
13 | 13 | > extensions.wrapfunction(util, 'checklink', checklink) |
|
14 | 14 | > EOF |
|
15 | 15 | |
|
16 | 16 | $ hg init unix-repo |
|
17 | 17 | $ cd unix-repo |
|
18 | 18 | $ echo foo > a |
|
19 | 19 | $ ln -s a b |
|
20 | 20 | $ hg ci -Am0 |
|
21 | 21 | adding a |
|
22 | 22 | adding b |
|
23 | 23 | $ cd .. |
|
24 | 24 | |
|
25 | 25 | Simulate a checkout shared on NFS/Samba: |
|
26 | 26 | |
|
27 | 27 | $ hg clone -q unix-repo shared |
|
28 | 28 | $ cd shared |
|
29 | 29 | $ rm b |
|
30 | 30 | $ echo foo > b |
|
31 | 31 | $ hg --config extensions.n=$TESTTMP/nolink.py status --debug |
|
32 | 32 | ignoring suspect symlink placeholder "b" |
|
33 | 33 | |
|
34 | 34 | Make a clone using placeholders: |
|
35 | 35 | |
|
36 | 36 | $ hg --config extensions.n=$TESTTMP/nolink.py clone . ../win-repo |
|
37 | 37 | updating to branch default |
|
38 | 38 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
39 | 39 | $ cd ../win-repo |
|
40 | 40 | $ cat b |
|
41 | 41 | a (no-eol) |
|
42 | 42 | $ hg --config extensions.n=$TESTTMP/nolink.py st --debug |
|
43 | 43 | |
|
44 | 44 | Empty placeholder: |
|
45 | 45 | |
|
46 | 46 | $ rm b |
|
47 | 47 | $ touch b |
|
48 | 48 | $ hg --config extensions.n=$TESTTMP/nolink.py st --debug |
|
49 | 49 | ignoring suspect symlink placeholder "b" |
|
50 | 50 | |
|
51 | 51 | Write binary data to the placeholder: |
|
52 | 52 | |
|
53 | >>> open('b', 'w').write('this is a binary\0') | |
|
53 | >>> open('b', 'w').write('this is a binary\0') and None | |
|
54 | 54 |
$ |
|
55 | 55 | ignoring suspect symlink placeholder "b" |
|
56 | 56 | |
|
57 | 57 | Write a long string to the placeholder: |
|
58 | 58 | |
|
59 | >>> open('b', 'w').write('this' * 1000) | |
|
59 | >>> open('b', 'w').write('this' * 1000) and None | |
|
60 | 60 |
$ |
|
61 | 61 | ignoring suspect symlink placeholder "b" |
|
62 | 62 | |
|
63 | 63 | Commit shouldn't succeed: |
|
64 | 64 | |
|
65 | 65 | $ hg --config extensions.n=$TESTTMP/nolink.py ci -m1 |
|
66 | 66 | nothing changed |
|
67 | 67 | [1] |
|
68 | 68 | |
|
69 | 69 | Write a valid string to the placeholder: |
|
70 | 70 | |
|
71 | >>> open('b', 'w').write('this') | |
|
71 | >>> open('b', 'w').write('this') and None | |
|
72 | 72 | $ hg --config extensions.n=$TESTTMP/nolink.py st --debug |
|
73 | 73 | M b |
|
74 | 74 | $ hg --config extensions.n=$TESTTMP/nolink.py ci -m1 |
|
75 | 75 | $ hg manifest tip --verbose |
|
76 | 76 | 644 a |
|
77 | 77 | 644 @ b |
|
78 | 78 | |
|
79 | 79 | $ cd .. |
General Comments 0
You need to be logged in to leave comments.
Login now