Update Dockerfile (ALPINE_VERSION=3.12.0 & install mercurial) + remove mercurial from install_requires
MODIFY
Dockerfile
Dockerfile
-ARG ALPINE_VERSION=3.9.4
+ARG ALPINE_VERSION=3.12.0
FROM alpine:${ALPINE_VERSION}
-RUN apk add --no-cache git python3 python3-dev
+RUN apk add --no-cache git python3 python3-dev py-pip
# build wheels in first image
ADD . /tmp/src
@@ -15,8 +15,12 @@ RUN mkdir /tmp/wheelhouse \
FROM alpine:${ALPINE_VERSION}
-# install python, git, bash
-RUN apk add --no-cache git git-lfs python3 bash docker
+# install python, git, bash, mercurial
+RUN apk add --no-cache git git-lfs python3 py-pip bash docker mercurial
+
+# install and activate the evolve and topic Mercurial extensions
+RUN pip3 install hg-evolve --user --no-cache-dir
+RUN mkdir -p /etc/mercurial/hgrc.d && echo -e "[extensions]\nevolve =\ntopic =\n" > /etc/mercurial/hgrc.d/evolve.rc
# install repo2docker
COPY --from=0 /tmp/wheelhouse /tmp/wheelhouse

MODIFY
repo2docker/contentproviders/mercurial.py
repo2docker/contentproviders/mercurial.py
@@ -4,16 +4,6 @@ from .base import ContentProvider, ContentProviderException
from ..utils import execute_cmd
-hg_config = [
- "--config",
- "extensions.hggit=!",
- "--config",
- "extensions.evolve=",
- "--config",
- "extensions.topic=",
-]
-
-
class Mercurial(ContentProvider):
"""Provide contents of a remote Mercurial repository."""
@@ -22,7 +12,8 @@ class Mercurial(ContentProvider):
return None
try:
subprocess.check_output(
- ["hg", "identify", source] + hg_config, stderr=subprocess.DEVNULL,
+ ["hg", "identify", source, "--config", "extensions.hggit=!"],
+ stderr=subprocess.DEVNULL,
)
except subprocess.CalledProcessError:
return None
@@ -36,7 +27,6 @@ class Mercurial(ContentProvider):
# make a clone of the remote repository
try:
cmd = ["hg", "clone", repo, output_dir]
- cmd.extend(hg_config)
if ref is not None:
# don't update so the clone will include an empty working
# directory, the given ref will be updated out later
@@ -55,7 +45,7 @@ class Mercurial(ContentProvider):
if ref is not None:
try:
for line in execute_cmd(
- ["hg", "update", "--clean", ref] + hg_config,
+ ["hg", "update", "--clean", ref],
cwd=output_dir,
capture=yield_output,
):
@@ -67,7 +57,6 @@ class Mercurial(ContentProvider):
raise ValueError("Failed to update to ref {}".format(ref))
cmd = ["hg", "identify", "-i"]
- cmd.extend(hg_config)
sha1 = subprocess.Popen(cmd, stdout=subprocess.PIPE, cwd=output_dir)
self._node_id = sha1.stdout.read().decode().strip()

MODIFY
setup.py
setup.py
@@ -55,8 +55,6 @@ setup(
"ruamel.yaml>=0.15",
"toml",
"semver",
- "mercurial>=5.2",
- "hg-evolve>=10.0",
],
python_requires=">=3.6",
author="Project Jupyter Contributors",

Update Dockerfile (ALPINE_VERSION=3.12.0 & install mercurial) + remove mercurial from install_requires