[PATCH 4 of 6 V2] obsstore: pass a repository object for initialisation

Pierre-Yves David pierre-yves.david at ens-lyon.org
Sat May 20 11:30:18 EDT 2017


# HG changeset patch
# User Pierre-Yves David <pierre-yves.david at octobus.net>
# 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
 


More information about the Mercurial-devel mailing list