comparison tests/test-obsolete.t @ 34847:e27f1f04c2cf

templatekw: introduce obsfate keyword Introduce an obsfate printer that uses all helpers functions defined in obsutil to get all the obsfate-related data and format a string according to the current format in test-obsmarker-template.t. Then, introduce an obsfate templatekw that uses the obsfateprinter to return a list of strings. The goal is not to replace existing obsfate template functions but to propose a default, good-enough and easily usable obsfate definition for end-users that don't want to customize it. Such output would ultimately get included in the default log output. Here are some output examples for a commit amended: rewritten using amend as 5:a9b1f8652753 by test (at 1970-01-01 00:00 +0000) Next patches will make the output dependent on the verbosity. Exemple of use-cases: For having the obsfate on a single-line between brackets: {if(obsfate, " [{join(obsfate, "; ")}]")} For having the obsfate in several lines: {if(obsfate, "{obsfate % " Obsfate: {fate}\n"}")}
author Boris Feld <boris.feld@octobus.net>
date Thu, 05 Oct 2017 17:42:56 +0200
parents 06b52671552b
children 62a4ccf9784a
comparison
equal deleted inserted replaced
34846:f05a6e015ecc 34847:e27f1f04c2cf
1 $ cat >> $HGRCPATH << EOF 1 $ cat >> $HGRCPATH << EOF
2 > [phases] 2 > [phases]
3 > # public changeset are not obsolete 3 > # public changeset are not obsolete
4 > publish=false 4 > publish=false
5 > [ui] 5 > [ui]
6 > logtemplate="{rev}:{node|short} ({phase}{if(obsolete, ' *{obsolete}*')}{if(instabilities, ' {instabilities}')}) [{tags} {bookmarks}] {desc|firstline}\n" 6 > logtemplate="{rev}:{node|short} ({phase}{if(obsolete, ' *{obsolete}*')}{if(instabilities, ' {instabilities}')}) [{tags} {bookmarks}] {desc|firstline}{if(obsfate, " [{join(obsfate, "; ")}]")}\n"
7 > EOF 7 > EOF
8 $ mkcommit() { 8 $ mkcommit() {
9 > echo "$1" > "$1" 9 > echo "$1" > "$1"
10 > hg add "$1" 10 > hg add "$1"
11 > hg ci -m "add $1" 11 > hg ci -m "add $1"
157 157
158 $ hg heads 158 $ hg heads
159 5:5601fb93a350 (draft) [tip ] add new_3_c 159 5:5601fb93a350 (draft) [tip ] add new_3_c
160 $ hg heads --hidden 160 $ hg heads --hidden
161 5:5601fb93a350 (draft) [tip ] add new_3_c 161 5:5601fb93a350 (draft) [tip ] add new_3_c
162 4:ca819180edb9 (draft *obsolete*) [ ] add new_2_c 162 4:ca819180edb9 (draft *obsolete*) [ ] add new_2_c [rewritten as 5:5601fb93a350 by test (between 1970-01-01 00:22 +0000 and 1970-01-01 00:22 +0000)]
163 3:cdbce2fbb163 (draft *obsolete*) [ ] add new_c 163 3:cdbce2fbb163 (draft *obsolete*) [ ] add new_c [rewritten as 4:ca819180edb9 by test (at 1970-01-01 00:22 +0000)]
164 2:245bde4270cd (draft *obsolete*) [ ] add original_c 164 2:245bde4270cd (draft *obsolete*) [ ] add original_c [rewritten as 3:cdbce2fbb163 by test (at 1970-01-01 00:00 -0002)]
165 165
166 166
167 check that summary does not report them 167 check that summary does not report them
168 168
169 $ hg init ../sink 169 $ hg init ../sink
275 Basic exclusive testing 275 Basic exclusive testing
276 276
277 $ hg log -G --hidden 277 $ hg log -G --hidden
278 @ 6:6f9641995072 (draft) [tip ] add n3w_3_c 278 @ 6:6f9641995072 (draft) [tip ] add n3w_3_c
279 | 279 |
280 | x 5:5601fb93a350 (draft *obsolete*) [ ] add new_3_c 280 | x 5:5601fb93a350 (draft *obsolete*) [ ] add new_3_c [rewritten as 6:6f9641995072 by test (at 1970-01-01 00:22 +0000)]
281 |/ 281 |/
282 | x 4:ca819180edb9 (draft *obsolete*) [ ] add new_2_c 282 | x 4:ca819180edb9 (draft *obsolete*) [ ] add new_2_c [rewritten as 5:5601fb93a350 by test (between 1970-01-01 00:22 +0000 and 1970-01-01 00:22 +0000)]
283 |/ 283 |/
284 | x 3:cdbce2fbb163 (draft *obsolete*) [ ] add new_c 284 | x 3:cdbce2fbb163 (draft *obsolete*) [ ] add new_c [rewritten as 4:ca819180edb9 by test (at 1970-01-01 00:22 +0000)]
285 |/ 285 |/
286 | o 2:245bde4270cd (public) [ ] add original_c 286 | o 2:245bde4270cd (public) [ ] add original_c
287 |/ 287 |/
288 o 1:7c3bad9141dc (public) [ ] add b 288 o 1:7c3bad9141dc (public) [ ] add b
289 | 289 |
433 updating to branch default 433 updating to branch default
434 3 files updated, 0 files merged, 0 files removed, 0 files unresolved 434 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
435 $ hg -R clone-dest log -G --hidden 435 $ hg -R clone-dest log -G --hidden
436 @ 6:6f9641995072 (draft) [tip ] add n3w_3_c 436 @ 6:6f9641995072 (draft) [tip ] add n3w_3_c
437 | 437 |
438 | x 5:5601fb93a350 (draft *obsolete*) [ ] add new_3_c 438 | x 5:5601fb93a350 (draft *obsolete*) [ ] add new_3_c [rewritten as 6:6f9641995072 by test (at 1970-01-01 00:22 +0000)]
439 |/ 439 |/
440 | x 4:ca819180edb9 (draft *obsolete*) [ ] add new_2_c 440 | x 4:ca819180edb9 (draft *obsolete*) [ ] add new_2_c [rewritten as 5:5601fb93a350 by test (between 1970-01-01 00:22 +0000 and 1970-01-01 00:22 +0000)]
441 |/ 441 |/
442 | x 3:cdbce2fbb163 (draft *obsolete*) [ ] add new_c 442 | x 3:cdbce2fbb163 (draft *obsolete*) [ ] add new_c [rewritten as 4:ca819180edb9 by test (at 1970-01-01 00:22 +0000)]
443 |/ 443 |/
444 | o 2:245bde4270cd (public) [ ] add original_c 444 | o 2:245bde4270cd (public) [ ] add original_c
445 |/ 445 |/
446 o 1:7c3bad9141dc (public) [ ] add b 446 o 1:7c3bad9141dc (public) [ ] add b
447 | 447 |
518 $ hg debugobsolete --record-parents `getid original_d` -d '0 0' 518 $ hg debugobsolete --record-parents `getid original_d` -d '0 0'
519 obsoleted 1 changesets 519 obsoleted 1 changesets
520 $ hg debugobsolete | grep `getid original_d` 520 $ hg debugobsolete | grep `getid original_d`
521 94b33453f93bdb8d457ef9b770851a618bf413e1 0 {6f96419950729f3671185b847352890f074f7557} (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} 521 94b33453f93bdb8d457ef9b770851a618bf413e1 0 {6f96419950729f3671185b847352890f074f7557} (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
522 $ hg log -r 'obsolete()' 522 $ hg log -r 'obsolete()'
523 4:94b33453f93b (draft *obsolete*) [ ] add original_d 523 4:94b33453f93b (draft *obsolete*) [ ] add original_d [pruned by test (at 1970-01-01 00:00 +0000)]
524 $ hg summary 524 $ hg summary
525 parent: 5:cda648ca50f5 tip (orphan) 525 parent: 5:cda648ca50f5 tip (orphan)
526 add original_e 526 add original_e
527 branch: default 527 branch: default
528 commit: (clean) 528 commit: (clean)
530 phases: 3 draft 530 phases: 3 draft
531 orphan: 1 changesets 531 orphan: 1 changesets
532 $ hg log -G -r '::orphan()' 532 $ hg log -G -r '::orphan()'
533 @ 5:cda648ca50f5 (draft orphan) [tip ] add original_e 533 @ 5:cda648ca50f5 (draft orphan) [tip ] add original_e
534 | 534 |
535 x 4:94b33453f93b (draft *obsolete*) [ ] add original_d 535 x 4:94b33453f93b (draft *obsolete*) [ ] add original_d [pruned by test (at 1970-01-01 00:00 +0000)]
536 | 536 |
537 o 3:6f9641995072 (draft) [ ] add n3w_3_c 537 o 3:6f9641995072 (draft) [ ] add n3w_3_c
538 | 538 |
539 o 1:7c3bad9141dc (public) [ ] add b 539 o 1:7c3bad9141dc (public) [ ] add b
540 | 540 |
569 searching for changes 569 searching for changes
570 0:1f0dee641bb7 (public) [ ] add a 570 0:1f0dee641bb7 (public) [ ] add a
571 1:7c3bad9141dc (public) [ ] add b 571 1:7c3bad9141dc (public) [ ] add b
572 2:245bde4270cd (public) [ ] add original_c 572 2:245bde4270cd (public) [ ] add original_c
573 3:6f9641995072 (draft) [ ] add n3w_3_c 573 3:6f9641995072 (draft) [ ] add n3w_3_c
574 4:94b33453f93b (draft *obsolete*) [ ] add original_d 574 4:94b33453f93b (draft *obsolete*) [ ] add original_d [pruned by test (at 1970-01-01 00:00 +0000)]
575 5:cda648ca50f5 (draft orphan) [tip ] add original_e 575 5:cda648ca50f5 (draft orphan) [tip ] add original_e
576 $ hg push ../tmpf -f # -f because be push unstable too 576 $ hg push ../tmpf -f # -f because be push unstable too
577 pushing to ../tmpf 577 pushing to ../tmpf
578 searching for changes 578 searching for changes
579 adding changesets 579 adding changesets
593 Do not warn about new head when the new head is a successors of a remote one 593 Do not warn about new head when the new head is a successors of a remote one
594 594
595 $ hg log -G 595 $ hg log -G
596 @ 5:cda648ca50f5 (draft orphan) [tip ] add original_e 596 @ 5:cda648ca50f5 (draft orphan) [tip ] add original_e
597 | 597 |
598 x 4:94b33453f93b (draft *obsolete*) [ ] add original_d 598 x 4:94b33453f93b (draft *obsolete*) [ ] add original_d [pruned by test (at 1970-01-01 00:00 +0000)]
599 | 599 |
600 o 3:6f9641995072 (draft) [ ] add n3w_3_c 600 o 3:6f9641995072 (draft) [ ] add n3w_3_c
601 | 601 |
602 | o 2:245bde4270cd (public) [ ] add original_c 602 | o 2:245bde4270cd (public) [ ] add original_c
603 |/ 603 |/
634 Reminder of the repo situation 634 Reminder of the repo situation
635 635
636 $ hg log --hidden --graph 636 $ hg log --hidden --graph
637 @ 6:3de5eca88c00 (draft) [tip ] add obsolete_e 637 @ 6:3de5eca88c00 (draft) [tip ] add obsolete_e
638 | 638 |
639 | x 5:cda648ca50f5 (draft *obsolete*) [ ] add original_e 639 | x 5:cda648ca50f5 (draft *obsolete*) [ ] add original_e [rewritten as 6:3de5eca88c00 by test <test@example.net> (at 1970-01-01 00:00 +0000)]
640 | | 640 | |
641 | x 4:94b33453f93b (draft *obsolete*) [ ] add original_d 641 | x 4:94b33453f93b (draft *obsolete*) [ ] add original_d [pruned by test (at 1970-01-01 00:00 +0000)]
642 |/ 642 |/
643 o 3:6f9641995072 (draft) [ ] add n3w_3_c 643 o 3:6f9641995072 (draft) [ ] add n3w_3_c
644 | 644 |
645 | o 2:245bde4270cd (public) [ ] add original_c 645 | o 2:245bde4270cd (public) [ ] add original_c
646 |/ 646 |/
926 926
927 927
928 test the "obsolete" templatekw 928 test the "obsolete" templatekw
929 929
930 $ hg log -r 'obsolete()' 930 $ hg log -r 'obsolete()'
931 6:3de5eca88c00 (draft *obsolete*) [ ] add obsolete_e 931 6:3de5eca88c00 (draft *obsolete*) [ ] add obsolete_e [pruned by test (at 1970-01-01 00:00 +0000)]
932 932
933 test the "troubles" templatekw 933 test the "troubles" templatekw
934 934
935 $ hg log -r 'phasedivergent() and orphan()' 935 $ hg log -r 'phasedivergent() and orphan()'
936 7:50c51b361e60 (draft orphan phase-divergent) [ ] add babar 936 7:50c51b361e60 (draft orphan phase-divergent) [ ] add babar
1096 1096
1097 $ hg tag -l visible -r 1 --hidden 1097 $ hg tag -l visible -r 1 --hidden
1098 $ hg log -G 1098 $ hg log -G
1099 @ 2:323a9c3ddd91 (draft) [tip ] A 1099 @ 2:323a9c3ddd91 (draft) [tip ] A
1100 | 1100 |
1101 | x 1:29f0c6921ddd (draft *obsolete*) [visible ] A 1101 | x 1:29f0c6921ddd (draft *obsolete*) [visible ] A [rewritten using amend as 2:323a9c3ddd91 by test (at 1970-01-01 00:00 +0000)]
1102 |/ 1102 |/
1103 o 0:d20a80d4def3 (draft) [ ] base 1103 o 0:d20a80d4def3 (draft) [ ] base
1104 1104
1105 Test that removing a local tag does not cause some commands to fail 1105 Test that removing a local tag does not cause some commands to fail
1106 1106
1150 $ echo "B+" >> foo 1150 $ echo "B+" >> foo
1151 $ hg ci --amend -m "B+" 1151 $ hg ci --amend -m "B+"
1152 $ hg log -G --hidden 1152 $ hg log -G --hidden
1153 @ 2:b7d587542d40 (draft) [tip ] B+ 1153 @ 2:b7d587542d40 (draft) [tip ] B+
1154 | 1154 |
1155 | x 1:44526ebb0f98 (draft *obsolete*) [ ] B 1155 | x 1:44526ebb0f98 (draft *obsolete*) [ ] B [rewritten using amend as 2:b7d587542d40 by test (at 1970-01-01 00:00 +0000)]
1156 |/ 1156 |/
1157 o 0:4b34ecfb0d56 (draft) [ ] A 1157 o 0:4b34ecfb0d56 (draft) [ ] A
1158 1158
1159 1159
1160 $ hg incoming ../repo-bundleoverlay --bundle ../bundleoverlay.hg 1160 $ hg incoming ../repo-bundleoverlay --bundle ../bundleoverlay.hg
1277 13bedc178fce tip 1277 13bedc178fce tip
1278 $ echo "hello" > b 1278 $ echo "hello" > b
1279 $ hg commit --amend -m "message" 1279 $ hg commit --amend -m "message"
1280 $ hg book bookb -r 13bedc178fce --hidden 1280 $ hg book bookb -r 13bedc178fce --hidden
1281 $ hg log -r 13bedc178fce 1281 $ hg log -r 13bedc178fce
1282 4:13bedc178fce (draft *obsolete*) [ bookb] add b 1282 4:13bedc178fce (draft *obsolete*) [ bookb] add b [rewritten using amend as 5:a9b1f8652753 by test (at 1970-01-01 00:00 +0000)]
1283 $ hg book -d bookb 1283 $ hg book -d bookb
1284 $ hg log -r 13bedc178fce 1284 $ hg log -r 13bedc178fce
1285 abort: hidden revision '13bedc178fce'! 1285 abort: hidden revision '13bedc178fce'!
1286 (use --hidden to access hidden revisions) 1286 (use --hidden to access hidden revisions)
1287 [255] 1287 [255]
1317 o 0:a78f55e5508c (draft) [ ] 0 1317 o 0:a78f55e5508c (draft) [ ] 0
1318 1318
1319 $ hg log -G --hidden 1319 $ hg log -G --hidden
1320 @ 3:b0551702f918 (draft) [tip ] 2 1320 @ 3:b0551702f918 (draft) [tip ] 2
1321 | 1321 |
1322 | x 2:e008cf283490 (draft *obsolete*) [ ] 2 1322 | x 2:e008cf283490 (draft *obsolete*) [ ] 2 [rewritten using amend as 3:b0551702f918 by test (at 1970-01-01 00:00 +0000)]
1323 |/ 1323 |/
1324 o 1:e016b03fd86f (draft) [ ] 1 1324 o 1:e016b03fd86f (draft) [ ] 1
1325 | 1325 |
1326 o 0:a78f55e5508c (draft) [ ] 0 1326 o 0:a78f55e5508c (draft) [ ] 0
1327 1327