changeset 2304:2f15090712fe

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.
author Pierre-Yves David <pierre-yves.david@ens-lyon.org>
date Tue, 02 May 2017 16:13:04 +0200
parents 8534400111fd
children a786240c95bd
files hgext3rd/evolve/obscache.py
diffstat 1 files changed, 6 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- 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):