[PATCH 2 of 3] templatekw: introduce activebookmark keyword

Yuya Nishihara yuya at tcha.org
Fri May 8 20:10:28 CDT 2015


On Fri, 8 May 2015 17:56:16 -0700, Ryan McElroy wrote:
> # HG changeset patch
> # User Ryan McElroy <rmcelroy at fb.com>
> # Date 1429110724 25200
> #      Wed Apr 15 08:12:04 2015 -0700
> # Node ID d65c8127035c9adc66a9e550c0d9127c0494d397
> # Parent  2462f6c6190123d76d653cc3bbc460cd319fe6d6
> 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.
> 
> diff --git a/mercurial/templatekw.py b/mercurial/templatekw.py
> --- a/mercurial/templatekw.py
> +++ b/mercurial/templatekw.py
> @@ -221,8 +221,8 @@ def showchildren(**args):
>      childrevs = ['%d:%s' % (cctx, cctx) for cctx in ctx.children()]
>      return showlist('children', childrevs, element='child', **args)
>  
> -def showcurrentbookmark(**args):
> -    """:currentbookmark: String. The active bookmark, if it is
> +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,13 +418,15 @@ def showtags(**args):
>  # 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': showcurrentbookmark,
> +    # currentbookmark is deprecated
> +    'currentbookmark': showactivebookmark,

"activebookmark" will show up twice in "hg help template". Perhaps we'll need
two functions to host docstrings, like revset.author and user.


More information about the Mercurial-devel mailing list