[PATCH 11 of 12] templatekw: add a keyword to list all labels
Sean Farley
sean.michael.farley at gmail.com
Mon Aug 18 21:18:07 UTC 2014
# HG changeset patch
# User Sean Farley <sean.michael.farley at gmail.com>
# Date 1408394525 18000
# Mon Aug 18 15:42:05 2014 -0500
# Node ID e1ab9da20be237323a1340efa16b58b03525596f
# Parent f49b99874b05d0a902f8ed02201d9e57fc81c684
templatekw: add a keyword to list all labels
diff --git a/mercurial/templatekw.py b/mercurial/templatekw.py
--- a/mercurial/templatekw.py
+++ b/mercurial/templatekw.py
@@ -374,10 +374,16 @@ def showsubrepos(**args):
def showtags(**args):
""":tags: List of strings. Any tags associated with the changeset."""
return showlist('tag', args['ctx'].tags(), **args)
+def showlabels(**args):
+ """:tags: List of strings. Any labels in the namespace `namespace`
+ associated with the changeset."""
+ labels = sorted(l[0] for l in args['repo'].nodelabels(args['ctx'].node()))
+ return showlist('label', labels, **args)
+
# keywords are callables like:
# fn(repo, ctx, templ, cache, revcache, **args)
# with:
# repo - current repository instance
# ctx - the changectx being displayed
@@ -400,10 +406,11 @@ keywords = {
'file_copies': showfilecopies,
'file_copies_switch': showfilecopiesswitch,
'file_dels': showfiledels,
'file_mods': showfilemods,
'files': showfiles,
+ 'labels': showlabels,
'latesttag': showlatesttag,
'latesttagdistance': showlatesttagdistance,
'manifest': showmanifest,
'node': shownode,
'p1rev': showp1rev,
More information about the Mercurial-devel
mailing list