comparison mercurial/templatekw.py @ 27893:b42b2e86ef02

templatekw: move shownames() helper to be sorted alphabetically I'll add shownamespaces(), which is similar to this function. I want to put them nearby.
author Yuya Nishihara <yuya@tcha.org>
date Tue, 12 Jan 2016 23:53:56 +0900
parents ac8c0ee5c3b8
children a94f7eef3199
comparison
equal deleted inserted replaced
27892:83aef8d5bc1b 27893:b42b2e86ef02
411 return 411 return
412 args = args.copy() 412 args = args.copy()
413 args.update({'rev': repo.manifest.rev(mnode), 'node': hex(mnode)}) 413 args.update({'rev': repo.manifest.rev(mnode), 'node': hex(mnode)})
414 return templ('manifest', **args) 414 return templ('manifest', **args)
415 415
416 def shownames(namespace, **args):
417 """helper method to generate a template keyword for a namespace"""
418 ctx = args['ctx']
419 repo = ctx.repo()
420 ns = repo.names[namespace]
421 names = ns.names(repo, ctx.node())
422 return showlist(ns.templatename, names, plural=namespace, **args)
423
416 def shownode(repo, ctx, templ, **args): 424 def shownode(repo, ctx, templ, **args):
417 """:node: String. The changeset identification hash, as a 40 hexadecimal 425 """:node: String. The changeset identification hash, as a 40 hexadecimal
418 digit string. 426 digit string.
419 """ 427 """
420 return ctx.hex() 428 return ctx.hex()
486 subrepos.append(sub) # modified or newly added in ctx 494 subrepos.append(sub) # modified or newly added in ctx
487 for sub in psubstate: 495 for sub in psubstate:
488 if sub not in substate: 496 if sub not in substate:
489 subrepos.append(sub) # removed in ctx 497 subrepos.append(sub) # removed in ctx
490 return showlist('subrepo', sorted(subrepos), **args) 498 return showlist('subrepo', sorted(subrepos), **args)
491
492 def shownames(namespace, **args):
493 """helper method to generate a template keyword for a namespace"""
494 ctx = args['ctx']
495 repo = ctx.repo()
496 ns = repo.names[namespace]
497 names = ns.names(repo, ctx.node())
498 return showlist(ns.templatename, names, plural=namespace, **args)
499 499
500 # don't remove "showtags" definition, even though namespaces will put 500 # don't remove "showtags" definition, even though namespaces will put
501 # a helper function for "tags" keyword into "keywords" map automatically, 501 # a helper function for "tags" keyword into "keywords" map automatically,
502 # because online help text is built without namespaces initialization 502 # because online help text is built without namespaces initialization
503 def showtags(**args): 503 def showtags(**args):