diff --git a/src/pip/_internal/vcs/bazaar.py b/src/pip/_internal/vcs/bazaar.py index 3d603727c57..42b68773b14 100644 --- a/src/pip/_internal/vcs/bazaar.py +++ b/src/pip/_internal/vcs/bazaar.py @@ -1,8 +1,7 @@ import logging -import os from typing import List, Optional, Tuple -from pip._internal.utils.misc import HiddenText, display_path, rmtree +from pip._internal.utils.misc import HiddenText, display_path from pip._internal.utils.subprocess import make_command from pip._internal.utils.urls import path_to_url from pip._internal.vcs.versioncontrol import ( @@ -30,21 +29,6 @@ def get_base_rev_args(rev): # type: (str) -> List[str] return ['-r', rev] - def export(self, location, url): - # type: (str, HiddenText) -> None - """ - Export the Bazaar repository at the url to the destination location - """ - # Remove the location to make sure Bazaar can export it correctly - if os.path.exists(location): - rmtree(location) - - url, rev_options = self.get_url_rev_options(url) - self.run_command( - make_command('export', location, url, rev_options.to_args()), - show_stdout=False, - ) - def fetch_new(self, dest, url, rev_options): # type: (str, HiddenText, RevOptions) -> None rev_display = rev_options.to_display() diff --git a/src/pip/_internal/vcs/git.py b/src/pip/_internal/vcs/git.py index e0704091dc6..9f24ccdf5ee 100644 --- a/src/pip/_internal/vcs/git.py +++ b/src/pip/_internal/vcs/git.py @@ -11,7 +11,6 @@ from pip._internal.exceptions import BadCommand, InstallationError from pip._internal.utils.misc import HiddenText, display_path, hide_url from pip._internal.utils.subprocess import make_command -from pip._internal.utils.temp_dir import TempDirectory from pip._internal.vcs.versioncontrol import ( AuthInfo, RemoteNotFoundError, @@ -112,19 +111,6 @@ def get_current_branch(cls, location): return None - def export(self, location, url): - # type: (str, HiddenText) -> None - """Export the Git repository at the url to the destination location""" - if not location.endswith('/'): - location = location + '/' - - with TempDirectory(kind="export") as temp_dir: - self.unpack(temp_dir.path, url=url) - self.run_command( - ['checkout-index', '-a', '-f', '--prefix', location], - show_stdout=False, cwd=temp_dir.path - ) - @classmethod def get_revision_sha(cls, dest, rev): # type: (str, str) -> Tuple[Optional[str], bool] diff --git a/src/pip/_internal/vcs/mercurial.py b/src/pip/_internal/vcs/mercurial.py index fdd71f43894..b4f887d327b 100644 --- a/src/pip/_internal/vcs/mercurial.py +++ b/src/pip/_internal/vcs/mercurial.py @@ -6,7 +6,6 @@ from pip._internal.exceptions import BadCommand, InstallationError from pip._internal.utils.misc import HiddenText, display_path from pip._internal.utils.subprocess import make_command -from pip._internal.utils.temp_dir import TempDirectory from pip._internal.utils.urls import path_to_url from pip._internal.vcs.versioncontrol import ( RevOptions, @@ -31,16 +30,6 @@ def get_base_rev_args(rev): # type: (str) -> List[str] return [rev] - def export(self, location, url): - # type: (str, HiddenText) -> None - """Export the Hg repository at the url to the destination location""" - with TempDirectory(kind="export") as temp_dir: - self.unpack(temp_dir.path, url=url) - - self.run_command( - ['archive', location], show_stdout=False, cwd=temp_dir.path - ) - def fetch_new(self, dest, url, rev_options): # type: (str, HiddenText, RevOptions) -> None rev_display = rev_options.to_display() diff --git a/src/pip/_internal/vcs/subversion.py b/src/pip/_internal/vcs/subversion.py index f58264446eb..4d1237ca0ca 100644 --- a/src/pip/_internal/vcs/subversion.py +++ b/src/pip/_internal/vcs/subversion.py @@ -3,12 +3,10 @@ import re from typing import List, Optional, Tuple -from pip._internal.utils.logging import indent_log from pip._internal.utils.misc import ( HiddenText, display_path, is_console_interactive, - rmtree, split_auth_from_netloc, ) from pip._internal.utils.subprocess import CommandArgs, make_command @@ -272,7 +270,6 @@ def get_remote_call_options(self): in this class. - checkout - - export - switch - update @@ -297,23 +294,6 @@ def get_remote_call_options(self): return [] - def export(self, location, url): - # type: (str, HiddenText) -> None - """Export the svn repository at the url to the destination location""" - url, rev_options = self.get_url_rev_options(url) - - logger.info('Exporting svn repository %s to %s', url, location) - with indent_log(): - if os.path.exists(location): - # Subversion doesn't like to check out over an existing - # directory --force fixes this, but was only added in svn 1.5 - rmtree(location) - cmd_args = make_command( - 'export', self.get_remote_call_options(), - rev_options.to_args(), url, location, - ) - self.run_command(cmd_args, show_stdout=False) - def fetch_new(self, dest, url, rev_options): # type: (str, HiddenText, RevOptions) -> None rev_display = rev_options.to_display() diff --git a/src/pip/_internal/vcs/versioncontrol.py b/src/pip/_internal/vcs/versioncontrol.py index cd6213bb132..97977b5799c 100644 --- a/src/pip/_internal/vcs/versioncontrol.py +++ b/src/pip/_internal/vcs/versioncontrol.py @@ -376,16 +376,6 @@ def _is_local_repository(cls, repo): drive, tail = os.path.splitdrive(repo) return repo.startswith(os.path.sep) or bool(drive) - def export(self, location, url): - # type: (str, HiddenText) -> None - """ - Export the repository at the url to the destination location - i.e. only download the files, without vcs informations - - :param url: the repository URL starting with a vcs prefix. - """ - raise NotImplementedError - @classmethod def get_netloc_and_auth(cls, netloc, scheme): # type: (str, str) -> Tuple[str, Tuple[Optional[str], Optional[str]]] @@ -448,8 +438,8 @@ def make_rev_args(username, password): def get_url_rev_options(self, url): # type: (HiddenText) -> Tuple[HiddenText, RevOptions] """ - Return the URL and RevOptions object to use in obtain() and in - some cases export(), as a tuple (url, rev_options). + Return the URL and RevOptions object to use in obtain(), + as a tuple (url, rev_options). """ secret_url, rev, user_pass = self.get_url_rev_and_auth(url.secret) username, secret_password = user_pass diff --git a/tests/functional/test_vcs_bazaar.py b/tests/functional/test_vcs_bazaar.py index 57fee51e780..0e598382a8e 100644 --- a/tests/functional/test_vcs_bazaar.py +++ b/tests/functional/test_vcs_bazaar.py @@ -6,16 +6,9 @@ import pytest -from pip._internal.utils.misc import hide_url from pip._internal.vcs.bazaar import Bazaar from pip._internal.vcs.versioncontrol import RemoteNotFoundError -from tests.lib import ( - _test_path_to_file_url, - _vcs_add, - create_file, - is_bzr_installed, - need_bzr, -) +from tests.lib import is_bzr_installed, need_bzr @pytest.mark.skipif( @@ -26,48 +19,6 @@ def test_ensure_bzr_available(): assert is_bzr_installed() -@need_bzr -def test_export(script, tmpdir): - """Test that a Bazaar branch can be exported.""" - source_dir = tmpdir / 'test-source' - source_dir.mkdir() - - create_file(source_dir / 'test_file', 'something') - - _vcs_add(script, str(source_dir), vcs='bazaar') - - export_dir = str(tmpdir / 'export') - url = hide_url('bzr+' + _test_path_to_file_url(source_dir)) - Bazaar().export(export_dir, url=url) - - assert os.listdir(export_dir) == ['test_file'] - - -@need_bzr -def test_export_rev(script, tmpdir): - """Test that a Bazaar branch can be exported, specifying a rev.""" - source_dir = tmpdir / 'test-source' - source_dir.mkdir() - - # Create a single file that is changed by two revisions. - create_file(source_dir / 'test_file', 'something initial') - _vcs_add(script, str(source_dir), vcs='bazaar') - - create_file(source_dir / 'test_file', 'something new') - script.run( - 'bzr', 'commit', '-q', - '--author', 'pip ', - '-m', 'change test file', cwd=source_dir, - ) - - export_dir = tmpdir / 'export' - url = hide_url('bzr+' + _test_path_to_file_url(source_dir) + '@1') - Bazaar().export(str(export_dir), url=url) - - with open(export_dir / 'test_file') as f: - assert f.read() == 'something initial' - - @need_bzr def test_get_remote_url__no_remote(script, tmpdir): repo_dir = tmpdir / 'temp-repo' diff --git a/tests/unit/test_vcs.py b/tests/unit/test_vcs.py index 6d82e139a48..f86d04d7425 100644 --- a/tests/unit/test_vcs.py +++ b/tests/unit/test_vcs.py @@ -570,14 +570,6 @@ def test_obtain(self): hide_url('http://svn.example.com/'), '/tmp/test', ]) - def test_export(self): - self.svn.export(self.dest, hide_url(self.url)) - self.assert_call_args([ - 'svn', 'export', '--non-interactive', '--username', 'username', - '--password', hide_value('password'), - hide_url('http://svn.example.com/'), '/tmp/test', - ]) - def test_fetch_new(self): self.svn.fetch_new(self.dest, hide_url(self.url), self.rev_options) self.assert_call_args([