# HG changeset patch # User Pierre-Yves David # Date 1494613689 -7200 # Node ID ff635fa59a254fd0fa0b0fbb7dfff05a3af97d3b # Parent d8ea60fcfbc9acbc771cb297f2d8e4ef6075125f obscache: makes dualsourcecache compatible with obshashrange cache needs The goal of the abstract method is to be reusable. So we make sure it is reusable. diff -r d8ea60fcfbc9 -r ff635fa59a25 hgext3rd/evolve/obscache.py --- a/hgext3rd/evolve/obscache.py Fri May 12 21:20:40 2017 +0200 +++ b/hgext3rd/evolve/obscache.py Fri May 12 20:28:09 2017 +0200 @@ -141,6 +141,7 @@ emptykey = (node.nullrev, node.nullid, 0, 0, node.nullid) def __init__(self): + super(dualsourcecache, self).__init__() self._cachekey = None def _updatefrom(self, repo, revs, obsmarkers): @@ -160,6 +161,16 @@ # /!\ IMPORTANT /!\ # You must overide this method to actually self._cachekey = self.emptykey if reset else None + s = super(dualsourcecache, self) + if util.safehasattr(s, 'clear') and callable(s.clear): + s.clear() + + def load(self, repo): + """Load data from disk + + Do not forget to restore the "cachekey" attribute while doing so. + """ + raise NotImplementedError # Useful public function (no need to override them) @@ -180,6 +191,7 @@ """update the cache with new repository data The update will be incremental when possible""" + repo = repo.unfiltered() # If we do not have any data, try loading from disk if self._cachekey is None: self.load(repo)