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.
--- 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' ')
--- 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
|
--- 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