This is an archive of the discontinued Mercurial Phabricator instance.

branchmap: make it easier for extensions not to break branchcache
AbandonedPublic

Authored by mjpieters on Nov 21 2018, 9:56 AM.

Details

Reviewers
None
Group Reviewers
hg-reviewers
Summary

The _branchcache global gives us a reference for super() to use even if an
extension subclasses branchmap.branchcache then replaces the class in the
module.

Diff Detail

Repository
rHG Mercurial
Lint
Lint Skipped
Unit
Unit Tests Skipped

Event Timeline

mjpieters created this revision.Nov 21 2018, 9:56 AM
yuja added a subscriber: yuja.Nov 23 2018, 10:12 PM
The _branchcache global gives us a reference for super() to use even if an
extension subclasses branchmap.branchcache then replaces the class in the
module.

Can't we instead add a factory function which can be easily hooked by
extensions?

It should be discouraged to replace a class globally.

mjpieters abandoned this revision.Jan 21 2019, 1:12 PM

This would need more thought then; the evolve/topic/topicmap codebase wraps the whole branchmap.branchcache class and mucks about with a context manager to re-instate the right name in the branchmap globals so super() doesn't break, which is what led to this patch.