This is an archive of the discontinued Mercurial Phabricator instance.

dirstate: add a `set_tracked` method for "hg add"-like usage
ClosedPublic

Authored by marmoute on Jul 8 2021, 3:33 AM.

Details

Summary

This is a step further toward clarifying the semantic of various dirstate call.

Having a dedicated function comes with a couple of benefits:

  1. we can move duplicated logic about how to handle the previous state within

the dirstate. Since we are sure this is always called in the same situation, we
can implement that logic once in the dirstate.

  1. having a dedicated method for this case unlock also having a dedicated

method for the other case and recording more information at that time. All this
leading having more code within the dirstate and higher level API that are less
error prone.

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.Jul 8 2021, 3:33 AM
marmoute updated this revision to Diff 28962.Jul 8 2021, 4:16 AM
Alphare accepted this revision.Jul 9 2021, 12:01 PM
This revision is now accepted and ready to land.Jul 9 2021, 12:01 PM
marmoute retitled this revision from dirstate: add a set_tracked method for "hg add"-like usage to dirstate: add a `set_tracked` method for "hg add"-like usage.Jul 10 2021, 5:01 PM
marmoute edited the summary of this revision. (Show Details)
baymax updated this revision to Diff 29158.Jul 11 2021, 7:16 AM

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

baymax updated this revision to Diff 29249.Jul 15 2021, 12:03 PM

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

pulkit added a subscriber: pulkit.Jul 19 2021, 8:33 AM
pulkit added inline comments.
mercurial/dirstate.py
89

This will also need a b'' prefix, can you follow up for that?

marmoute added inline comments.Jul 19 2021, 8:58 AM
mercurial/dirstate.py
89