compat: work around some filecache bug in 3.8
authorPierre-Yves David <pierre-yves.david@ens-lyon.org>
Sun, 26 Mar 2017 04:59:36 +0200
changeset 2244 c7da63d48f80
parent 2243 d83851f2d375
child 2245 a14e05e4bb20
compat: work around some filecache bug in 3.8 We are still compatible with this version.
hgext3rd/evolve/obsdiscovery.py
--- a/hgext3rd/evolve/obsdiscovery.py	Fri Mar 24 18:21:48 2017 +0100
+++ b/hgext3rd/evolve/obsdiscovery.py	Sun Mar 26 04:59:36 2017 +0200
@@ -525,8 +525,19 @@
     obsstore.rangeobshashcache.clear()
     return orig(obsstore, *args, **kwargs)
 
+try:
+    obsstorefilecache = localrepo.localrepository.obsstore
+except AttributeError:
+    # XXX hg-3.8 compat
+    #
+    # mercurial 3.8 has issue with accessing file cache property from their
+    # cache. This is fix by 36fbd72c2f39fef8ad52d7c559906c2bc388760c in core
+    # and shipped in 3.9
+    obsstorefilecache = localrepo.localrepository.__dict__['obsstore']
+
+
 # obsstore is a filecache so we have do to some spacial dancing
-@eh.wrapfunction(localrepo.localrepository.obsstore, 'func')
+@eh.wrapfunction(obsstorefilecache, 'func')
 def obsstorewithcache(orig, repo):
     obsstore = orig(repo)
     obsstore.rangeobshashcache = _obshashcache(repo.unfiltered())