From 013442e5722b5914384def45b164167112757901 Mon Sep 17 00:00:00 2001 From: Sean Farley Date: Sat, 22 Mar 2014 15:18:00 -0500 Subject: [PATCH] preferredremotebranches: add a template keyword --- hg_remotebranches.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/hg_remotebranches.py b/hg_remotebranches.py index c6cd47f7dc..7dc824e9d9 100644 --- a/hg_remotebranches.py +++ b/hg_remotebranches.py @@ -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