compat: handle pre-4.2 compatibility for accessing vfs
authorPierre-Yves David <pierre-yves.david@octobus.net>
Tue, 25 Jul 2017 05:51:44 +0200
changeset 2796 0fd701dbfcc6
parent 2795 0dc119ed06b4
child 2797 74456bc055ae
child 2815 e453fc535094
compat: handle pre-4.2 compatibility for accessing vfs The vfs module is quite new.
hgext3rd/evolve/obscache.py
--- a/hgext3rd/evolve/obscache.py	Tue Jul 25 05:14:37 2017 +0200
+++ b/hgext3rd/evolve/obscache.py	Tue Jul 25 05:51:44 2017 +0200
@@ -22,7 +22,6 @@
     pycompat,
     node,
     util,
-    vfs as vfsmod,
 )
 
 from mercurial.i18n import _
@@ -43,6 +42,12 @@
 else:
     timer = time.time
 
+# hg < 4.2 compat
+try:
+    from mercurial import vfs as vfsmod
+    vfsmod.vfs
+except ImportError:
+    from mercurial import scmutil as vfsmod
 
 try:
     obsstorefilecache = localrepo.localrepository.obsstore