[PATCH 4 of 6] templater: add bookmarks to templates and default output
David Soria Parra
dsp at php.net
Fri Feb 11 19:37:28 UTC 2011
# HG changeset patch
# User David Soria Parra <dsp at php.net>
# Date 1297450059 -3600
# Node ID 9bcb78aab2c7c3bce0518cc79c18de224f7802ac
# Parent eda0c1a38c277ebf3e320a1dbfda1545a565c2d6
templater: add bookmarks to templates and default output
as bookmarks are not dispalyed as tags anymore, we add a bookmark label
to the changeset printer.
diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py
--- a/mercurial/cmdutil.py
+++ b/mercurial/cmdutil.py
@@ -806,6 +806,9 @@
if branch != 'default':
self.ui.write(_("branch: %s\n") % branch,
label='log.branch')
+ for bookmark in self.repo.nodebookmarks(changenode):
+ self.ui.write(_("bookmark: %s\n") % bookmark,
+ label='log.bookmark')
for tag in self.repo.nodetags(changenode):
self.ui.write(_("tag: %s\n") % tag,
label='log.tag')
diff --git a/mercurial/templatekw.py b/mercurial/templatekw.py
--- a/mercurial/templatekw.py
+++ b/mercurial/templatekw.py
@@ -153,6 +153,10 @@
if branch != 'default':
return showlist('branch', [branch], plural='branches', **args)
+def showbookmarks(**args):
+ bookmarks = args['ctx'].bookmarks()
+ return showlist('bookmark', bookmarks, **args)
+
def showchildren(**args):
ctx = args['ctx']
childrevs = ['%d:%s' % (cctx, cctx) for cctx in ctx.children()]
@@ -252,6 +256,7 @@
'author': showauthor,
'branch': showbranch,
'branches': showbranches,
+ 'bookmarks': showbookmarks,
'children': showchildren,
'date': showdate,
'desc': showdescription,
diff --git a/tests/test-bookmarks-rebase.t b/tests/test-bookmarks-rebase.t
--- a/tests/test-bookmarks-rebase.t
+++ b/tests/test-bookmarks-rebase.t
@@ -41,6 +41,8 @@
$ hg log
changeset: 3:9163974d1cb5
+ bookmark: one
+ bookmark: two
tag: tip
parent: 1:925d80f479bb
parent: 2:db815d6d32e6
diff --git a/tests/test-bookmarks.t b/tests/test-bookmarks.t
--- a/tests/test-bookmarks.t
+++ b/tests/test-bookmarks.t
@@ -36,6 +36,7 @@
$ hg log -r X
changeset: 0:f7b1eb17ad24
+ bookmark: X
tag: tip
user: test
date: Thu Jan 01 00:00:00 1970 +0000
@@ -65,6 +66,8 @@
$ hg log -r 'bookmark()'
changeset: 1:925d80f479bb
+ bookmark: X
+ bookmark: X2
tag: tip
user: test
date: Thu Jan 01 00:00:00 1970 +0000
@@ -73,6 +76,8 @@
$ hg log -r 'bookmark(Y)'
$ hg log -r 'bookmark(X2)'
changeset: 1:925d80f479bb
+ bookmark: X
+ bookmark: X2
tag: tip
user: test
date: Thu Jan 01 00:00:00 1970 +0000
@@ -161,6 +166,9 @@
$ hg log -r '"x y"'
changeset: 2:0316ce92851d
+ bookmark: X2
+ bookmark: Y
+ bookmark: x y
tag: tip
user: test
date: Thu Jan 01 00:00:00 1970 +0000
More information about the Mercurial-devel
mailing list