[PATCH 4 of 5 V2] upgrade: move descriptions and selection logic in individual classes

Yuya Nishihara yuya at tcha.org
Mon Apr 17 10:23:30 EDT 2017


On Mon, 17 Apr 2017 13:42:14 +0200, Pierre-Yves David wrote:
> # HG changeset patch
> # User Pierre-Yves David <pierre-yves.david at ens-lyon.org>
> # Date 1492007645 -7200
> #      Wed Apr 12 16:34:05 2017 +0200
> # Node ID 00332fda84a431fd0a45e6b912a4823da729be57
> # Parent  d415fdf03d9c9854aed247fca082cd75eb722e99
> # EXP-Topic upgraderepo
> # Available At https://www.mercurial-scm.org/repo/users/marmoute/mercurial/
> #              hg pull https://www.mercurial-scm.org/repo/users/marmoute/mercurial/ -r 00332fda84a4
> upgrade: move descriptions and selection logic in individual classes
> 
> Our goal here is to get top level definition for all the format variants. Having
> them defined outside of the function enabled other users of that logic.
> 
> They are two keys components of a format variant:
> 
> 1) the name and various descriptions of its effect,
> 
> 2) the code that checks if the repo is using this variant and if the config
>    enables it.
> 
> That second items make us pick a class-based approach, since different variants
> requires different code (even if in practice, many can reuse the same logic).
> Each variants define its own class that is then used like a singleton.  The
> class-based approach also clarify the definitions part a bit since each are
> simple assignment in an indented block.

I'm not thrilled by the class-based one, but this should be better than the
original big function. Since there's no other comment, I've queued the series,
thanks.


More information about the Mercurial-devel mailing list