obscache: still update and use the cache during transaction
authorPierre-Yves David <pierre-yves.david@ens-lyon.org>
Tue, 02 May 2017 16:13:04 +0200
changeset 2304 2f15090712fe
parent 2303 8534400111fd
child 2305 a786240c95bd
obscache: still update and use the cache during transaction Other code might access the obsolete set in the middle of a transaction. It is better to use the case in that case since the update will eventually be written when the transaction is committed.
hgext3rd/evolve/obscache.py
--- a/hgext3rd/evolve/obscache.py	Tue May 02 16:15:01 2017 +0200
+++ b/hgext3rd/evolve/obscache.py	Tue May 02 16:13:04 2017 +0200
@@ -334,7 +334,12 @@
         # load the obsstore anyway. Once loaded, hitting the obsstore directly
         # will be about as fast..
         if not obscache.uptodate(repo):
-            return orig(repo)
+            if repo.currenttransaction() is None:
+                return orig(repo)
+            else:
+                # If a transaction is open, it is worthwhile to update and use the
+                # cache as it will be written on disk when the transaction close.
+                obscache.update(repo)
         isobs = obscache.get
     for r in notpublic:
         if isobs(r):