[PATCH] formatter: fixing bug that prevented labels from working

Yuya Nishihara yuya at tcha.org
Thu Mar 3 11:40:26 EST 2016


On Thu, 3 Mar 2016 08:27:57 -0800, Kostia Balytskyi wrote:
> # HG changeset patch
> # User Kostia Balytskyi <ikostia at fb.com>
> # Date 1457022116 28800
> #      Thu Mar 03 08:21:56 2016 -0800
> # Node ID 09dd1768aafb67bc4c342fb5317b18c085231b7e
> # Parent  4f7a5e4f2daff0a65aa470d9f70365ad55aaa100
> formatter: fixing bug that prevented labels from working
> 
> To describe the bug this fix is addressing, one can do
>   ``$ hg status -T "{label('red', path)}\n" --color=debug``
> and observe that the label is not applied before my fix and applied with it.

>  class templater(object):
>  
>      def __init__(self, mapfile, filters=None, defaults=None, cache=None,
> -                 minchunk=1024, maxchunk=65536):
> +                 minchunk=1024, maxchunk=65536, ui=None):
>          '''set up template engine.
>          mapfile is name of file to read map definitions from.
>          filters is dict of functions. each transforms a value into another.
> @@ -886,6 +886,7 @@ class templater(object):
>          self.defaults = defaults
>          self.minchunk, self.maxchunk = minchunk, maxchunk
>          self.ecache = {}
> +        self.ui = ui

Ugh, I know several template functions never work in formatter, but keeping ui
by templater seems somewhat wrong. I'll take a look more deeply later.


More information about the Mercurial-devel mailing list