comparison tests/test-evolve-templates.t @ 2486:cd4290f923b7

template: add precursors template The precursors templates display the closest visible precursors of each changeset, we may have gap, like in this case: A -> B -> C If we display A and C but not B, we can't display than B is the closest precursor of C because it's not displayed. We display A as the closest precursor of C instead. Add a new test file as we will need to generate theses gaps and modifying test-evolve-obshistory.t will lead to many unrelated lines changes.
author Boris Feld <boris.feld@octobus.net>
date Fri, 26 May 2017 10:05:27 +0200
parents
children 590da9c523ae
comparison
equal deleted inserted replaced
2485:e6ecd35e99ec 2486:cd4290f923b7
1 This test file test the various templates for precursors and successors.
2
3 Global setup
4 ============
5
6 $ . $TESTDIR/testlib/common.sh
7 $ cat >> $HGRCPATH <<EOF
8 > [ui]
9 > interactive = true
10 > [phases]
11 > publish=False
12 > [extensions]
13 > evolve =
14 > [alias]
15 > tlog = log -G -T '{node|short} Precursors: {precursors}\n'
16 > EOF
17
18 Test templates on amended commit
19 ================================
20
21 Test setup
22 ----------
23
24 $ hg init $TESTTMP/templates-local-amend
25 $ cd $TESTTMP/templates-local-amend
26 $ mkcommit ROOT
27 $ mkcommit A0
28 $ echo 42 >> A0
29 $ hg amend -m "A1
30 >
31 > Better commit message"
32 $ hg log --hidden -G
33 @ changeset: 3:4ae3a4151de9
34 | tag: tip
35 | parent: 0:ea207398892e
36 | user: test
37 | date: Thu Jan 01 00:00:00 1970 +0000
38 | summary: A1
39 |
40 | x changeset: 2:f137d23bb3e1
41 | | user: test
42 | | date: Thu Jan 01 00:00:00 1970 +0000
43 | | summary: temporary amend commit for 471f378eab4c
44 | |
45 | x changeset: 1:471f378eab4c
46 |/ user: test
47 | date: Thu Jan 01 00:00:00 1970 +0000
48 | summary: A0
49 |
50 o changeset: 0:ea207398892e
51 user: test
52 date: Thu Jan 01 00:00:00 1970 +0000
53 summary: ROOT
54
55 Check templates
56 ---------------
57 $ hg up 'desc(A0)' --hidden
58 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
59 working directory parent is obsolete! (471f378eab4c)
60 (use 'hg evolve' to update to its successor: 4ae3a4151de9)
61
62 Precursors template should show current revision as it is the working copy
63 $ hg tlog
64 o 4ae3a4151de9 Precursors: 471f378eab4c
65 |
66 | @ 471f378eab4c Precursors:
67 |/
68 o ea207398892e Precursors:
69
70 $ hg up 'desc(A1)'
71 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
72
73 Precursors template should not show a precursor as it's not displayed in the
74 log
75 $ hg tlog
76 @ 4ae3a4151de9 Precursors:
77 |
78 o ea207398892e Precursors:
79
80 Precursors template should show the precursor as we force its display with
81 --hidden
82 $ hg tlog --hidden
83 @ 4ae3a4151de9 Precursors: 471f378eab4c
84 |
85 | x f137d23bb3e1 Precursors:
86 | |
87 | x 471f378eab4c Precursors:
88 |/
89 o ea207398892e Precursors:
90
91
92 Test templates with splitted commit
93 ===================================
94
95 $ hg init $TESTTMP/templates-local-split
96 $ cd $TESTTMP/templates-local-split
97 $ mkcommit ROOT
98 $ echo 42 >> a
99 $ echo 43 >> b
100 $ hg commit -A -m "A0"
101 adding a
102 adding b
103 $ hg log --hidden -G
104 @ changeset: 1:471597cad322
105 | tag: tip
106 | user: test
107 | date: Thu Jan 01 00:00:00 1970 +0000
108 | summary: A0
109 |
110 o changeset: 0:ea207398892e
111 user: test
112 date: Thu Jan 01 00:00:00 1970 +0000
113 summary: ROOT
114
115 $ hg split -r 'desc(A0)' -d "0 0" << EOF
116 > y
117 > y
118 > n
119 > n
120 > y
121 > y
122 > EOF
123 0 files updated, 0 files merged, 2 files removed, 0 files unresolved
124 adding a
125 adding b
126 diff --git a/a b/a
127 new file mode 100644
128 examine changes to 'a'? [Ynesfdaq?] y
129
130 @@ -0,0 +1,1 @@
131 +42
132 record change 1/2 to 'a'? [Ynesfdaq?] y
133
134 diff --git a/b b/b
135 new file mode 100644
136 examine changes to 'b'? [Ynesfdaq?] n
137
138 created new head
139 Done splitting? [yN] n
140 diff --git a/b b/b
141 new file mode 100644
142 examine changes to 'b'? [Ynesfdaq?] y
143
144 @@ -0,0 +1,1 @@
145 +43
146 record this change to 'b'? [Ynesfdaq?] y
147
148 no more change to split
149
150 $ hg log --hidden -G
151 @ changeset: 3:f257fde29c7a
152 | tag: tip
153 | user: test
154 | date: Thu Jan 01 00:00:00 1970 +0000
155 | summary: A0
156 |
157 o changeset: 2:337fec4d2edc
158 | parent: 0:ea207398892e
159 | user: test
160 | date: Thu Jan 01 00:00:00 1970 +0000
161 | summary: A0
162 |
163 | x changeset: 1:471597cad322
164 |/ user: test
165 | date: Thu Jan 01 00:00:00 1970 +0000
166 | summary: A0
167 |
168 o changeset: 0:ea207398892e
169 user: test
170 date: Thu Jan 01 00:00:00 1970 +0000
171 summary: ROOT
172
173
174 Check templates
175 ---------------
176
177 $ hg up 'obsolete()' --hidden
178 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
179 working directory parent is obsolete! (471597cad322)
180 (use 'hg evolve' to update to its tipmost successor: 337fec4d2edc, f257fde29c7a)
181
182 Precursors template should show current revision as it is the working copy
183 $ hg tlog
184 o f257fde29c7a Precursors: 471597cad322
185 |
186 o 337fec4d2edc Precursors: 471597cad322
187 |
188 | @ 471597cad322 Precursors:
189 |/
190 o ea207398892e Precursors:
191
192 $ hg up f257fde29c7a
193 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
194
195 Precursors template should not show a precursor as it's not displayed in the
196 log
197 $ hg tlog
198 @ f257fde29c7a Precursors:
199 |
200 o 337fec4d2edc Precursors:
201 |
202 o ea207398892e Precursors:
203
204 Precursors template should show the precursor as we force its display with
205 --hidden
206 $ hg tlog --hidden
207 @ f257fde29c7a Precursors: 471597cad322
208 |
209 o 337fec4d2edc Precursors: 471597cad322
210 |
211 | x 471597cad322 Precursors:
212 |/
213 o ea207398892e Precursors:
214
215 Test templates with folded commit
216 ==============================
217
218 Test setup
219 ----------
220
221 $ hg init $TESTTMP/templates-local-fold
222 $ cd $TESTTMP/templates-local-fold
223 $ mkcommit ROOT
224 $ mkcommit A0
225 $ mkcommit B0
226 $ hg log --hidden -G
227 @ changeset: 2:0dec01379d3b
228 | tag: tip
229 | user: test
230 | date: Thu Jan 01 00:00:00 1970 +0000
231 | summary: B0
232 |
233 o changeset: 1:471f378eab4c
234 | user: test
235 | date: Thu Jan 01 00:00:00 1970 +0000
236 | summary: A0
237 |
238 o changeset: 0:ea207398892e
239 user: test
240 date: Thu Jan 01 00:00:00 1970 +0000
241 summary: ROOT
242
243 $ hg fold --exact -r 'desc(A0) + desc(B0)' --date "0 0" -m "C0"
244 2 changesets folded
245 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
246 $ hg log --hidden -G
247 @ changeset: 3:eb5a0daa2192
248 | tag: tip
249 | parent: 0:ea207398892e
250 | user: test
251 | date: Thu Jan 01 00:00:00 1970 +0000
252 | summary: C0
253 |
254 | x changeset: 2:0dec01379d3b
255 | | user: test
256 | | date: Thu Jan 01 00:00:00 1970 +0000
257 | | summary: B0
258 | |
259 | x changeset: 1:471f378eab4c
260 |/ user: test
261 | date: Thu Jan 01 00:00:00 1970 +0000
262 | summary: A0
263 |
264 o changeset: 0:ea207398892e
265 user: test
266 date: Thu Jan 01 00:00:00 1970 +0000
267 summary: ROOT
268
269 Check templates
270 ---------------
271
272 $ hg up 'desc(A0)' --hidden
273 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
274 working directory parent is obsolete! (471f378eab4c)
275 (use 'hg evolve' to update to its successor: eb5a0daa2192)
276
277 Precursors template should show current revision as it is the working copy
278 $ hg tlog
279 o eb5a0daa2192 Precursors: 471f378eab4c
280 |
281 | @ 471f378eab4c Precursors:
282 |/
283 o ea207398892e Precursors:
284
285 $ hg up 'desc(B0)' --hidden
286 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
287 working directory parent is obsolete! (0dec01379d3b)
288 (use 'hg evolve' to update to its successor: eb5a0daa2192)
289
290 Precursors template should show both precursors as they should be both
291 displayed
292 $ hg tlog
293 o eb5a0daa2192 Precursors: 0dec01379d3b, 471f378eab4c
294 |
295 | @ 0dec01379d3b Precursors:
296 | |
297 | x 471f378eab4c Precursors:
298 |/
299 o ea207398892e Precursors:
300
301 $ hg up 'desc(C0)'
302 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
303
304 Precursors template should not show precursors as it's not displayed in the
305 log
306 $ hg tlog
307 @ eb5a0daa2192 Precursors:
308 |
309 o ea207398892e Precursors:
310
311 Precursors template should show both precursors as we force its display with
312 --hidden
313 $ hg tlog --hidden
314 @ eb5a0daa2192 Precursors: 0dec01379d3b, 471f378eab4c
315 |
316 | x 0dec01379d3b Precursors:
317 | |
318 | x 471f378eab4c Precursors:
319 |/
320 o ea207398892e Precursors:
321
322
323 Test templates with divergence
324 ==============================
325
326 Test setup
327 ----------
328
329 $ hg init $TESTTMP/templates-local-divergence
330 $ cd $TESTTMP/templates-local-divergence
331 $ mkcommit ROOT
332 $ mkcommit A0
333 $ hg amend -m "A1"
334 $ hg log --hidden -G
335 @ changeset: 2:fdf9bde5129a
336 | tag: tip
337 | parent: 0:ea207398892e
338 | user: test
339 | date: Thu Jan 01 00:00:00 1970 +0000
340 | summary: A1
341 |
342 | x changeset: 1:471f378eab4c
343 |/ user: test
344 | date: Thu Jan 01 00:00:00 1970 +0000
345 | summary: A0
346 |
347 o changeset: 0:ea207398892e
348 user: test
349 date: Thu Jan 01 00:00:00 1970 +0000
350 summary: ROOT
351
352 $ hg update --hidden 'desc(A0)'
353 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
354 working directory parent is obsolete! (471f378eab4c)
355 (use 'hg evolve' to update to its successor: fdf9bde5129a)
356 $ hg amend -m "A2"
357 2 new divergent changesets
358 $ hg log --hidden -G
359 @ changeset: 3:65b757b745b9
360 | tag: tip
361 | parent: 0:ea207398892e
362 | user: test
363 | date: Thu Jan 01 00:00:00 1970 +0000
364 | trouble: divergent
365 | summary: A2
366 |
367 | o changeset: 2:fdf9bde5129a
368 |/ parent: 0:ea207398892e
369 | user: test
370 | date: Thu Jan 01 00:00:00 1970 +0000
371 | trouble: divergent
372 | summary: A1
373 |
374 | x changeset: 1:471f378eab4c
375 |/ user: test
376 | date: Thu Jan 01 00:00:00 1970 +0000
377 | summary: A0
378 |
379 o changeset: 0:ea207398892e
380 user: test
381 date: Thu Jan 01 00:00:00 1970 +0000
382 summary: ROOT
383
384 Check templates
385 ---------------
386
387 $ hg up 'desc(A0)' --hidden
388 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
389 working directory parent is obsolete! (471f378eab4c)
390 (471f378eab4c has diverged, use 'hg evolve -list --divergent' to resolve the issue)
391
392 Precursors template should show current revision as it is the working copy
393 $ hg tlog
394 o 65b757b745b9 Precursors: 471f378eab4c
395 |
396 | o fdf9bde5129a Precursors: 471f378eab4c
397 |/
398 | @ 471f378eab4c Precursors:
399 |/
400 o ea207398892e Precursors:
401
402 $ hg up 'desc(A1)'
403 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
404 Precursors template should not show precursors as it's not displayed in the
405 log
406 $ hg tlog
407 o 65b757b745b9 Precursors:
408 |
409 | @ fdf9bde5129a Precursors:
410 |/
411 o ea207398892e Precursors:
412
413 Precursors template should a precursor as we force its display with --hidden
414 $ hg tlog --hidden
415 o 65b757b745b9 Precursors: 471f378eab4c
416 |
417 | @ fdf9bde5129a Precursors: 471f378eab4c
418 |/
419 | x 471f378eab4c Precursors:
420 |/
421 o ea207398892e Precursors:
422
423 Test templates with amended + folded commit
424 ===========================================
425
426 Test setup
427 ----------
428
429 $ hg init $TESTTMP/templates-local-amend-fold
430 $ cd $TESTTMP/templates-local-amend-fold
431 $ mkcommit ROOT
432 $ mkcommit A0
433 $ mkcommit B0
434 $ hg amend -m "B1"
435 $ hg log --hidden -G
436 @ changeset: 3:b7ea6d14e664
437 | tag: tip
438 | parent: 1:471f378eab4c
439 | user: test
440 | date: Thu Jan 01 00:00:00 1970 +0000
441 | summary: B1
442 |
443 | x changeset: 2:0dec01379d3b
444 |/ user: test
445 | date: Thu Jan 01 00:00:00 1970 +0000
446 | summary: B0
447 |
448 o changeset: 1:471f378eab4c
449 | user: test
450 | date: Thu Jan 01 00:00:00 1970 +0000
451 | summary: A0
452 |
453 o changeset: 0:ea207398892e
454 user: test
455 date: Thu Jan 01 00:00:00 1970 +0000
456 summary: ROOT
457
458 $ hg fold --exact -r 'desc(A0) + desc(B1)' --date "0 0" -m "C0"
459 2 changesets folded
460 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
461 $ hg log --hidden -G
462 @ changeset: 4:eb5a0daa2192
463 | tag: tip
464 | parent: 0:ea207398892e
465 | user: test
466 | date: Thu Jan 01 00:00:00 1970 +0000
467 | summary: C0
468 |
469 | x changeset: 3:b7ea6d14e664
470 | | parent: 1:471f378eab4c
471 | | user: test
472 | | date: Thu Jan 01 00:00:00 1970 +0000
473 | | summary: B1
474 | |
475 | | x changeset: 2:0dec01379d3b
476 | |/ user: test
477 | | date: Thu Jan 01 00:00:00 1970 +0000
478 | | summary: B0
479 | |
480 | x changeset: 1:471f378eab4c
481 |/ user: test
482 | date: Thu Jan 01 00:00:00 1970 +0000
483 | summary: A0
484 |
485 o changeset: 0:ea207398892e
486 user: test
487 date: Thu Jan 01 00:00:00 1970 +0000
488 summary: ROOT
489
490 Check templates
491 ---------------
492
493 $ hg up 'desc(A0)' --hidden
494 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
495 working directory parent is obsolete! (471f378eab4c)
496 (use 'hg evolve' to update to its successor: eb5a0daa2192)
497 $ hg tlog
498 o eb5a0daa2192 Precursors: 471f378eab4c
499 |
500 | @ 471f378eab4c Precursors:
501 |/
502 o ea207398892e Precursors:
503
504 $ hg up 'desc(B0)' --hidden
505 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
506 working directory parent is obsolete! (0dec01379d3b)
507 (use 'hg evolve' to update to its successor: eb5a0daa2192)
508 $ hg tlog
509 o eb5a0daa2192 Precursors: 0dec01379d3b, 471f378eab4c
510 |
511 | @ 0dec01379d3b Precursors:
512 | |
513 | x 471f378eab4c Precursors:
514 |/
515 o ea207398892e Precursors:
516
517 $ hg up 'desc(B1)' --hidden
518 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
519 working directory parent is obsolete! (b7ea6d14e664)
520 (use 'hg evolve' to update to its successor: eb5a0daa2192)
521 $ hg tlog
522 o eb5a0daa2192 Precursors: 471f378eab4c, b7ea6d14e664
523 |
524 | @ b7ea6d14e664 Precursors:
525 | |
526 | x 471f378eab4c Precursors:
527 |/
528 o ea207398892e Precursors:
529
530 $ hg up 'desc(C0)'
531 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
532 $ hg tlog
533 @ eb5a0daa2192 Precursors:
534 |
535 o ea207398892e Precursors:
536
537 $ hg tlog --hidden
538 @ eb5a0daa2192 Precursors: 471f378eab4c, b7ea6d14e664
539 |
540 | x b7ea6d14e664 Precursors: 0dec01379d3b
541 | |
542 | | x 0dec01379d3b Precursors:
543 | |/
544 | x 471f378eab4c Precursors:
545 |/
546 o ea207398892e Precursors:
547
548
549 Test template with pushed and pulled obs markers
550 ==============================================
551
552 Test setup
553 ----------
554
555 $ hg init $TESTTMP/templates-local-remote-markers-1
556 $ cd $TESTTMP/templates-local-remote-markers-1
557 $ mkcommit ROOT
558 $ mkcommit A0
559 $ hg clone $TESTTMP/templates-local-remote-markers-1 $TESTTMP/templates-local-remote-markers-2
560 updating to branch default
561 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
562 $ cd $TESTTMP/templates-local-remote-markers-2
563 $ hg log --hidden -G
564 @ changeset: 1:471f378eab4c
565 | tag: tip
566 | user: test
567 | date: Thu Jan 01 00:00:00 1970 +0000
568 | summary: A0
569 |
570 o changeset: 0:ea207398892e
571 user: test
572 date: Thu Jan 01 00:00:00 1970 +0000
573 summary: ROOT
574
575 $ cd $TESTTMP/templates-local-remote-markers-1
576 $ hg amend -m "A1"
577 $ hg amend -m "A2"
578 $ hg log --hidden -G
579 @ changeset: 3:7a230b46bf61
580 | tag: tip
581 | parent: 0:ea207398892e
582 | user: test
583 | date: Thu Jan 01 00:00:00 1970 +0000
584 | summary: A2
585 |
586 | x changeset: 2:fdf9bde5129a
587 |/ parent: 0:ea207398892e
588 | user: test
589 | date: Thu Jan 01 00:00:00 1970 +0000
590 | summary: A1
591 |
592 | x changeset: 1:471f378eab4c
593 |/ user: test
594 | date: Thu Jan 01 00:00:00 1970 +0000
595 | summary: A0
596 |
597 o changeset: 0:ea207398892e
598 user: test
599 date: Thu Jan 01 00:00:00 1970 +0000
600 summary: ROOT
601
602 $ cd $TESTTMP/templates-local-remote-markers-2
603 $ hg pull
604 pulling from $TESTTMP/templates-local-remote-markers-1
605 searching for changes
606 adding changesets
607 adding manifests
608 adding file changes
609 added 1 changesets with 0 changes to 1 files (+1 heads)
610 2 new obsolescence markers
611 (run 'hg heads' to see heads, 'hg merge' to merge)
612 working directory parent is obsolete! (471f378eab4c)
613 (use 'hg evolve' to update to its successor: 7a230b46bf61)
614 $ hg log --hidden -G
615 o changeset: 2:7a230b46bf61
616 | tag: tip
617 | parent: 0:ea207398892e
618 | user: test
619 | date: Thu Jan 01 00:00:00 1970 +0000
620 | summary: A2
621 |
622 | @ changeset: 1:471f378eab4c
623 |/ user: test
624 | date: Thu Jan 01 00:00:00 1970 +0000
625 | summary: A0
626 |
627 o changeset: 0:ea207398892e
628 user: test
629 date: Thu Jan 01 00:00:00 1970 +0000
630 summary: ROOT
631
632
633 Check templates
634 ---------------
635
636 $ hg tlog
637 o 7a230b46bf61 Precursors: 471f378eab4c
638 |
639 | @ 471f378eab4c Precursors:
640 |/
641 o ea207398892e Precursors:
642
643 $ hg up 'desc(A2)'
644 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
645 $ hg tlog
646 @ 7a230b46bf61 Precursors:
647 |
648 o ea207398892e Precursors:
649
650 $ hg tlog --hidden
651 @ 7a230b46bf61 Precursors: 471f378eab4c
652 |
653 | x 471f378eab4c Precursors:
654 |/
655 o ea207398892e Precursors:
656