Patchwork [6,of,8] obsstore: pass a repository object for initialisation

login
register
mail settings
Submitter Pierre-Yves David
Date May 19, 2017, 2:28 p.m.
Message ID <762eaca9a0234992c50b.1495204085@nodosa.octopoid.net>
Download mbox | patch
Permalink /patch/20715/
State Changes Requested
Headers show

Comments

Pierre-Yves David - May 19, 2017, 2:28 p.m.
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david@octobus.net>
# Date 1495197862 -7200
#      Fri May 19 14:44:22 2017 +0200
# Node ID 762eaca9a0234992c50b2929a91a0ba24b93bab4
# Parent  c2b1c81b3c4cba8cc21b1a1b92f4e34e6aa1807a
# 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 762eaca9a023
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.

Patch

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
@@ -518,7 +518,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
@@ -550,10 +550,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