[PATCH 1 of 8] bookmarks: add support for log-like template keywords and functions
Yuya Nishihara
yuya at tcha.org
Tue Jul 3 13:26:04 UTC 2018
# HG changeset patch
# User Yuya Nishihara <yuya at tcha.org>
# Date 1530451327 -32400
# Sun Jul 01 22:22:07 2018 +0900
# Node ID 65ebef5548276d61a95e949d8ef2fd1b82947bc6
# Parent c1a7bbf9984d2614bfac478d42c86377a84641ba
bookmarks: add support for log-like template keywords and functions
This is basically the same as 5d9b765dbe15 "tags: unblock log-like template
keywords and functions."
diff --git a/mercurial/bookmarks.py b/mercurial/bookmarks.py
--- a/mercurial/bookmarks.py
+++ b/mercurial/bookmarks.py
@@ -923,11 +923,14 @@ def _printbookmarks(ui, repo, bmarks, **
"""
opts = pycompat.byteskwargs(opts)
fm = ui.formatter('bookmarks', opts)
+ contexthint = fm.contexthint('bookmark rev node active')
hexfn = fm.hexfunc
if len(bmarks) == 0 and fm.isplain():
ui.status(_("no bookmarks set\n"))
for bmark, (n, prefix, label) in sorted(bmarks.iteritems()):
fm.startitem()
+ if 'ctx' in contexthint:
+ fm.context(ctx=repo[n])
if not ui.quiet:
fm.plain(' %s ' % prefix, label=label)
fm.write('bookmark', '%s', bmark, label=label)
diff --git a/tests/test-bookmarks.t b/tests/test-bookmarks.t
--- a/tests/test-bookmarks.t
+++ b/tests/test-bookmarks.t
@@ -77,6 +77,11 @@ list bookmarks
$ hg commit -m 1 --config "$TESTHOOK"
test-hook-bookmark: X2: f7b1eb17ad24730a1651fccd46c43826d1bbc2ac -> 925d80f479bb026b0fb3deb27503780b13f74123
+ $ hg bookmarks -T '{rev}:{node|shortest} {bookmark} {desc|firstline}\n'
+ 0:f7b1 X 0
+ 1:925d X2 1
+ -1:0000 Y
+
$ hg bookmarks -Tjson
[
{
More information about the Mercurial-devel
mailing list