##// END OF EJS Templates
parsers: switch to policy importer...
Yuya Nishihara -
r32372:df448de7 default
parent child Browse files
Show More
@@ -17,7 +17,6 b' import traceback'
17
17
18 # Modules that have both Python and C implementations.
18 # Modules that have both Python and C implementations.
19 _dualmodules = (
19 _dualmodules = (
20 'parsers.py',
21 )
20 )
22
21
23 def check_compat_py2(f):
22 def check_compat_py2(f):
@@ -26,7 +26,6 b' allowsymbolimports = ('
26
26
27 # Modules that have both Python and C implementations.
27 # Modules that have both Python and C implementations.
28 _dualmodules = (
28 _dualmodules = (
29 'parsers.py',
30 )
29 )
31
30
32 # Modules that must be aliased because they are commonly confused with
31 # Modules that must be aliased because they are commonly confused with
@@ -17,7 +17,7 b''
17 <File Name="mercurial.cext.diffhelpers.pyd" />
17 <File Name="mercurial.cext.diffhelpers.pyd" />
18 <File Name="mercurial.cext.mpatch.pyd" />
18 <File Name="mercurial.cext.mpatch.pyd" />
19 <File Name="mercurial.cext.osutil.pyd" />
19 <File Name="mercurial.cext.osutil.pyd" />
20 <File Name="mercurial.parsers.pyd" />
20 <File Name="mercurial.cext.parsers.pyd" />
21 <File Name="pyexpat.pyd" />
21 <File Name="pyexpat.pyd" />
22 <File Name="bz2.pyd" />
22 <File Name="bz2.pyd" />
23 <File Name="select.pyd" />
23 <File Name="select.pyd" />
@@ -23,7 +23,6 b' modulepolicy = policy.policy'
23 # Modules that have both Python and C implementations. See also the
23 # Modules that have both Python and C implementations. See also the
24 # set of .py files under mercurial/pure/.
24 # set of .py files under mercurial/pure/.
25 _dualmodules = {
25 _dualmodules = {
26 'mercurial.parsers',
27 }
26 }
28
27
29 class hgimporter(object):
28 class hgimporter(object):
1 NO CONTENT: file renamed from mercurial/dirs.c to mercurial/cext/dirs.c
NO CONTENT: file renamed from mercurial/dirs.c to mercurial/cext/dirs.c
1 NO CONTENT: file renamed from mercurial/manifest.c to mercurial/cext/manifest.c
NO CONTENT: file renamed from mercurial/manifest.c to mercurial/cext/manifest.c
1 NO CONTENT: file renamed from mercurial/parsers.c to mercurial/cext/parsers.c
NO CONTENT: file renamed from mercurial/parsers.c to mercurial/cext/parsers.c
1 NO CONTENT: file renamed from mercurial/pathencode.c to mercurial/cext/pathencode.c
NO CONTENT: file renamed from mercurial/pathencode.c to mercurial/cext/pathencode.c
@@ -19,14 +19,16 b' from . import ('
19 encoding,
19 encoding,
20 error,
20 error,
21 match as matchmod,
21 match as matchmod,
22 parsers,
23 pathutil,
22 pathutil,
23 policy,
24 pycompat,
24 pycompat,
25 scmutil,
25 scmutil,
26 txnutil,
26 txnutil,
27 util,
27 util,
28 )
28 )
29
29
30 parsers = policy.importmod(r'parsers')
31
30 propertycache = util.propertycache
32 propertycache = util.propertycache
31 filecache = scmutil.filecache
33 filecache = scmutil.filecache
32 _rangemask = 0x7fffffff
34 _rangemask = 0x7fffffff
@@ -14,6 +14,7 b' import unicodedata'
14
14
15 from . import (
15 from . import (
16 error,
16 error,
17 policy,
17 pycompat,
18 pycompat,
18 )
19 )
19
20
@@ -318,7 +319,7 b' def _asciilower(s):'
318 def asciilower(s):
319 def asciilower(s):
319 # delay importing avoids cyclic dependency around "parsers" in
320 # delay importing avoids cyclic dependency around "parsers" in
320 # pure Python build (util => i18n => encoding => parsers => util)
321 # pure Python build (util => i18n => encoding => parsers => util)
321 from . import parsers
322 parsers = policy.importmod(r'parsers')
322 impl = getattr(parsers, 'asciilower', _asciilower)
323 impl = getattr(parsers, 'asciilower', _asciilower)
323 global asciilower
324 global asciilower
324 asciilower = impl
325 asciilower = impl
@@ -334,7 +335,7 b' def _asciiupper(s):'
334 def asciiupper(s):
335 def asciiupper(s):
335 # delay importing avoids cyclic dependency around "parsers" in
336 # delay importing avoids cyclic dependency around "parsers" in
336 # pure Python build (util => i18n => encoding => parsers => util)
337 # pure Python build (util => i18n => encoding => parsers => util)
337 from . import parsers
338 parsers = policy.importmod(r'parsers')
338 impl = getattr(parsers, 'asciiupper', _asciiupper)
339 impl = getattr(parsers, 'asciiupper', _asciiupper)
339 global asciiupper
340 global asciiupper
340 asciiupper = impl
341 asciiupper = impl
@@ -19,11 +19,12 b' from .node import ('
19 from . import (
19 from . import (
20 error,
20 error,
21 mdiff,
21 mdiff,
22 parsers,
22 policy,
23 revlog,
23 revlog,
24 util,
24 util,
25 )
25 )
26
26
27 parsers = policy.importmod(r'parsers')
27 propertycache = util.propertycache
28 propertycache = util.propertycache
28
29
29 def _parsev1(data):
30 def _parsev1(data):
@@ -76,11 +76,13 b' from .i18n import _'
76 from . import (
76 from . import (
77 error,
77 error,
78 node,
78 node,
79 parsers,
80 phases,
79 phases,
80 policy,
81 util,
81 util,
82 )
82 )
83
83
84 parsers = policy.importmod(r'parsers')
85
84 _pack = struct.pack
86 _pack = struct.pack
85 _unpack = struct.unpack
87 _unpack = struct.unpack
86 _calcsize = struct.calcsize
88 _calcsize = struct.calcsize
@@ -10,8 +10,8 b' from __future__ import absolute_import'
10 import struct
10 import struct
11 import zlib
11 import zlib
12
12
13 from .node import nullid
13 from ..node import nullid
14 from . import pycompat
14 from .. import pycompat
15 stringio = pycompat.stringio
15 stringio = pycompat.stringio
16
16
17
17
@@ -32,12 +32,14 b' from . import ('
32 ancestor,
32 ancestor,
33 error,
33 error,
34 mdiff,
34 mdiff,
35 parsers,
35 policy,
36 pycompat,
36 pycompat,
37 templatefilters,
37 templatefilters,
38 util,
38 util,
39 )
39 )
40
40
41 parsers = policy.importmod(r'parsers')
42
41 _pack = struct.pack
43 _pack = struct.pack
42 _unpack = struct.unpack
44 _unpack = struct.unpack
43 # Aliased for performance.
45 # Aliased for performance.
@@ -15,12 +15,14 b' import stat'
15 from .i18n import _
15 from .i18n import _
16 from . import (
16 from . import (
17 error,
17 error,
18 parsers,
18 policy,
19 pycompat,
19 pycompat,
20 util,
20 util,
21 vfs as vfsmod,
21 vfs as vfsmod,
22 )
22 )
23
23
24 parsers = policy.importmod(r'parsers')
25
24 # This avoids a collision between a file named foo and a dir named
26 # This avoids a collision between a file named foo and a dir named
25 # foo.i or foo.d
27 # foo.i or foo.d
26 def _encodedir(path):
28 def _encodedir(path):
@@ -45,13 +45,13 b' from . import ('
45 encoding,
45 encoding,
46 error,
46 error,
47 i18n,
47 i18n,
48 parsers,
49 policy,
48 policy,
50 pycompat,
49 pycompat,
51 )
50 )
52
51
53 base85 = policy.importmod(r'base85')
52 base85 = policy.importmod(r'base85')
54 osutil = policy.importmod(r'osutil')
53 osutil = policy.importmod(r'osutil')
54 parsers = policy.importmod(r'parsers')
55
55
56 b85decode = base85.b85decode
56 b85decode = base85.b85decode
57 b85encode = base85.b85encode
57 b85encode = base85.b85encode
@@ -635,10 +635,10 b' extmodules = ['
635 'mercurial/cext/mpatch.c'],
635 'mercurial/cext/mpatch.c'],
636 include_dirs=common_include_dirs,
636 include_dirs=common_include_dirs,
637 depends=common_depends),
637 depends=common_depends),
638 Extension('mercurial.parsers', ['mercurial/dirs.c',
638 Extension('mercurial.cext.parsers', ['mercurial/cext/dirs.c',
639 'mercurial/manifest.c',
639 'mercurial/cext/manifest.c',
640 'mercurial/parsers.c',
640 'mercurial/cext/parsers.c',
641 'mercurial/pathencode.c'],
641 'mercurial/cext/pathencode.c'],
642 include_dirs=common_include_dirs,
642 include_dirs=common_include_dirs,
643 depends=common_depends),
643 depends=common_depends),
644 Extension('mercurial.cext.osutil', ['mercurial/cext/osutil.c'],
644 Extension('mercurial.cext.osutil', ['mercurial/cext/osutil.c'],
@@ -11,10 +11,12 b' from mercurial import ('
11 context,
11 context,
12 dirstate,
12 dirstate,
13 extensions,
13 extensions,
14 parsers,
14 policy,
15 util,
15 util,
16 )
16 )
17
17
18 parsers = policy.importmod(r'parsers')
19
18 def pack_dirstate(fakenow, orig, dmap, copymap, pl, now):
20 def pack_dirstate(fakenow, orig, dmap, copymap, pl, now):
19 # execute what original parsers.pack_dirstate should do actually
21 # execute what original parsers.pack_dirstate should do actually
20 # for consistency
22 # for consistency
@@ -14,9 +14,11 b' from mercurial.node import ('
14 nullrev,
14 nullrev,
15 )
15 )
16 from mercurial import (
16 from mercurial import (
17 parsers,
17 policy,
18 )
18 )
19
19
20 parsers = policy.importmod(r'parsers')
21
20 # original python implementation
22 # original python implementation
21 def gettype(q):
23 def gettype(q):
22 return int(q & 0xFFFF)
24 return int(q & 0xFFFF)
@@ -114,7 +116,7 b' def importparsers(hexversion):'
114 # of the currently-running Python interpreter, so we monkey-patch
116 # of the currently-running Python interpreter, so we monkey-patch
115 # sys.hexversion to simulate using different versions.
117 # sys.hexversion to simulate using different versions.
116 code = ("import sys; sys.hexversion=%s; "
118 code = ("import sys; sys.hexversion=%s; "
117 "import mercurial.parsers" % hexversion)
119 "import mercurial.cext.parsers" % hexversion)
118 cmd = "python -c \"%s\"" % code
120 cmd = "python -c \"%s\"" % code
119 # We need to do these tests inside a subprocess because parser.c's
121 # We need to do these tests inside a subprocess because parser.c's
120 # version-checking code happens inside the module init function, and
122 # version-checking code happens inside the module init function, and
General Comments 0
You need to be logged in to leave comments. Login now