hg-evolve required for Mercurial support (simpler)
MODIFY
.github/workflows/test.yml
.github/workflows/test.yml
@@ -106,7 +106,9 @@ jobs:
python setup.py bdist_wheel
pip install dist/*.whl
pip freeze
- pip install mercurial hg-evolve
+ # hg-evolve pinned to 9.2 because hg-evolve dropped support for
+ # hg 4.5, installed with apt in Ubuntu 18.04
+ $(hg debuginstall --template "{pythonexe}") -m pip install hg-evolve==9.2 --user
- name: "Run tests"
run: |

MODIFY
docs/source/contributing/tasks.md
docs/source/contributing/tasks.md
@@ -24,8 +24,8 @@ py.test -s tests/<path-to-test>
```
To skip the tests related to Mercurial repositories (to avoid to install
-Mercurial or hg-evolve), one can use the environment variables
-``REPO2DOCKER_SKIP_HG_TESTS`` or ``REPO2DOCKER_SKIP_HG_EVOLVE_TESTS``.
+Mercurial and hg-evolve), one can use the environment variable
+``REPO2DOCKER_SKIP_HG_TESTS``.
### Troubleshooting Tests

MODIFY
docs/source/install.rst
docs/source/install.rst
@@ -25,13 +25,19 @@ for more details.
Optional: Mercurial
-------------------
-For `Mercurial <https://www.mercurial-scm.org>`_ repositories, `Mercurial needs
-to be installed <https://www.mercurial-scm.org/download>`_. For support of
-`Mercurial topics
-<https://www.mercurial-scm.org/doc/evolution/tutorials/topic-tutorial.html>`_,
-also install `hg-evolve <https://www.mercurial-scm.org/doc/evolution/>`_ which
-provides the topic extension (however, no need to explicitly enable it in a
-Mercurial configuration file).
+For `Mercurial <https://www.mercurial-scm.org>`_ repositories, Mercurial and
+`hg-evolve <https://www.mercurial-scm.org/doc/evolution/>`_ need to be
+installed. For example, on Debian based distributions, one can do::
+
+ sudo apt install mercurial
+ $(hg debuginstall --template "{pythonexe}") -m pip install hg-evolve --user
+
+To install Mercurial on other systems, see `here
+<https://www.mercurial-scm.org/download>`_.
+
+Note that for old Mercurial versions, you may need to specify a version for
+hg-evolve. For example, ``hg-evolve==9.2`` for hg 4.5 (which is installed with
+`apt` on Ubuntu 18.4).
Installing with ``pip``
-----------------------

MODIFY
tests/unit/contentproviders/test_mercurial.py
tests/unit/contentproviders/test_mercurial.py
@@ -10,34 +10,24 @@ from repo2docker.contentproviders import Mercurial
from repo2docker.contentproviders.mercurial import args_enabling_topic
SKIP_HG = strtobool(os.environ.get("REPO2DOCKER_SKIP_HG_TESTS", "False"))
-SKIP_HG_EVOLVE = SKIP_HG or strtobool(
- os.environ.get("REPO2DOCKER_SKIP_HG_EVOLVE_TESTS", "False")
-)
skip_if_no_hg_tests = pytest.mark.skipif(
SKIP_HG,
reason="REPO2DOCKER_SKIP_HG_TESTS",
)
-skip_if_no_evolve_tests = pytest.mark.skipif(
- SKIP_HG_EVOLVE,
- reason="REPO2DOCKER_SKIP_HG_EVOLVE_TESTS",
-)
-
-if SKIP_HG_EVOLVE:
- args_enabling_topic = []
@skip_if_no_hg_tests
def test_if_mercurial_is_available():
"""
To skip the tests related to Mercurial repositories (to avoid to install
- Mercurial), one can use the environment variable
+ Mercurial and hg-evolve), one can use the environment variable
REPO2DOCKER_SKIP_HG_TESTS.
"""
subprocess.check_output(["hg", "version"])
-@skip_if_no_evolve_tests
+@skip_if_no_hg_tests
def test_if_topic_is_available():
"""Check that the topic extension can be enabled"""
output = subprocess.getoutput("hg version -v --config extensions.topic=")
@@ -50,14 +40,11 @@ def _add_content_to_hg(repo_dir):
with open(Path(repo_dir) / "test", "a") as f:
f.write("Hello")
- subprocess.check_call(["hg", "add", "test"], cwd=repo_dir)
- subprocess.check_call(["hg", "commit", "-m", "Test commit"], cwd=repo_dir)
-
- if not SKIP_HG_EVOLVE:
-
def check_call(command):
subprocess.check_call(command + args_enabling_topic, cwd=repo_dir)
+ check_call(["hg", "add", "test"])
+ check_call(["hg", "commit", "-m", "Test commit"])
check_call(["hg", "topic", "test-topic"])
check_call(["hg", "commit", "-m", "Test commit in topic test-topic"])
check_call(["hg", "up", "default"])
@@ -135,13 +122,13 @@ def test_bad_ref(hg_repo_with_content):
pass
-@skip_if_no_evolve_tests
+@skip_if_no_hg_tests
def test_ref_topic(hg_repo_with_content):
"""
Test trying to update to a topic
- To skip this test (to avoid to install hg-evolve), one can use the
- environment variable REPO2DOCKER_SKIP_HG_EVOLVE_TESTS.
+ To skip this test (to avoid to install Mercurial and hg-evolve), one can
+ use the environment variable REPO2DOCKER_SKIP_HG_TESTS.
"""
upstream, node_id = hg_repo_with_content

hg-evolve required for Mercurial support (simpler)