Patchwork [STABLE] templatekw: re-add showtags() to list tags keyword up in online help

login
register
mail settings
Submitter Katsunori FUJIWARA
Date Feb. 1, 2015, 12:43 a.m.
Message ID <73a146afa65f277d8620.1422751399@feefifofum>
Download mbox | patch
Permalink /patch/7586/
State Accepted
Commit 0870bb93573c876ee263161663763393365ea195
Headers show

Comments

Katsunori FUJIWARA - Feb. 1, 2015, 12:43 a.m.
# HG changeset patch
# User FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
# Date 1422751007 -32400
#      Sun Feb 01 09:36:47 2015 +0900
# Branch stable
# Node ID 73a146afa65f277d86204ca6fee2204548ac78ff
# Parent  6becb9dbca25057c6186e255a48dd2c2ce5701a5
templatekw: re-add showtags() to list tags keyword up in online help

Changeset d69a7fc68ad5 removed "showtags()" definition for "tags"
template keyword from "templatekw.py", because "namespaces" puts a
helper function for it into template keyword map automatically. This
works correctly from the point of view of templating functionality.

But on the other hand, it removed "tags" template keyword from "hg
help templates" unexpectedly, because online help text is built before
"namespaces" puts a helper function for "tags" into template keyword
map.

This patch is a kind of backing d69a7fc68ad5 out, but this implements
"showtags()" with newly introduced "shownames()" instead of originally
used "showlist()".
Sean Farley - Feb. 1, 2015, 3:10 a.m.
FUJIWARA Katsunori writes:

> # HG changeset patch
> # User FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
> # Date 1422751007 -32400
> #      Sun Feb 01 09:36:47 2015 +0900
> # Branch stable
> # Node ID 73a146afa65f277d86204ca6fee2204548ac78ff
> # Parent  6becb9dbca25057c6186e255a48dd2c2ce5701a5
> templatekw: re-add showtags() to list tags keyword up in online help
>
> Changeset d69a7fc68ad5 removed "showtags()" definition for "tags"
> template keyword from "templatekw.py", because "namespaces" puts a
> helper function for it into template keyword map automatically. This
> works correctly from the point of view of templating functionality.
>
> But on the other hand, it removed "tags" template keyword from "hg
> help templates" unexpectedly, because online help text is built before
> "namespaces" puts a helper function for "tags" into template keyword
> map.

Ah, thanks for noticing that! After the freeze, I think it'd be worth
visiting getting 'hg help template' to display the namespace template
methods correctly.
Matt Mackall - Feb. 1, 2015, 8:17 p.m.
On Sun, 2015-02-01 at 09:43 +0900, FUJIWARA Katsunori wrote:
> # HG changeset patch
> # User FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
> # Date 1422751007 -32400
> #      Sun Feb 01 09:36:47 2015 +0900
> # Branch stable
> # Node ID 73a146afa65f277d86204ca6fee2204548ac78ff
> # Parent  6becb9dbca25057c6186e255a48dd2c2ce5701a5
> templatekw: re-add showtags() to list tags keyword up in online help

Queued for stable, thanks.

Patch

diff --git a/mercurial/templatekw.py b/mercurial/templatekw.py
--- a/mercurial/templatekw.py
+++ b/mercurial/templatekw.py
@@ -382,6 +382,13 @@ 
     names = ns.names(repo, ctx.node())
     return showlist(ns.templatename, names, plural=namespace, **args)
 
+# don't remove "showtags" definition, even though namespaces will put
+# a helper function for "tags" keyword into "keywords" map automatically,
+# because online help text is built without namespaces initialization
+def showtags(**args):
+    """:tags: List of strings. Any tags associated with the changeset."""
+    return shownames('tags', **args)
+
 # keywords are callables like:
 # fn(repo, ctx, templ, cache, revcache, **args)
 # with:
@@ -420,6 +427,7 @@ 
     'phaseidx': showphaseidx,
     'rev': showrev,
     'subrepos': showsubrepos,
+    'tags': showtags,
 }
 
 def _showparents(**args):