Page MenuHomePhabricator

merge: use constants for merge state record types
ClosedPublic

Authored by indygreg on Mar 5 2018, 7:15 PM.

Details

Summary

merge.py is using multiple discrete sets of 1 and 2 letter constants
to define types and behavior. To the uninitiated, the code is very
difficult to reason about. I didn't even realize there were multiple
sets of constants in play initially!

We begin our sanity injection with merge state records. The record
types (which are serialized to disk) are now defined in RECORD_*
constants.

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

indygreg created this revision.Mar 5 2018, 7:15 PM
martinvonz added inline comments.
mercurial/merge.py
50

Perhaps we should move that documentation to here so we don't have two lists of the same values that can end up getting out of sync? That would also make it easier to review this patch because the descriptions would be right next to the names you picked.

durin42 accepted this revision.Mar 24 2018, 3:07 PM
This revision is now accepted and ready to land.Mar 24 2018, 3:07 PM
This revision was automatically updated to reflect the committed changes.