hgdemandimport: disable on Python 3.5
The demand importer functionality isn't working at all on Python 3.5.
I'm not sure what's wrong.
Since it isn't working, let's disable it completely.
```
$ HGRCPATH= hyperfine -w 1 -r 50 -- "~/.pyenv/versions/3.5.9/bin/python ./hg version" \
"HGDEMANDIMPORT=disable ~/.pyenv/versions/3.5.9/bin/python ./hg version"
Benchmark #1: ~/.pyenv/versions/3.5.9/bin/python ./hg version
Time (mean ± σ): 163.7 ms ± 2.2 ms [User: 148.5 ms, System: 15.7 ms]
Range (min … max): 161.0 ms … 170.2 ms 50 runs
Benchmark #2: HGDEMANDIMPORT=disable ~/.pyenv/versions/3.5.9/bin/python ./hg version
Time (mean ± σ): 164.3 ms ± 1.4 ms [User: 148.2 ms, System: 16.6 ms]
Range (min … max): 161.4 ms … 169.8 ms 50 runs
```
Differential Revision: https://phab.mercurial-scm.org/D7953
# txnutil.py - transaction related utilities
#
# Copyright FUJIWARA Katsunori <foozy@lares.dti.ne.jp> and others
#
# This software may be used and distributed according to the terms of the
# GNU General Public License version 2 or any later version.
from __future__ import absolute_import
import errno
from . import encoding
def mayhavepending(root):
'''return whether 'root' may have pending changes, which are
visible to this process.
'''
return root == encoding.environ.get(b'HG_PENDING')
def trypending(root, vfs, filename, **kwargs):
'''Open file to be read according to HG_PENDING environment variable
This opens '.pending' of specified 'filename' only when HG_PENDING
is equal to 'root'.
This returns '(fp, is_pending_opened)' tuple.
'''
if mayhavepending(root):
try:
return (vfs(b'%s.pending' % filename, **kwargs), True)
except IOError as inst:
if inst.errno != errno.ENOENT:
raise
return (vfs(filename, **kwargs), False)