templatekw: introduce activebookmark keyword
authorRyan McElroy <rmcelroy@fb.com>
Wed, 15 Apr 2015 08:12:04 -0700
changeset 25013 277aba2c151a
parent 25012 256c8432e346
child 25014 7e5d5160073b
templatekw: introduce activebookmark keyword Today, the terms 'active' and 'current' are interchangeably used throughout the codebase in reference to the active bookmark (the bookmark that will be updated with the next commit). This leads to confusion among developers and users. This patch is part of a series to standardize the usage to 'active' throughout the mercurial codebase and user interface.
mercurial/templatekw.py
--- a/mercurial/templatekw.py	Wed Apr 15 08:26:01 2015 -0700
+++ b/mercurial/templatekw.py	Wed Apr 15 08:12:04 2015 -0700
@@ -221,8 +221,14 @@
     childrevs = ['%d:%s' % (cctx, cctx) for cctx in ctx.children()]
     return showlist('children', childrevs, element='child', **args)
 
+# Deprecated, but kept alive for help generation a purpose.
 def showcurrentbookmark(**args):
     """:currentbookmark: String. The active bookmark, if it is
+    associated with the changeset (DEPRECATED)"""
+    return showactivebookmark(**args)
+
+def showactivebookmark(**args):
+    """:activetbookmark: String. The active bookmark, if it is
     associated with the changeset"""
     import bookmarks as bookmarks # to avoid circular import issues
     repo = args['repo']
@@ -418,12 +424,14 @@
 # cache - a cache dictionary for the whole templater run
 # revcache - a cache dictionary for the current revision
 keywords = {
+    'activebookmark': showactivebookmark,
     'author': showauthor,
     'bisect': showbisect,
     'branch': showbranch,
     'branches': showbranches,
     'bookmarks': showbookmarks,
     'children': showchildren,
+    # currentbookmark is deprecated
     'currentbookmark': showcurrentbookmark,
     'date': showdate,
     'desc': showdescription,