This is an archive of the discontinued Mercurial Phabricator instance.

scmutil: convert status data object from a tuple to an attrs (API)
ClosedPublic

Authored by durin42 on Nov 14 2019, 4:09 PM.

Details

Summary

We've been pushing towards the property names for a while, and the
subclassing of the tuple confuses pytype. Rather than bend over
backwards to try and annotate the tuple subclass, let's just use attrs
here.

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

durin42 created this revision.Nov 14 2019, 4:09 PM
durin42 updated this revision to Diff 18105.Nov 14 2019, 4:13 PM
indygreg accepted this revision.Nov 14 2019, 10:33 PM
indygreg added a subscriber: indygreg.

Good riddance.

Do the revlog index next! :)

This revision is now accepted and ready to land.Nov 14 2019, 10:33 PM
martinvonz added inline comments.
mercurial/scmutil.py
81–88

What depends on this? It looked like many of the patches earlier in the series tried to get rid of iteration.

It appears PyCharm is confused by this change, which is weird, because it's supposed to support attrs. I would have to file a bug.

durin42 added inline comments.Nov 15 2019, 12:27 PM
mercurial/scmutil.py
81–88

I started out trying to get rid of the iterator interface on this, and gave up because it's just too many callsites for me to care.

I do think, long term, we should endeavor to rip this out.