This is an archive of the discontinued Mercurial Phabricator instance.

dirstate: make map implementation overridable
ClosedPublic

Authored by mbthomas on Nov 8 2017, 12:31 PM.

Details

Summary

Other implementations of dirstate will want to replace the class used for the
dirstate map. Allow this to happen by making the class an attribute of the
dirstate.

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

mbthomas created this revision.Nov 8 2017, 12:31 PM
mbthomas updated this revision to Diff 3443.Nov 13 2017, 7:18 AM
durin42 accepted this revision as: durin42.

I'd prefer this as a class attr, but would like to hear from @mbolin as to whether or not that solves the problem(s) that inspired D1354.

mercurial/dirstate.py
83

Could you set this at class-level, rather than in init? I think then @mbolin would be able to make his subclass replace the class attribute and that'd be sufficient?

I think I need it to be an instance attribute, as for treedirstate it depends on the repo as to whether I want a normal dirstatemap or a treedirstatemap. See D1401 for where I override this in treedirstate.

mbthomas updated this revision to Diff 3521.Nov 15 2017, 4:08 AM
durin42 accepted this revision.Nov 17 2017, 5:22 PM
This revision is now accepted and ready to land.Nov 17 2017, 5:22 PM
This revision was automatically updated to reflect the committed changes.