changeset 2356:d5de0529a48f

obscache: extract the actual data update in a dedicated function This will help extract a data agnostic class.
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Fri, 12 May 2017 19:07:14 +0200
parents 078549a71ce4
children f787f5406a98
files hgext3rd/evolve/obscache.py
diffstat 1 files changed, 7 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/hgext3rd/evolve/obscache.py	Fri May 12 19:05:46 2017 +0200
+++ b/hgext3rd/evolve/obscache.py	Fri May 12 19:07:14 2017 +0200
@@ -285,10 +285,7 @@
         if reset or self._cachekey is None:
             self.clear(reset=True)
 
-        if revs:
-            self._updaterevs(repo, revs)
-        if obsmarkers:
-            self._updatemarkers(repo, obsmarkers)
+        def _updatefrom(repo, revs, obsmarkers)
 
         # update the key from the new data
         key = list(self._cachekey)
@@ -300,6 +297,12 @@
             key[3], key[4] = obskeypair
         self._cachekey = tuple(key)
 
+    def _updatefrom(self, repo, revs, obsmarkers):
+        if revs:
+            self._updaterevs(repo, revs)
+        if obsmarkers:
+            self._updatemarkers(repo, obsmarkers)
+
     def _updaterevs(self, repo, revs):
         """update the cache with new revisions