diff --git a/docs/html/reference/pip_install.rst b/docs/html/reference/pip_install.rst index c23b051da..ac37455cc 100644 --- a/docs/html/reference/pip_install.rst +++ b/docs/html/reference/pip_install.rst @@ -417,8 +417,8 @@ making fewer network calls). Mercurial ~~~~~~~~~ -The supported schemes are: ``hg+http``, ``hg+https``, -``hg+static-http`` and ``hg+ssh``. +The supported schemes are: ``hg+file``, ``hg+http``, ``hg+https``, +``hg+static-http``, and ``hg+ssh``. Here are the supported forms:: diff --git a/news/4358.bugfix b/news/4358.bugfix new file mode 100644 index 000000000..912083dc1 --- /dev/null +++ b/news/4358.bugfix @@ -0,0 +1 @@ +Correct inconsistency related to the `hg+file` scheme. diff --git a/src/pip/_internal/vcs/mercurial.py b/src/pip/_internal/vcs/mercurial.py index 7679b8640..bce30d73f 100644 --- a/src/pip/_internal/vcs/mercurial.py +++ b/src/pip/_internal/vcs/mercurial.py @@ -27,7 +27,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+file', 'hg+http', 'hg+https', 'hg+ssh', 'hg+static-http', + ) @staticmethod def get_base_rev_args(rev): diff --git a/tests/functional/test_install.py b/tests/functional/test_install.py index 27b797dfe..119f2d3bd 100644 --- a/tests/functional/test_install.py +++ b/tests/functional/test_install.py @@ -334,9 +334,11 @@ 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)] + url = 'hg+{}#egg=testpackage'.format(path_to_url(pkg_path)) + assert url.startswith('hg+file') + args = ['install', '-e', url] result = script.pip(*args) result.assert_installed('testpackage', with_files=['.hg']) diff --git a/tests/unit/test_link.py b/tests/unit/test_link.py index 8fbafe082..a9e75e38b 100644 --- a/tests/unit/test_link.py +++ b/tests/unit/test_link.py @@ -131,6 +131,7 @@ class TestLink: @pytest.mark.parametrize('url, expected', [ ('git+https://github.com/org/repo', True), ('bzr+http://bzr.myproject.org/MyProject/trunk/#egg=MyProject', True), + ('hg+file://hg.company.com/repo', True), ('https://example.com/some.whl', False), ('file://home/foo/some.whl', False), ])