Mercurial > hg > mercurial-source
changeset 33155:df448de7cf3b
parsers: switch to policy importer
# no-check-commit
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Sat, 13 Aug 2016 12:23:56 +0900 |
parents | 151cc3b3d799 |
children | 5700825889fb |
files | contrib/check-py3-compat.py contrib/import-checker.py contrib/wix/dist.wxs mercurial/__init__.py mercurial/cext/dirs.c mercurial/cext/manifest.c mercurial/cext/parsers.c mercurial/cext/pathencode.c mercurial/dirs.c mercurial/dirstate.py mercurial/encoding.py mercurial/manifest.c mercurial/manifest.py mercurial/obsolete.py mercurial/parsers.c mercurial/pathencode.c mercurial/pure/parsers.py mercurial/revlog.py mercurial/store.py mercurial/util.py setup.py tests/fakedirstatewritetime.py tests/test-parseindex2.py |
diffstat | 19 files changed, 32 insertions(+), 21 deletions(-) [+] |
line wrap: on
line diff
--- a/contrib/check-py3-compat.py +++ b/contrib/check-py3-compat.py @@ -17,7 +17,6 @@ # Modules that have both Python and C implementations. _dualmodules = ( - 'parsers.py', ) def check_compat_py2(f):
--- a/contrib/import-checker.py +++ b/contrib/import-checker.py @@ -26,7 +26,6 @@ # Modules that have both Python and C implementations. _dualmodules = ( - 'parsers.py', ) # Modules that must be aliased because they are commonly confused with
--- a/contrib/wix/dist.wxs +++ b/contrib/wix/dist.wxs @@ -17,7 +17,7 @@ <File Name="mercurial.cext.diffhelpers.pyd" /> <File Name="mercurial.cext.mpatch.pyd" /> <File Name="mercurial.cext.osutil.pyd" /> - <File Name="mercurial.parsers.pyd" /> + <File Name="mercurial.cext.parsers.pyd" /> <File Name="pyexpat.pyd" /> <File Name="bz2.pyd" /> <File Name="select.pyd" />
--- a/mercurial/__init__.py +++ b/mercurial/__init__.py @@ -23,7 +23,6 @@ # Modules that have both Python and C implementations. See also the # set of .py files under mercurial/pure/. _dualmodules = { - 'mercurial.parsers', } class hgimporter(object):
--- a/mercurial/dirstate.py +++ b/mercurial/dirstate.py @@ -19,14 +19,16 @@ encoding, error, match as matchmod, - parsers, pathutil, + policy, pycompat, scmutil, txnutil, util, ) +parsers = policy.importmod(r'parsers') + propertycache = util.propertycache filecache = scmutil.filecache _rangemask = 0x7fffffff
--- a/mercurial/encoding.py +++ b/mercurial/encoding.py @@ -14,6 +14,7 @@ from . import ( error, + policy, pycompat, ) @@ -318,7 +319,7 @@ def asciilower(s): # delay importing avoids cyclic dependency around "parsers" in # pure Python build (util => i18n => encoding => parsers => util) - from . import parsers + parsers = policy.importmod(r'parsers') impl = getattr(parsers, 'asciilower', _asciilower) global asciilower asciilower = impl @@ -334,7 +335,7 @@ def asciiupper(s): # delay importing avoids cyclic dependency around "parsers" in # pure Python build (util => i18n => encoding => parsers => util) - from . import parsers + parsers = policy.importmod(r'parsers') impl = getattr(parsers, 'asciiupper', _asciiupper) global asciiupper asciiupper = impl
--- a/mercurial/manifest.py +++ b/mercurial/manifest.py @@ -19,11 +19,12 @@ from . import ( error, mdiff, - parsers, + policy, revlog, util, ) +parsers = policy.importmod(r'parsers') propertycache = util.propertycache def _parsev1(data):
--- a/mercurial/obsolete.py +++ b/mercurial/obsolete.py @@ -76,11 +76,13 @@ from . import ( error, node, - parsers, phases, + policy, util, ) +parsers = policy.importmod(r'parsers') + _pack = struct.pack _unpack = struct.unpack _calcsize = struct.calcsize
--- a/mercurial/pure/parsers.py +++ b/mercurial/pure/parsers.py @@ -10,8 +10,8 @@ import struct import zlib -from .node import nullid -from . import pycompat +from ..node import nullid +from .. import pycompat stringio = pycompat.stringio
--- a/mercurial/revlog.py +++ b/mercurial/revlog.py @@ -32,12 +32,14 @@ ancestor, error, mdiff, - parsers, + policy, pycompat, templatefilters, util, ) +parsers = policy.importmod(r'parsers') + _pack = struct.pack _unpack = struct.unpack # Aliased for performance.
--- a/mercurial/store.py +++ b/mercurial/store.py @@ -15,12 +15,14 @@ from .i18n import _ from . import ( error, - parsers, + policy, pycompat, util, vfs as vfsmod, ) +parsers = policy.importmod(r'parsers') + # This avoids a collision between a file named foo and a dir named # foo.i or foo.d def _encodedir(path):
--- a/mercurial/util.py +++ b/mercurial/util.py @@ -45,13 +45,13 @@ encoding, error, i18n, - parsers, policy, pycompat, ) base85 = policy.importmod(r'base85') osutil = policy.importmod(r'osutil') +parsers = policy.importmod(r'parsers') b85decode = base85.b85decode b85encode = base85.b85encode
--- a/setup.py +++ b/setup.py @@ -635,10 +635,10 @@ 'mercurial/cext/mpatch.c'], include_dirs=common_include_dirs, depends=common_depends), - Extension('mercurial.parsers', ['mercurial/dirs.c', - 'mercurial/manifest.c', - 'mercurial/parsers.c', - 'mercurial/pathencode.c'], + Extension('mercurial.cext.parsers', ['mercurial/cext/dirs.c', + 'mercurial/cext/manifest.c', + 'mercurial/cext/parsers.c', + 'mercurial/cext/pathencode.c'], include_dirs=common_include_dirs, depends=common_depends), Extension('mercurial.cext.osutil', ['mercurial/cext/osutil.c'],
--- a/tests/fakedirstatewritetime.py +++ b/tests/fakedirstatewritetime.py @@ -11,10 +11,12 @@ context, dirstate, extensions, - parsers, + policy, util, ) +parsers = policy.importmod(r'parsers') + def pack_dirstate(fakenow, orig, dmap, copymap, pl, now): # execute what original parsers.pack_dirstate should do actually # for consistency
--- a/tests/test-parseindex2.py +++ b/tests/test-parseindex2.py @@ -14,9 +14,11 @@ nullrev, ) from mercurial import ( - parsers, + policy, ) +parsers = policy.importmod(r'parsers') + # original python implementation def gettype(q): return int(q & 0xFFFF) @@ -114,7 +116,7 @@ # of the currently-running Python interpreter, so we monkey-patch # sys.hexversion to simulate using different versions. code = ("import sys; sys.hexversion=%s; " - "import mercurial.parsers" % hexversion) + "import mercurial.cext.parsers" % hexversion) cmd = "python -c \"%s\"" % code # We need to do these tests inside a subprocess because parser.c's # version-checking code happens inside the module init function, and