This is an archive of the discontinued Mercurial Phabricator instance.

util: properly copy lrucachedict instances
ClosedPublic

Authored by indygreg on Sep 6 2018, 9:17 PM.

Details

Summary

Previously, copy() only worked if the cache was full. We teach
copy() to only copy defined nodes.

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

indygreg created this revision.Sep 6 2018, 9:17 PM
martinvonz added inline comments.
mercurial/util.py
1302

Btw, why doesn't this do return self[k] instead? It seems surprising that the recency is not updated.

indygreg added inline comments.Sep 7 2018, 1:13 PM
mercurial/util.py
1302

Yes, this does feel like a bug. But it feels unrelated to the series, no?

I can certainly code up a patch easily enough. I may tack one on the end of the series...

martinvonz added inline comments.Sep 7 2018, 1:14 PM
mercurial/util.py
1302

Yes, definitely unrelated (that's what the "Btw" was supposed to mean, but I could have been clearer)

Added D4506 to the series to fix the bug with get().

This revision was automatically updated to reflect the committed changes.