[PATCH V2] evolve: add template to show evolution troubles (issue4686)
Pierre-Yves David
pierre-yves.david at ens-lyon.org
Wed Sep 7 06:15:32 EDT 2016
On 09/06/2016 10:32 AM, liscju wrote:
> # HG changeset patch
> # User liscju <piotr.listkiewicz at gmail.com>
> # Date 1473150616 -7200
> # Tue Sep 06 10:30:16 2016 +0200
> # Branch stable
> # Node ID 5273ba1d2b0027ce48238adfcf272adbfde9ddfe
> # Parent 7a2e0629bdee8cd842bb884094cef9683ed49520
> evolve: add template to show evolution troubles (issue4686)
You should use the 'evolve-ext' flag when submitting patch for evolve.
(also having more than one line of description is usually a good idea)
> diff --git a/hgext/evolve.py b/hgext/evolve.py
> --- a/hgext/evolve.py
> +++ b/hgext/evolve.py
> @@ -4048,6 +4048,14 @@ def clean(orig, repo, *args, **kwargs):
> util.unlinkpath(repo.join('evolvestate'), ignoremissing=True)
> return ret
>
> + at eh.wrapfunction(mercurial.templater, 'templatepaths')
> +def wraptemplatepaths(origfn):
> + origtemplatepaths = origfn()
> + datapath = os.path.dirname(__file__)
> + origtemplatepaths.append(
> + os.path.normpath(os.path.join(datapath, 'templates')))
> + return origtemplatepaths
What is this about? adding a new template directory for evolve?
As an unrelated notes, we should probaly improve core to make this more
straight forward.
> def _evolvestatewrite(repo, state):
> # [version]
> # [type][length][content]
> diff --git a/hgext/templates/map-cmdline.evolution b/hgext/templates/map-cmdline.evolution
> new file mode 100644
> --- /dev/null
> +++ b/hgext/templates/map-cmdline.evolution
> @@ -0,0 +1,6 @@
> +%include map-cmdline.default
> +changeset = '{cset}{levolution}{branches}{bookmarks}{tags}{parents}{user}{ldate}{summary}\n'
> +changeset_verbose = '{cset}{levolution}{branches}{bookmarks}{tags}{parents}{user}{ldate}{lfiles}{lfile_copies_switch}{description}\n'
> +
> +levolution = '{label("log.evolution",
> + "evolution: {join(troubles, ', ')}")}\n'
We should probably call this "troubles" and as someone else mention,
skip it when empty.
Having the data in the formatter data would be useful to (so that is
show up in -T json in all case.
> \ No newline at end of file
> diff --git a/tests/test-evolve-list.t b/tests/test-evolve-list.t
> --- a/tests/test-evolve-list.t
> +++ b/tests/test-evolve-list.t
> @@ -77,4 +77,42 @@ Test the divergence listing
> c882616e9d84: b
> divergent: a922b3733e98 (public) (precursor d2ae7f538514)
>
> +Show evolution troubles in log with evolution template
> +
> + $ hg log -T evolution
> + changeset: 5:a922b3733e98
> + evolution:
> + tag: tip
> + parent: 3:980f7dc84c29
> + user: test
> + date: Thu Jan 01 00:00:00 1970 +0000
> + summary: b
> +
> + changeset: 4:c882616e9d84
> + evolution: divergent
> + parent: 2:d36c0562f908
> + user: test
> + date: Thu Jan 01 00:00:00 1970 +0000
> + summary: b
> +
> + changeset: 3:980f7dc84c29
> + evolution:
> + parent: 0:cb9a9f314b8b
> + user: test
> + date: Thu Jan 01 00:00:00 1970 +0000
> + summary: d
> +
> + changeset: 2:d36c0562f908
> + evolution:
> + parent: 0:cb9a9f314b8b
> + user: test
> + date: Thu Jan 01 00:00:00 1970 +0000
> + summary: c
> +
> + changeset: 0:cb9a9f314b8b
> + evolution:
> + user: test
> + date: Thu Jan 01 00:00:00 1970 +0000
> + summary: a
--
Pierre-Yves David
More information about the Mercurial-devel
mailing list