From 3f98ee42509679a5bfd53899c9b6127d6f52e44d Mon Sep 17 00:00:00 2001 From: Adam Tse Date: Sun, 28 Oct 2018 11:44:03 +0000 Subject: [PATCH] Explicit support and tests for `hg+file` scheme for `pip install`. --- docs/html/reference/pip_install.rst | 2 +- news/4358.bugfix | 2 ++ src/pip/_internal/vcs/mercurial.py | 4 +++- tests/functional/test_install.py | 4 +++- 4 files changed, 9 insertions(+), 3 deletions(-) create mode 100644 news/4358.bugfix diff --git a/docs/html/reference/pip_install.rst b/docs/html/reference/pip_install.rst index fa475c462..9fcf94676 100644 --- a/docs/html/reference/pip_install.rst +++ b/docs/html/reference/pip_install.rst @@ -418,7 +418,7 @@ Mercurial ~~~~~~~~~ The supported schemes are: ``hg+http``, ``hg+https``, -``hg+static-http`` and ``hg+ssh``. +``hg+static-http``, ``hg+ssh`` and ``hg+file``. Here are the supported forms:: diff --git a/news/4358.bugfix b/news/4358.bugfix new file mode 100644 index 000000000..891d819de --- /dev/null +++ b/news/4358.bugfix @@ -0,0 +1,2 @@ +Not a feature because the ``hg+file`` scheme was already functioning implicitly but inconsistently documented. +This change is to make the scheme support explicit, including tests and docs. \ No newline at end of file diff --git a/src/pip/_internal/vcs/mercurial.py b/src/pip/_internal/vcs/mercurial.py index 21697ff15..e9906632d 100644 --- a/src/pip/_internal/vcs/mercurial.py +++ b/src/pip/_internal/vcs/mercurial.py @@ -22,7 +22,9 @@ class Mercurial(VersionControl): name = 'hg' dirname = '.hg' repo_name = 'clone' - schemes = ('hg', 'hg+http', 'hg+https', 'hg+ssh', 'hg+static-http') + schemes = ( + 'hg', 'hg+http', 'hg+https', 'hg+ssh', 'hg+static-http', 'hg+file' + ) @staticmethod def get_base_rev_args(rev): diff --git a/tests/functional/test_install.py b/tests/functional/test_install.py index 7a0e4a9cb..d11368b11 100644 --- a/tests/functional/test_install.py +++ b/tests/functional/test_install.py @@ -334,11 +334,13 @@ def test_install_editable_uninstalls_existing_from_path(script, data): @need_mercurial def test_basic_install_editable_from_hg(script, tmpdir): - """Test cloning from Mercurial.""" + """Test cloning and hg+file install from Mercurial.""" pkg_path = _create_test_package(script, name='testpackage', vcs='hg') args = ['install', '-e', 'hg+%s#egg=testpackage' % path_to_url(pkg_path)] result = script.pip(*args) result.assert_installed('testpackage', with_files=['.hg']) + assert path_to_url(pkg_path).startswith("file://") + @need_mercurial