obscache: extract the actual data update in a dedicated function
authorPierre-Yves David <pierre-yves.david@octobus.net>
Fri, 12 May 2017 19:07:14 +0200
changeset 2356 d5de0529a48f
parent 2355 078549a71ce4
child 2357 f787f5406a98
obscache: extract the actual data update in a dedicated function This will help extract a data agnostic class.
hgext3rd/evolve/obscache.py
--- 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