Patchwork [11,of,14] obscache: instantiate the cache and keep it warm

login
register
mail settings
Submitter Boris Feld
Date July 9, 2017, 5:55 p.m.
Message ID <f8953ed43f8d1b146dcf.1499622923@FB>
Download mbox | patch
Permalink /patch/22172/
State Changes Requested
Headers show

Comments

Boris Feld - July 9, 2017, 5:55 p.m.
# HG changeset patch
# User Boris Feld <boris.feld@octobus.net>
# Date 1495198006 -7200
#      Fri May 19 14:46:46 2017 +0200
# Node ID f8953ed43f8d1b146dcff688030133f0d6123a49
# Parent  985d753d4f5799f2a332140adedb06efd465d62b
# EXP-Topic obs-cache
obscache: instantiate the cache and keep it warm

We are not using it yet, but we make sure we have a cache and that we keep it up
to date after each transaction.

The two "warning: ignoring unknown working parent" output in the tests are
caused by 'blackbox' accessing the dirstate during the strip. I've not found an
easy way to work around this so I kept them as they are harmless.

Patch

diff -r 985d753d4f57 -r f8953ed43f8d mercurial/localrepo.py
--- a/mercurial/localrepo.py	Fri May 19 14:44:22 2017 +0200
+++ b/mercurial/localrepo.py	Fri May 19 14:46:46 2017 +0200
@@ -1274,6 +1274,10 @@ 
             self.ui.debug('updating the branch cache\n')
             branchmap.updatecache(self.filtered('served'))
 
+        if self.obsstore:
+            self.obsstore.obscache.update(self)
+            self.obsstore.obscache.save(self)
+
     def invalidatecaches(self):
 
         if '_tagscache' in vars(self):
diff -r 985d753d4f57 -r f8953ed43f8d mercurial/obsolete.py
--- a/mercurial/obsolete.py	Fri May 19 14:44:22 2017 +0200
+++ b/mercurial/obsolete.py	Fri May 19 14:46:46 2017 +0200
@@ -525,6 +525,7 @@ 
         self.svfs = repo.svfs
         self._defaultformat = defaultformat
         self._readonly = readonly
+        self.obscache = obscache(repo)
 
     def __iter__(self):
         return iter(self._all)