Mercurial > hg
diff 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 |
line wrap: on
line diff
--- a/tests/test-obsolete.t Tue Oct 10 02:25:03 2017 +0530 +++ b/tests/test-obsolete.t Thu Oct 05 17:42:56 2017 +0200 @@ -3,7 +3,7 @@ > # public changeset are not obsolete > publish=false > [ui] - > logtemplate="{rev}:{node|short} ({phase}{if(obsolete, ' *{obsolete}*')}{if(instabilities, ' {instabilities}')}) [{tags} {bookmarks}] {desc|firstline}\n" + > logtemplate="{rev}:{node|short} ({phase}{if(obsolete, ' *{obsolete}*')}{if(instabilities, ' {instabilities}')}) [{tags} {bookmarks}] {desc|firstline}{if(obsfate, " [{join(obsfate, "; ")}]")}\n" > EOF $ mkcommit() { > echo "$1" > "$1" @@ -159,9 +159,9 @@ 5:5601fb93a350 (draft) [tip ] add new_3_c $ hg heads --hidden 5:5601fb93a350 (draft) [tip ] add new_3_c - 4:ca819180edb9 (draft *obsolete*) [ ] add new_2_c - 3:cdbce2fbb163 (draft *obsolete*) [ ] add new_c - 2:245bde4270cd (draft *obsolete*) [ ] add original_c + 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)] + 3:cdbce2fbb163 (draft *obsolete*) [ ] add new_c [rewritten as 4:ca819180edb9 by test (at 1970-01-01 00:22 +0000)] + 2:245bde4270cd (draft *obsolete*) [ ] add original_c [rewritten as 3:cdbce2fbb163 by test (at 1970-01-01 00:00 -0002)] check that summary does not report them @@ -277,11 +277,11 @@ $ hg log -G --hidden @ 6:6f9641995072 (draft) [tip ] add n3w_3_c | - | x 5:5601fb93a350 (draft *obsolete*) [ ] add new_3_c + | x 5:5601fb93a350 (draft *obsolete*) [ ] add new_3_c [rewritten as 6:6f9641995072 by test (at 1970-01-01 00:22 +0000)] |/ - | x 4:ca819180edb9 (draft *obsolete*) [ ] add new_2_c + | 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)] |/ - | x 3:cdbce2fbb163 (draft *obsolete*) [ ] add new_c + | x 3:cdbce2fbb163 (draft *obsolete*) [ ] add new_c [rewritten as 4:ca819180edb9 by test (at 1970-01-01 00:22 +0000)] |/ | o 2:245bde4270cd (public) [ ] add original_c |/ @@ -435,11 +435,11 @@ $ hg -R clone-dest log -G --hidden @ 6:6f9641995072 (draft) [tip ] add n3w_3_c | - | x 5:5601fb93a350 (draft *obsolete*) [ ] add new_3_c + | x 5:5601fb93a350 (draft *obsolete*) [ ] add new_3_c [rewritten as 6:6f9641995072 by test (at 1970-01-01 00:22 +0000)] |/ - | x 4:ca819180edb9 (draft *obsolete*) [ ] add new_2_c + | 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)] |/ - | x 3:cdbce2fbb163 (draft *obsolete*) [ ] add new_c + | x 3:cdbce2fbb163 (draft *obsolete*) [ ] add new_c [rewritten as 4:ca819180edb9 by test (at 1970-01-01 00:22 +0000)] |/ | o 2:245bde4270cd (public) [ ] add original_c |/ @@ -520,7 +520,7 @@ $ hg debugobsolete | grep `getid original_d` 94b33453f93bdb8d457ef9b770851a618bf413e1 0 {6f96419950729f3671185b847352890f074f7557} (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} $ hg log -r 'obsolete()' - 4:94b33453f93b (draft *obsolete*) [ ] add original_d + 4:94b33453f93b (draft *obsolete*) [ ] add original_d [pruned by test (at 1970-01-01 00:00 +0000)] $ hg summary parent: 5:cda648ca50f5 tip (orphan) add original_e @@ -532,7 +532,7 @@ $ hg log -G -r '::orphan()' @ 5:cda648ca50f5 (draft orphan) [tip ] add original_e | - x 4:94b33453f93b (draft *obsolete*) [ ] add original_d + x 4:94b33453f93b (draft *obsolete*) [ ] add original_d [pruned by test (at 1970-01-01 00:00 +0000)] | o 3:6f9641995072 (draft) [ ] add n3w_3_c | @@ -571,7 +571,7 @@ 1:7c3bad9141dc (public) [ ] add b 2:245bde4270cd (public) [ ] add original_c 3:6f9641995072 (draft) [ ] add n3w_3_c - 4:94b33453f93b (draft *obsolete*) [ ] add original_d + 4:94b33453f93b (draft *obsolete*) [ ] add original_d [pruned by test (at 1970-01-01 00:00 +0000)] 5:cda648ca50f5 (draft orphan) [tip ] add original_e $ hg push ../tmpf -f # -f because be push unstable too pushing to ../tmpf @@ -595,7 +595,7 @@ $ hg log -G @ 5:cda648ca50f5 (draft orphan) [tip ] add original_e | - x 4:94b33453f93b (draft *obsolete*) [ ] add original_d + x 4:94b33453f93b (draft *obsolete*) [ ] add original_d [pruned by test (at 1970-01-01 00:00 +0000)] | o 3:6f9641995072 (draft) [ ] add n3w_3_c | @@ -636,9 +636,9 @@ $ hg log --hidden --graph @ 6:3de5eca88c00 (draft) [tip ] add obsolete_e | - | x 5:cda648ca50f5 (draft *obsolete*) [ ] add original_e + | x 5:cda648ca50f5 (draft *obsolete*) [ ] add original_e [rewritten as 6:3de5eca88c00 by test <test@example.net> (at 1970-01-01 00:00 +0000)] | | - | x 4:94b33453f93b (draft *obsolete*) [ ] add original_d + | x 4:94b33453f93b (draft *obsolete*) [ ] add original_d [pruned by test (at 1970-01-01 00:00 +0000)] |/ o 3:6f9641995072 (draft) [ ] add n3w_3_c | @@ -928,7 +928,7 @@ test the "obsolete" templatekw $ hg log -r 'obsolete()' - 6:3de5eca88c00 (draft *obsolete*) [ ] add obsolete_e + 6:3de5eca88c00 (draft *obsolete*) [ ] add obsolete_e [pruned by test (at 1970-01-01 00:00 +0000)] test the "troubles" templatekw @@ -1098,7 +1098,7 @@ $ hg log -G @ 2:323a9c3ddd91 (draft) [tip ] A | - | x 1:29f0c6921ddd (draft *obsolete*) [visible ] A + | x 1:29f0c6921ddd (draft *obsolete*) [visible ] A [rewritten using amend as 2:323a9c3ddd91 by test (at 1970-01-01 00:00 +0000)] |/ o 0:d20a80d4def3 (draft) [ ] base @@ -1152,7 +1152,7 @@ $ hg log -G --hidden @ 2:b7d587542d40 (draft) [tip ] B+ | - | x 1:44526ebb0f98 (draft *obsolete*) [ ] B + | x 1:44526ebb0f98 (draft *obsolete*) [ ] B [rewritten using amend as 2:b7d587542d40 by test (at 1970-01-01 00:00 +0000)] |/ o 0:4b34ecfb0d56 (draft) [ ] A @@ -1279,7 +1279,7 @@ $ hg commit --amend -m "message" $ hg book bookb -r 13bedc178fce --hidden $ hg log -r 13bedc178fce - 4:13bedc178fce (draft *obsolete*) [ bookb] add b + 4:13bedc178fce (draft *obsolete*) [ bookb] add b [rewritten using amend as 5:a9b1f8652753 by test (at 1970-01-01 00:00 +0000)] $ hg book -d bookb $ hg log -r 13bedc178fce abort: hidden revision '13bedc178fce'! @@ -1319,7 +1319,7 @@ $ hg log -G --hidden @ 3:b0551702f918 (draft) [tip ] 2 | - | x 2:e008cf283490 (draft *obsolete*) [ ] 2 + | x 2:e008cf283490 (draft *obsolete*) [ ] 2 [rewritten using amend as 3:b0551702f918 by test (at 1970-01-01 00:00 +0000)] |/ o 1:e016b03fd86f (draft) [ ] 1 |