[PATCH 7 of 8] templater: add revbranches function
timeless at mozdev.org
timeless at mozdev.org
Thu Sep 10 22:36:45 CDT 2015
# HG changeset patch
# User timeless at mozdev.org
# Date 1441936391 14400
# Thu Sep 10 21:53:11 2015 -0400
# Node ID 7bd8bbb310c63c64c0b51187d095f867b6930ebd
# Parent 9cc5be267d6ffe26daf24049c71eb5d5ab3bf1a3
templater: add revbranches function
revbranches takes a revision and returns its branches
for use like:
{revset("...") % "{revision|revbranches}"}
diff --git a/mercurial/templater.py b/mercurial/templater.py
--- a/mercurial/templater.py
+++ b/mercurial/templater.py
@@ -591,6 +591,12 @@
ctx, repo = ctxrepo('revbisect', context, mapping, args)
return hbisect.label(repo, ctx.node())
+def revbranches(context, mapping, args):
+ """:revbranches(rev): Show branches.
+ See :hg:`help templates.branch`."""
+ ctx, repo = ctxrepo('revbranches', context, mapping, args)
+ return ctx.branch()
+
def revset(context, mapping, args):
""":revset(query[, formatargs...]): Execute a revision set query. See
:hg:`help revset`."""
@@ -788,6 +794,7 @@
"pad": pad,
"revauthor": revauthor,
"revbisect": revbisect,
+ "revbranches": revbranches,
"revdesc": revdesc,
"revfiles": revfiles,
"revset": revset,
diff --git a/tests/test-log.t b/tests/test-log.t
--- a/tests/test-log.t
+++ b/tests/test-log.t
@@ -2119,6 +2119,9 @@
bisect:
bisect: good
+ $ hg log -r 0 --template '{revset("0::0") % "branch:\t{revision|revbranches}\n\n"}'
+ branch: default
+
$ hg log -r . --template '{revdesc()}'
hg: parse error: revdesc expects one argument
[255]
More information about the Mercurial-devel
mailing list