# HG changeset patch
# User Siddharth Agarwal <sid0@fb.com>
# Date 2017-05-21 19:51:01
# Node ID b4810bf95c038528a7badf50c4de53f7249aefee
# Parent  859496bb6db32a2c4f200edaed91c718ac59eb27

init: turn on demandimport for Python 3.6 and above

This uses the new demandimport implementation for Python 3 introduced in
previous patches.

This doesn't yet enhance performance because it isn't integrated with the
custom source file loader we use on Python 3. We'll integrate the two in
upcoming patches.

diff --git a/hg b/hg
--- a/hg
+++ b/hg
@@ -28,8 +28,8 @@ if libdir != '@' 'LIBDIR' '@':
 
 # enable importing on demand to reduce startup time
 try:
-    if sys.version_info[0] < 3:
-        from mercurial import demandimport; demandimport.enable()
+    if sys.version_info[0] < 3 or sys.version_info >= (3, 6):
+        import hgdemandimport; hgdemandimport.enable()
 except ImportError:
     sys.stderr.write("abort: couldn't find mercurial libraries in [%s]\n" %
                      ' '.join(sys.path))