[manifestdiskcache] set up manifestdiskcache without subclassing repo

Summary: It seems subclassing repo can cause problems when a repo is created before the extension is loaded.  This circumvents the issue by directly modifying the data structures in the repo object as needed.

Test Plan: passed test-manifestdiskcache.t

Reviewers: #sourcecontrol, mjpieters

Reviewed By: mjpieters

Subscribers: mitrandir, mjpieters

Differential Revision: https://phabricator.fb.com/D3208899

Tasks: 10836392

Signature: t1:3208899:1461336232:617f8b9258f23ba0b34627785dc2cb4bddcee313
This commit is contained in:
Tony Tung 2016-04-22 09:51:07 -07:00
parent 731145a0be
commit c3ea6021e1

View File

@ -311,13 +311,11 @@ class manifestwithdc(manifest.manifest):
"prunemanifestdiskcache"])
subprocess.Popen(cmd, close_fds=True)
@replaceclass(localrepo, 'localrepository')
class repowithmdc(localrepo.localrepository):
def _applyopenerreqs(self):
super(repowithmdc, self)._applyopenerreqs()
self.svfs.options[CONFIG_KEY] = self.ui.configbool(
def reposetup(ui, repo):
if isinstance(repo, localrepo.localrepository):
repo.svfs.options[CONFIG_KEY] = repo.ui.configbool(
CONFIG_KEY, 'enabled', False)
self.svfs.options[REPO_ROOT_KEY] = self.root
repo.svfs.options[REPO_ROOT_KEY] = repo.root
def _reposnames(ui):
# '' is local repo. This also defines an order precedence for master.