templatekw: introduce active subkeyword from bookmarks 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.
This commit is contained in:
Ryan McElroy 2015-05-28 20:03:42 -07:00
parent 6acaea3ec5
commit 7cd7aaf7a6
3 changed files with 6 additions and 6 deletions

View File

@ -90,9 +90,9 @@ Some sample command line templates:
$ hg log -r 0 --template "{join(extras, '\n')}\n"
- Mark the current bookmark with '*'::
- Mark the active bookmark with '*'::
$ hg log --template "{bookmarks % '{bookmark}{ifeq(bookmark, current, \"*\")} '}\n"
$ hg log --template "{bookmarks % '{bookmark}{ifeq(bookmark, active, \"*\")} '}\n"
- Mark the working copy parent with '@'::

View File

@ -206,12 +206,12 @@ def showbranches(**args):
def showbookmarks(**args):
""":bookmarks: List of strings. Any bookmarks associated with the
changeset.
changeset. Also sets 'active', the name of the active bookmark.
"""
repo = args['ctx']._repo
bookmarks = args['ctx'].bookmarks()
current = repo._activebookmark
makemap = lambda v: {'bookmark': v, 'current': current}
active = repo._activebookmark
makemap = lambda v: {'bookmark': v, 'active': active, 'current': active}
f = _showlist('bookmark', bookmarks, **args)
return _hybrid(f, bookmarks, makemap, lambda x: x['bookmark'])

View File

@ -3086,7 +3086,7 @@ Test current bookmark templating
$ hg book foo
$ hg book bar
$ hg log --template "{rev} {bookmarks % '{bookmark}{ifeq(bookmark, current, \"*\")} '}\n"
$ hg log --template "{rev} {bookmarks % '{bookmark}{ifeq(bookmark, active, \"*\")} '}\n"
2 bar* foo
1
0