( )⚙ D11320 dirstate-item: feed more information to `__init__`

This is an archive of the discontinued Mercurial Phabricator instance.

dirstate-item: feed more information to `__init__`
ClosedPublic

Authored by marmoute on Aug 21 2021, 5:56 AM.

Details

Summary

Instead of processing the "rich" value at the dirstatemap level, we can now directly pass them to the DirstateItem object. This will make the object free to store whatever its want and to implements it logic whatever its want.

For now… we simply process the flag and store the same good old value. However
this pave the way for doing things differently once the rest of dirstatemap
code is updated.

Nobody call this code yet.

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

marmoute created this revision.Aug 21 2021, 5:56 AM
Alphare added inline comments.
mercurial/cext/parsers.c
107–161

This differs from the Python implementation (it uses None). Why should 'r' be a good idea here, in particular with the arms that don't set another state later?

Alphare requested changes to this revision.Aug 25 2021, 10:40 AM

(marking this as requesting changes so that it's easier to see where an answer is needed)

This revision now requires changes to proceed.Aug 25 2021, 10:40 AM
marmoute requested review of this revision.Aug 26 2021, 3:43 AM
marmoute added inline comments.
mercurial/cext/parsers.c
107–161

We don't have "None" for char, and there are no arms that don't set another state.

Alphare added inline comments.Aug 26 2021, 3:46 AM
mercurial/cext/parsers.c
107–161

Sure, but there still is the default state (!(p1_tracked || p2_tracked || wc_tracked)), so calling this without any information yields a removed item. I don't think that's a big issue, but probably I would set it to "?" or some other char that doesn't risk silently being eaten anywhere without the dirstate complaining.

marmoute added inline comments.Aug 26 2021, 4:43 AM
mercurial/cext/parsers.c
107–161

In that default state, the file is untracked, (and not entry should actually exist) so r is the least unsuitable state at hand.

Alphare accepted this revision.Aug 26 2021, 4:43 AM
This revision is now accepted and ready to land.Aug 26 2021, 4:43 AM
baymax updated this revision to Diff 30046.Aug 26 2021, 9:00 AM

✅ refresh by Heptapod after a successful CI run (🐙 💚)

This revision was automatically updated to reflect the committed changes.