comparison mercurial/templatekw.py @ 23977:0870bb93573c stable

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()".
author FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
date Sun, 01 Feb 2015 09:36:47 +0900
parents b56400eeefaf
children 75a2df2bbde8
comparison
equal deleted inserted replaced
23976:344939126579 23977:0870bb93573c
380 repo = ctx._repo 380 repo = ctx._repo
381 ns = repo.names[namespace] 381 ns = repo.names[namespace]
382 names = ns.names(repo, ctx.node()) 382 names = ns.names(repo, ctx.node())
383 return showlist(ns.templatename, names, plural=namespace, **args) 383 return showlist(ns.templatename, names, plural=namespace, **args)
384 384
385 # don't remove "showtags" definition, even though namespaces will put
386 # a helper function for "tags" keyword into "keywords" map automatically,
387 # because online help text is built without namespaces initialization
388 def showtags(**args):
389 """:tags: List of strings. Any tags associated with the changeset."""
390 return shownames('tags', **args)
391
385 # keywords are callables like: 392 # keywords are callables like:
386 # fn(repo, ctx, templ, cache, revcache, **args) 393 # fn(repo, ctx, templ, cache, revcache, **args)
387 # with: 394 # with:
388 # repo - current repository instance 395 # repo - current repository instance
389 # ctx - the changectx being displayed 396 # ctx - the changectx being displayed
418 'p2node': showp2node, 425 'p2node': showp2node,
419 'phase': showphase, 426 'phase': showphase,
420 'phaseidx': showphaseidx, 427 'phaseidx': showphaseidx,
421 'rev': showrev, 428 'rev': showrev,
422 'subrepos': showsubrepos, 429 'subrepos': showsubrepos,
430 'tags': showtags,
423 } 431 }
424 432
425 def _showparents(**args): 433 def _showparents(**args):
426 """:parents: List of strings. The parents of the changeset in "rev:node" 434 """:parents: List of strings. The parents of the changeset in "rev:node"
427 format. If the changeset has only one "natural" parent (the predecessor 435 format. If the changeset has only one "natural" parent (the predecessor