[PATCH 6 of 8 v2] templater: add bookmarks to templates and default output
David Soria Parra
dsp at php.net
Tue Feb 1 16:21:58 CST 2011
# HG changeset patch
# User David Soria Parra <dsp at php.net>
# Date 1296598897 -3600
# Node ID 1a4c08114cd136381f8cf71f47365e50a11ae4db
# Parent 432ebdea1b91b249572e5e186f3cb653ff5e0d7d
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/mercurial/templates/map-cmdline.default b/mercurial/templates/map-cmdline.default
--- a/mercurial/templates/map-cmdline.default
+++ b/mercurial/templates/map-cmdline.default
@@ -1,7 +1,7 @@
-changeset = 'changeset: {rev}:{node|short}\n{branches}{tags}{parents}user: {author}\ndate: {date|date}\nsummary: {desc|firstline}\n\n'
+changeset = 'changeset: {rev}:{node|short}\n{branches}{bookmarks}{tags}{parents}user: {author}\ndate: {date|date}\nsummary: {desc|firstline}\n\n'
changeset_quiet = '{rev}:{node|short}\n'
-changeset_verbose = 'changeset: {rev}:{node|short}\n{branches}{tags}{parents}user: {author}\ndate: {date|date}\n{files}{file_copies_switch}description:\n{desc|strip}\n\n\n'
-changeset_debug = 'changeset: {rev}:{node}\n{branches}{tags}{parents}{manifest}user: {author}\ndate: {date|date}\n{file_mods}{file_adds}{file_dels}{file_copies_switch}{extras}description:\n{desc|strip}\n\n\n'
+changeset_verbose = 'changeset: {rev}:{node|short}\n{branches}{bookmarks}{tags}{parents}user: {author}\ndate: {date|date}\n{files}{file_copies_switch}description:\n{desc|strip}\n\n\n'
+changeset_debug = 'changeset: {rev}:{node}\n{branches}{bookmarks}{tags}{parents}{manifest}user: {author}\ndate: {date|date}\n{file_mods}{file_adds}{file_dels}{file_copies_switch}{extras}description:\n{desc|strip}\n\n\n'
start_files = 'files: '
file = ' {file}'
end_files = '\n'
@@ -21,4 +21,5 @@
manifest = 'manifest: {rev}:{node}\n'
branch = 'branch: {branch}\n'
tag = 'tag: {tag}\n'
+bookmark = 'bookmark: {bookmark}\n'
extra = 'extra: {key}={value|stringescape}\n'
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
@@ -40,6 +40,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
@@ -33,6 +33,7 @@
$ hg log -r X
changeset: 0:f7b1eb17ad24
+ bookmark: X
tag: tip
user: test
date: Thu Jan 01 00:00:00 1970 +0000
@@ -62,6 +63,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
@@ -70,6 +73,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
@@ -158,6 +163,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