[PATCH 1 of 4 V2] flagutil: introduce a flagprocessorsmixin class
Yuya Nishihara
yuya at tcha.org
Fri Aug 30 23:02:47 EDT 2019
On Sun, 11 Aug 2019 13:10:47 +0200, Pierre-Yves David wrote:
> # HG changeset patch
> # User Pierre-Yves David <pierre-yves.david at octobus.net>
> # Date 1565219568 -7200
> # Thu Aug 08 01:12:48 2019 +0200
> # Node ID e6d22ec889461dbe819e0dbf4d2f0167736b2416
> # Parent 6d61be152c5515fed315885f6c9cf9defe73de71
> # EXP-Topic flag-processors
> # Available At https://bitbucket.org/octobus/mercurial-devel/
> # hg pull https://bitbucket.org/octobus/mercurial-devel/ -r e6d22ec88946
> flagutil: introduce a flagprocessorsmixin class
CC +indygreg
> diff --git a/mercurial/revlogutils/flagutil.py b/mercurial/revlogutils/flagutil.py
> --- a/mercurial/revlogutils/flagutil.py
> +++ b/mercurial/revlogutils/flagutil.py
> @@ -78,3 +78,74 @@ def insertflagprocessor(flag, processor,
> msg = _("cannot register multiple processors on flag '%#x'.") % (flag)
> raise error.Abort(msg)
> flagprocessors[flag] = processor
> +
> +class flagprocessorsmixin(object):
> + """basic mixin to support revlog flag processing
> +
> + Make sure the `_flagprocessors` attribute is set at ``__init__`` time.
I feel a plain function taking (revlog, flagprocessors, ...) is simpler
than the mixin class which implicitly depends on revlog attributes. But
maybe I'm biased. I don't like class inheritance in general.
More information about the Mercurial-devel
mailing list