# HG changeset patch # User Martin von Zweigbergk # Date 1572906668 28800 # Node ID d1d8e97d32af05fc015edccc300770c9d179b2db # Parent 4101fab78314555c6109446f65d4f1a03e0464b2 obslog: make changeset available to templater obslog templating currently has very limited support for templating the precursor changeset (when available). The only available keywords are {node}, {rev}, and {shortdescription}. This patch makes the entire changeset available to the templater by passing it to formatter.context(). That function has been available since Mercurial 4.2. diff -r 4101fab78314 -r d1d8e97d32af hgext3rd/evolve/obshistory.py --- a/hgext3rd/evolve/obshistory.py Wed Oct 16 11:10:04 2019 -0700 +++ b/hgext3rd/evolve/obshistory.py Mon Nov 04 14:31:08 2019 -0800 @@ -478,6 +478,7 @@ shortdescription = shortdescription.splitlines()[0] fm.startitem() + fm.context(ctx=ctx) fm.write(b'node', b'%s', bytes(ctx), label=b"evolve.node") fm.plain(b' ') diff -r 4101fab78314 -r d1d8e97d32af tests/test-evolve-obshistory-amend.t --- a/tests/test-evolve-obshistory-amend.t Wed Oct 16 11:10:04 2019 -0700 +++ b/tests/test-evolve-obshistory-amend.t Mon Nov 04 14:31:08 2019 -0800 @@ -111,6 +111,13 @@ +42 + $ hg obslog 4ae3a4151de9 --graph -T'{label("log.summary", desc|firstline)} {if(markers, join(markers % "at {date|hgdate} by {user|person} ", " also "))}' + @ A1 + | + x A0 at 0 0 by test + + +Check that the same thing works with the old {shortdescription} form $ hg obslog 4ae3a4151de9 --graph -T'{label("log.summary", shortdescription)} {if(markers, join(markers % "at {date|hgdate} by {user|person} ", " also "))}' @ A1 | diff -r 4101fab78314 -r d1d8e97d32af tests/test-evolve-obshistory.t --- a/tests/test-evolve-obshistory.t Wed Oct 16 11:10:04 2019 -0700 +++ b/tests/test-evolve-obshistory.t Mon Nov 04 14:31:08 2019 -0800 @@ -168,3 +168,12 @@ [evolve.verb|rewritten](description) as [evolve.node|fdf9bde5129a] using [evolve.operation|amend] by [evolve.user|test] [evolve.date|(Thu Jan 01 00:00:00 1970 +0000)] (No patch available, successor is unknown locally) + + $ hg obslog 7a230b46bf61 --graph \ + > -T '{node} {rev} {desc|firstline}\n{markers % "rewritten using {operation}"}\n' + o 7a230b46bf61 2 A2 + | + x fdf9bde5129a + | rewritten using amend + @ 471f378eab4c 1 A0 + rewritten using amend