This is an archive of the discontinued Mercurial Phabricator instance.

mergestate: use collections.defaultdict(dict) for _stateextras
ClosedPublic

Authored by pulkit on Aug 10 2020, 7:17 AM.

Details

Summary

I want to use this _stateextras more in upcoming patches to store some commit
time related information. Using defaultdict will help in cleaner code around
checking whether a file exists or not.

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

pulkit created this revision.Aug 10 2020, 7:17 AM
marmoute accepted this revision.Aug 10 2020, 1:14 PM
indygreg added inline comments.
mercurial/mergestate.py
701

This changes behavior so pop() will raise KeyError on a missing key. Is this desired?

pulkit marked an inline comment as done.Aug 11 2020, 3:45 AM
pulkit updated this revision to Diff 22391.
pulkit added inline comments.Aug 11 2020, 3:47 AM
mercurial/mergestate.py
701

Nope. It's was my wrong understanding of collections.defaultdict(). Fixed it.

Gente ping for review.

indygreg accepted this revision.Aug 22 2020, 6:41 PM
This revision is now accepted and ready to land.Aug 22 2020, 6:41 PM