diff --git a/contrib/check-py3-compat.py b/contrib/check-py3-compat.py
--- a/contrib/check-py3-compat.py
+++ b/contrib/check-py3-compat.py
@@ -17,7 +17,6 @@ import traceback
# Modules that have both Python and C implementations.
_dualmodules = (
- 'diffhelpers.py',
'mpatch.py',
'parsers.py',
)
diff --git a/contrib/import-checker.py b/contrib/import-checker.py
--- a/contrib/import-checker.py
+++ b/contrib/import-checker.py
@@ -26,7 +26,6 @@ allowsymbolimports = (
# Modules that have both Python and C implementations.
_dualmodules = (
- 'diffhelpers.py',
'mpatch.py',
'parsers.py',
)
diff --git a/contrib/wix/dist.wxs b/contrib/wix/dist.wxs
--- a/contrib/wix/dist.wxs
+++ b/contrib/wix/dist.wxs
@@ -14,7 +14,7 @@
-
+
diff --git a/mercurial/__init__.py b/mercurial/__init__.py
--- a/mercurial/__init__.py
+++ b/mercurial/__init__.py
@@ -23,7 +23,6 @@ modulepolicy = policy.policy
# Modules that have both Python and C implementations. See also the
# set of .py files under mercurial/pure/.
_dualmodules = {
- 'mercurial.diffhelpers',
'mercurial.mpatch',
'mercurial.parsers',
}
diff --git a/mercurial/diffhelpers.c b/mercurial/cext/diffhelpers.c
rename from mercurial/diffhelpers.c
rename to mercurial/cext/diffhelpers.c
diff --git a/mercurial/patch.py b/mercurial/patch.py
--- a/mercurial/patch.py
+++ b/mercurial/patch.py
@@ -27,18 +27,20 @@ from .node import (
)
from . import (
copies,
- diffhelpers,
encoding,
error,
mail,
mdiff,
pathutil,
+ policy,
pycompat,
scmutil,
similar,
util,
vfs as vfsmod,
)
+
+diffhelpers = policy.importmod(r'diffhelpers')
stringio = util.stringio
gitre = re.compile(br'diff --git a/(.*) b/(.*)')
diff --git a/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -628,7 +628,7 @@ extmodules = [
'mercurial/cext/bdiff.c'],
include_dirs=common_include_dirs,
depends=common_depends + ['mercurial/bdiff.h']),
- Extension('mercurial.diffhelpers', ['mercurial/diffhelpers.c'],
+ Extension('mercurial.cext.diffhelpers', ['mercurial/cext/diffhelpers.c'],
include_dirs=common_include_dirs,
depends=common_depends),
Extension('mercurial.mpatch', ['mercurial/mpatch.c',