From patchwork Sat May 20 15:30:18 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [4,of,6,V2] obsstore: pass a repository object for initialisation From: Pierre-Yves David X-Patchwork-Id: 20774 Message-Id: To: mercurial-devel@mercurial-scm.org Date: Sat, 20 May 2017 17:30:18 +0200 # HG changeset patch # User Pierre-Yves David # Date 1495197862 -7200 # Fri May 19 14:44:22 2017 +0200 # Node ID eb72bf5f892c01171513f9ebfef69c8a3dbdb1ab # Parent e3900752e4e16857c65466ceda175ce6781d519d # EXP-Topic obscache # Available At https://www.mercurial-scm.org/repo/users/marmoute/mercurial/ # hg pull https://www.mercurial-scm.org/repo/users/marmoute/mercurial/ -r eb72bf5f892c obsstore: pass a repository object for initialisation The cache will needs a repository object (to grab a 'vfs'), so we pass a repo object instead of just the 'svfs' and we grab the 'svfs' from there. diff --git a/contrib/perf.py b/contrib/perf.py --- a/contrib/perf.py +++ b/contrib/perf.py @@ -1217,8 +1217,7 @@ def perfloadmarkers(ui, repo): Result is the number of markers in the repo.""" timer, fm = gettimer(ui) - svfs = getsvfs(repo) - timer(lambda: len(obsolete.obsstore(svfs))) + timer(lambda: len(obsolete.obsstore(repo))) fm.end() @command('perflrucachedict', formatteropts + diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py --- a/mercurial/localrepo.py +++ b/mercurial/localrepo.py @@ -532,7 +532,7 @@ class localrepository(object): if defaultformat is not None: kwargs['defaultformat'] = defaultformat readonly = not obsolete.isenabled(self, obsolete.createmarkersopt) - store = obsolete.obsstore(self.svfs, readonly=readonly, + store = obsolete.obsstore(self, readonly=readonly, **kwargs) if store and readonly: self.ui.warn( diff --git a/mercurial/obsolete.py b/mercurial/obsolete.py --- a/mercurial/obsolete.py +++ b/mercurial/obsolete.py @@ -551,10 +551,10 @@ class obsstore(object): _obskeysize = 200 - def __init__(self, svfs, defaultformat=_fm1version, readonly=False): + def __init__(self, repo, defaultformat=_fm1version, readonly=False): # caches for various obsolescence related cache self.caches = {} - self.svfs = svfs + self.svfs = repo.svfs self._version = defaultformat self._readonly = readonly