preferredremotebranches: add a template keyword

This commit is contained in:
Sean Farley 2014-03-22 15:18:00 -05:00
parent 952dad0680
commit 013442e572

View File

@ -368,4 +368,19 @@ def remotebrancheskw(**args):
return templatekw.showlist('remotebranch', names,
plural='remotebranches', **args)
def preferredremotebrancheskw(**args):
""":preferredremotebranches: List of strings. List of remote bookmarks and
branches associated with the changeset where bookmarks are preferred over
displaying branches.
"""
repo, ctx = args['repo'], args['ctx']
remotenames = sorted([name for name, node in
repo._preferredremotebranches.iteritems()
if node == ctx.node()])
if remotenames:
return templatekw.showlist('remotebranch', remotenames,
plural='remotebranches', **args)
templatekw.keywords['remotebranches'] = remotebrancheskw
templatekw.keywords['preferredremotebranches'] = preferredremotebrancheskw