##// END OF EJS Templates
mpatch: switch to policy importer
Yuya Nishihara -
r32371:151cc3b3 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 'mpatch.py',
21 'parsers.py',
20 'parsers.py',
22 )
21 )
23
22
@@ -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 'mpatch.py',
30 'parsers.py',
29 'parsers.py',
31 )
30 )
32
31
@@ -15,7 +15,7 b''
15 <File Name="mercurial.cext.base85.pyd" />
15 <File Name="mercurial.cext.base85.pyd" />
16 <File Name="mercurial.cext.bdiff.pyd" />
16 <File Name="mercurial.cext.bdiff.pyd" />
17 <File Name="mercurial.cext.diffhelpers.pyd" />
17 <File Name="mercurial.cext.diffhelpers.pyd" />
18 <File Name="mercurial.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.parsers.pyd" />
21 <File Name="pyexpat.pyd" />
21 <File Name="pyexpat.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.mpatch',
27 'mercurial.parsers',
26 'mercurial.parsers',
28 }
27 }
29
28
@@ -179,7 +179,7 b' PyMODINIT_FUNC PyInit_mpatch(void)'
179 if (m == NULL)
179 if (m == NULL)
180 return NULL;
180 return NULL;
181
181
182 mpatch_Error = PyErr_NewException("mercurial.mpatch.mpatchError",
182 mpatch_Error = PyErr_NewException("mercurial.cext.mpatch.mpatchError",
183 NULL, NULL);
183 NULL, NULL);
184 Py_INCREF(mpatch_Error);
184 Py_INCREF(mpatch_Error);
185 PyModule_AddObject(m, "mpatchError", mpatch_Error);
185 PyModule_AddObject(m, "mpatchError", mpatch_Error);
@@ -193,7 +193,7 b' initmpatch(void)'
193 {
193 {
194 PyObject *m;
194 PyObject *m;
195 m = Py_InitModule3("mpatch", methods, mpatch_doc);
195 m = Py_InitModule3("mpatch", methods, mpatch_doc);
196 mpatch_Error = PyErr_NewException("mercurial.mpatch.mpatchError",
196 mpatch_Error = PyErr_NewException("mercurial.cext.mpatch.mpatchError",
197 NULL, NULL);
197 NULL, NULL);
198 PyModule_AddIntConstant(m, "version", version);
198 PyModule_AddIntConstant(m, "version", version);
199 }
199 }
@@ -1025,12 +1025,10 b' def debuginstall(ui, **opts):'
1025 if policy.policy in ('c', 'allow'):
1025 if policy.policy in ('c', 'allow'):
1026 err = None
1026 err = None
1027 try:
1027 try:
1028 from . import (
1029 mpatch,
1030 )
1031 from .cext import (
1028 from .cext import (
1032 base85,
1029 base85,
1033 bdiff,
1030 bdiff,
1031 mpatch,
1034 osutil,
1032 osutil,
1035 )
1033 )
1036 dir(bdiff), dir(mpatch), dir(base85), dir(osutil) # quiet pyflakes
1034 dir(bdiff), dir(mpatch), dir(base85), dir(osutil) # quiet pyflakes
@@ -14,13 +14,13 b' import zlib'
14 from .i18n import _
14 from .i18n import _
15 from . import (
15 from . import (
16 error,
16 error,
17 mpatch,
18 policy,
17 policy,
19 pycompat,
18 pycompat,
20 util,
19 util,
21 )
20 )
22
21
23 bdiff = policy.importmod(r'bdiff')
22 bdiff = policy.importmod(r'bdiff')
23 mpatch = policy.importmod(r'mpatch')
24
24
25 blocks = bdiff.blocks
25 blocks = bdiff.blocks
26 fixws = bdiff.fixws
26 fixws = bdiff.fixws
@@ -9,7 +9,7 b' from __future__ import absolute_import'
9
9
10 import struct
10 import struct
11
11
12 from . import policy, pycompat
12 from .. import policy, pycompat
13 stringio = pycompat.stringio
13 stringio = pycompat.stringio
14 modulepolicy = policy.policy
14 modulepolicy = policy.policy
15 policynocffi = policy.policynocffi
15 policynocffi = policy.policynocffi
@@ -167,4 +167,3 b' if modulepolicy not in policynocffi:'
167 res = ffi.buffer(buf, outlen)[:]
167 res = ffi.buffer(buf, outlen)[:]
168 lib.mpatch_lfree(patch)
168 lib.mpatch_lfree(patch)
169 return res
169 return res
170
@@ -631,8 +631,8 b' extmodules = ['
631 Extension('mercurial.cext.diffhelpers', ['mercurial/cext/diffhelpers.c'],
631 Extension('mercurial.cext.diffhelpers', ['mercurial/cext/diffhelpers.c'],
632 include_dirs=common_include_dirs,
632 include_dirs=common_include_dirs,
633 depends=common_depends),
633 depends=common_depends),
634 Extension('mercurial.mpatch', ['mercurial/mpatch.c',
634 Extension('mercurial.cext.mpatch', ['mercurial/mpatch.c',
635 'mercurial/mpatch_module.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.parsers', ['mercurial/dirs.c',
@@ -12,4 +12,4 b' Test for CVE-2016-3630'
12 0 0 19 -1 2 99e0332bd498 000000000000 000000000000
12 0 0 19 -1 2 99e0332bd498 000000000000 000000000000
13 1 19 12 0 3 6674f57a23d8 99e0332bd498 000000000000
13 1 19 12 0 3 6674f57a23d8 99e0332bd498 000000000000
14 $ hg debugdata a.i 1 2>&1 | egrep 'Error:.*decoded'
14 $ hg debugdata a.i 1 2>&1 | egrep 'Error:.*decoded'
15 (mercurial.mpatch.)?mpatchError: patch cannot be decoded (re)
15 (mercurial\.\w+\.mpatch\.)?mpatchError: patch cannot be decoded (re)
General Comments 0
You need to be logged in to leave comments. Login now