[PATCH 3 of 3] templatekw: replace currentbookmark with activebookmark keyword

Ryan McElroy rm at fb.com
Tue May 12 04:45:57 CDT 2015


On 5/11/2015 7:52 PM, Pierre-Yves David wrote:
>
>
> On 05/08/2015 07:21 PM, Pierre-Yves David wrote:
>>
>>
>> On 05/08/2015 05:56 PM, Ryan McElroy wrote:
>>> # HG changeset patch
>>> # User Ryan McElroy <rmcelroy at fb.com>
>>> # Date 1429111176 25200
>>> #      Wed Apr 15 08:19:36 2015 -0700
>>> # Node ID b2df13d3791a1df2d483abc259b069fa88114839
>>> # Parent  d65c8127035c9adc66a9e550c0d9127c0494d397
>>> templatekw: replace currentbookmark with activebookmark keyword
>>
>> This series looks good to me (beside yuya feedback). But it fails to
>> apply because it requires changes in pushed to crew (grmlml). I'll wait
>> a bit for mpm to flush the two repos (or rebase crew content on the
>> clowncopter if it is too long).
>
> I've applied yuya feedback and pushed the result to the clowncopter.
>
> Thanks!
>
> Diff applied to patch 2:
>
>
> diff --git a/mercurial/templatekw.py b/mercurial/templatekw.py
> --- a/mercurial/templatekw.py
> +++ b/mercurial/templatekw.py
> @@ -219,10 +219,16 @@ def showchildren(**args):
>      """:children: List of strings. The children of the changeset."""
>      ctx = args['ctx']
>      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']
>
> diff --git a/mercurial/templatekw.py b/mercurial/templatekw.py
> --- a/mercurial/templatekw.py
> +++ b/mercurial/templatekw.py
> @@ -430,11 +430,11 @@ keywords = {
>      'branch': showbranch,
>      'branches': showbranches,
>      'bookmarks': showbookmarks,
>      'children': showchildren,
>      # currentbookmark is deprecated
> -    'currentbookmark': showactivebookmark,
> +    'currentbookmark': showcurrentbookmark,
>      'date': showdate,
>      'desc': showdescription,
>      'diffstat': showdiffstat,
>      'extras': showextras,
>      'file_adds': showfileadds,
>
> Resulting change pushed to the clowncopter:
>
> diff --git a/mercurial/templatekw.py b/mercurial/templatekw.py
> --- a/mercurial/templatekw.py
> +++ b/mercurial/templatekw.py
> @@ -219,12 +219,18 @@ def showchildren(**args):
>      """:children: List of strings. The children of the changeset."""
>      ctx = args['ctx']
>      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']
>      if bookmarks.isactivewdirparent(repo):
>          active = repo._activebookmark
> @@ -416,16 +422,18 @@ def showtags(**args):
>  # ctx - the changectx being displayed
>  # templ - the templater instance
>  # 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,
>      'diffstat': showdiffstat,
>      'extras': showextras,
>
>
Thank you!


More information about the Mercurial-devel mailing list