( )⚙ D10768 upgrade: Use `improvement` subclasses everywhere, not instances

This is an archive of the discontinued Mercurial Phabricator instance.

upgrade: Use `improvement` subclasses everywhere, not instances
ClosedPublic

Authored by SimonSapin on May 25 2021, 2:11 AM.

Details

Summary

This changes the source definition of optimizations to match that of formats:
a subclass with a decorator, instead of an instance passed to a function call.
Not having any instance removes the confusion between class attributes and
instance attributes, which were used interchangeably.

Diff Detail

Repository
rHG Mercurial
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

SimonSapin created this revision.May 25 2021, 2:11 AM
marmoute requested changes to this revision.May 25 2021, 4:35 AM
marmoute added a subscriber: marmoute.
marmoute added inline comments.
mercurial/upgrade_utils/actions.py
49–90

Why are dropping these comment? it seems useful.

This revision now requires changes to proceed.May 25 2021, 4:35 AM
SimonSapin added inline comments.May 26 2021, 5:14 AM
mercurial/upgrade_utils/actions.py
49–90

This docstring used to document instance attributes, but instances attributes aren’t used anymore. Class attributes already have individual comments in the base class definition with mostly the same content.

I had missed that touches_* class attributes were not documented individually, I’ll restore that (even though these comments are not doing much besides paraphrasing what the attribute names are already saying).

marmoute added inline comments.May 26 2021, 5:15 AM
mercurial/upgrade_utils/actions.py
49–90

okay, thanks for the explanation.

SimonSapin updated this revision to Diff 28204.May 26 2021, 5:16 AM
This revision was not accepted when it landed; it landed in state Needs Review.
This revision was automatically updated to reflect the committed changes.