changeset 13386:f78bc5ddbe4f

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.
author David Soria Parra <dsp@php.net>
date Fri, 11 Feb 2011 19:47:39 +0100
parents d012d95499f7
children 0be2fe6a0843
files mercurial/cmdutil.py mercurial/templatekw.py tests/test-bookmarks-rebase.t tests/test-bookmarks.t
diffstat 4 files changed, 18 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/cmdutil.py	Fri Feb 11 19:44:17 2011 +0100
+++ b/mercurial/cmdutil.py	Fri Feb 11 19:47:39 2011 +0100
@@ -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')
--- a/mercurial/templatekw.py	Fri Feb 11 19:44:17 2011 +0100
+++ b/mercurial/templatekw.py	Fri Feb 11 19:47:39 2011 +0100
@@ -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,
--- a/tests/test-bookmarks-rebase.t	Fri Feb 11 19:44:17 2011 +0100
+++ b/tests/test-bookmarks-rebase.t	Fri Feb 11 19:47:39 2011 +0100
@@ -41,6 +41,8 @@
 
   $ hg log
   changeset:   3:9163974d1cb5
+  bookmark:    one
+  bookmark:    two
   tag:         tip
   parent:      1:925d80f479bb
   parent:      2:db815d6d32e6
--- a/tests/test-bookmarks.t	Fri Feb 11 19:44:17 2011 +0100
+++ b/tests/test-bookmarks.t	Fri Feb 11 19:47:39 2011 +0100
@@ -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