# HG changeset patch # User Rodrigo Damazio Bovendorp # Date 1577508013 28800 # Node ID 1fda186ae6b7ff56b041fb4c7b343199914ee048 # Parent 353e546ab324e8c637dbd6334c2489abebde54b7 obslog: add display of precursor information to the default template This will still only be output when the user passes --precursors to the command (otherwise the data just won't be there). This addresses a common user request, where they actually would find more intuitive to use --precursors --no-successors. diff -r 353e546ab324 -r 1fda186ae6b7 hgext3rd/evolve/obshistory.py --- a/hgext3rd/evolve/obshistory.py Fri Dec 27 20:38:10 2019 -0800 +++ b/hgext3rd/evolve/obshistory.py Fri Dec 27 20:40:13 2019 -0800 @@ -113,9 +113,20 @@ } TEMPLATE_VERB = b"""{label("evolve.verb", verb)}""" TEMPLATE_SUCCNODES = b"""{label("evolve.node", join(succnodes % "{succnode|short}", ", "))}""" -TEMPLATE_REWRITE = b"""{if(succnodes, "%(verb)s{if(effects, "({join(effects, ", ")})")} as %(succnodes)s", "pruned")}""" % { +TEMPLATE_PRECNODE = b"""{label("evolve.node", precnode|short)}""" +TEMPLATE_REWRITE_NODES = b"""{ifeq(nodetype, "precursor", "as %(succnodes)s", "from %(precnode)s")}""" % { + b"succnodes": TEMPLATE_SUCCNODES, + b"precnode": TEMPLATE_PRECNODE, +} +TEMPLATE_REWRITE_MARKER = b"""%(verb)s{if(effects, "({join(effects, ", ")})")} %(nodes)s""" % { b"verb": TEMPLATE_VERB, - b"succnodes": TEMPLATE_SUCCNODES + b"nodes": TEMPLATE_REWRITE_NODES, +} +# Output the marker details if either this is the successor of the marker or +# there are successors. +TEMPLATE_REWRITE = b"""{ +ifeq(nodetype, "successor", "%(marker)s", if(succnodes, "%(marker)s", "pruned"))}""" % { + b"marker": TEMPLATE_REWRITE_MARKER, } TEMPLATE_OPERATION = b"""{if(operation, "using {label("evolve.operation", operation)}")}""" TEMPLATE_USER = b"""by {label("evolve.user", user)}""" diff -r 353e546ab324 -r 1fda186ae6b7 tests/test-evolve-obshistory-amend.t --- a/tests/test-evolve-obshistory-amend.t Fri Dec 27 20:38:10 2019 -0800 +++ b/tests/test-evolve-obshistory-amend.t Fri Dec 27 20:40:13 2019 -0800 @@ -67,6 +67,21 @@ +42 + $ hg obslog --precursors 4ae3a4151de9 + @ 4ae3a4151de9 (2) A1 + | rewritten(description, content) from 471f378eab4c using amend by test (Thu Jan 01 00:00:00 1970 +0000) + | + x 471f378eab4c (1) A0 + rewritten(description, content) as 4ae3a4151de9 using amend by test (Thu Jan 01 00:00:00 1970 +0000) + + + $ hg obslog --precursors --no-successors 4ae3a4151de9 + @ 4ae3a4151de9 (2) A1 + | rewritten(description, content) from 471f378eab4c using amend by test (Thu Jan 01 00:00:00 1970 +0000) + | + x 471f378eab4c (1) A0 + + $ hg obslog --patch --color debug @ [evolve.node|4ae3a4151de9] [evolve.rev|(2)] [evolve.short_description|A1] | diff -r 353e546ab324 -r 1fda186ae6b7 tests/test-evolve-obshistory-complex.t --- a/tests/test-evolve-obshistory-complex.t Fri Dec 27 20:38:10 2019 -0800 +++ b/tests/test-evolve-obshistory-complex.t Fri Dec 27 20:40:13 2019 -0800 @@ -469,3 +469,53 @@ x c473644ee0e9 (2) B rewritten(description, parent, content) as b868bc49b0a4 using fold by test (Thu Jan 01 00:00:00 1970 +0000) + + $ hg obslog --precursors --no-successors --all 15 + o 19e14c8397fc (10) fold0 + | rewritten(parent, content) from b868bc49b0a4 using split by test (Thu Jan 01 00:00:00 1970 +0000) + | + | * 7b3290f6e0a0 (12) fold1 + | |\ rewritten(parent, content) from d15d0ffc75f6 using split by test (Thu Jan 01 00:00:00 1970 +0000) + | | | rewritten(description, parent, content) from e036916b63ea using prune by test (Thu Jan 01 00:00:00 1970 +0000) + | | | + | | | @ d4a000f63ee9 (15) fold2 + | | | | rewritten(parent, content) from 100cc25b765f using split by test (Thu Jan 01 00:00:00 1970 +0000) + | | | | + | | | | * ec31316faa9d (14) fold2 + | | | |/| rewritten(parent, content) from 100cc25b765f using split by test (Thu Jan 01 00:00:00 1970 +0000) + | | | | | rewritten(description, parent, content) from d0f33db50670 using prune by test (Thu Jan 01 00:00:00 1970 +0000) + | | | | | note: this is a note stored in obsmarker in prune + | | | | | + | | | x | 100cc25b765f (9) fold2 + | | | |\ \ rewritten(description, content) from 0da815c333f6 using fold by test (Thu Jan 01 00:00:00 1970 +0000) + | | | | | | note: folding changesets to test + | | | | | | rewritten(description, parent, content) from d9f908fde1a1 using fold by test (Thu Jan 01 00:00:00 1970 +0000) + | | | | | | note: folding changesets to test + | | | | | | + | +-------x d0f33db50670 (13) fold1 + | | | | | rewritten(parent, content) from d15d0ffc75f6 using split by test (Thu Jan 01 00:00:00 1970 +0000) + | | | | | + +---x | | e036916b63ea (11) fold0 + | | / / rewritten(parent, content) from b868bc49b0a4 using split by test (Thu Jan 01 00:00:00 1970 +0000) + | | | | + | | x / 0da815c333f6 (5) E + | | / + x | | b868bc49b0a4 (7) fold0 + |\ \ \ rewritten(description, content) from 2a34000d3544 using fold by test (Thu Jan 01 00:00:00 1970 +0000) + | | | | rewritten(description, parent, content) from c473644ee0e9 using fold by test (Thu Jan 01 00:00:00 1970 +0000) + | | | | + | | x | d15d0ffc75f6 (8) fold1 + | | |\ \ rewritten(description, parent, content) from 868d2e0eb19c using fold by test (Thu Jan 01 00:00:00 1970 +0000) + | | | | | rewritten(description, content) from a8df460dbbfe using fold by test (Thu Jan 01 00:00:00 1970 +0000) + | | | | | + | | | | x d9f908fde1a1 (6) F + | | | | + x | | | 2a34000d3544 (1) A + / / / + | x / 868d2e0eb19c (4) D + | / + | x a8df460dbbfe (3) C + | + x c473644ee0e9 (2) B + +