Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve performance of the Bazaar VCS backend #5445

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions news/5443.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Avoid creating an unnecessary local clone of a Bazaar branch when exporting.
1 change: 1 addition & 0 deletions news/5444.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Use the much faster 'bzr co --lightweight' to obtain a copy of a Bazaar tree.
18 changes: 8 additions & 10 deletions src/pip/_internal/vcs/bazaar.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
from pip._internal.utils.misc import (
display_path, make_vcs_requirement_url, rmtree,
)
from pip._internal.utils.temp_dir import TempDirectory
from pip._internal.vcs import VersionControl, vcs

logger = logging.getLogger(__name__)
Expand Down Expand Up @@ -42,13 +41,11 @@ def export(self, location):
if os.path.exists(location):
rmtree(location)

with TempDirectory(kind="export") as temp_dir:
self.unpack(temp_dir.path)

self.run_command(
['export', location],
cwd=temp_dir.path, show_stdout=False,
)
url, rev_options = self.get_url_rev_options()
self.run_command(
['export', location, url] + rev_options.to_args(),
show_stdout=False,
)

def fetch_new(self, dest, url, rev_options):
rev_display = rev_options.to_display()
Expand All @@ -58,14 +55,15 @@ def fetch_new(self, dest, url, rev_options):
rev_display,
display_path(dest),
)
cmd_args = ['branch', '-q'] + rev_options.to_args() + [url, dest]
cmd_args = (['checkout', '--lightweight', '-q'] +
rev_options.to_args() + [url, dest])
self.run_command(cmd_args)

def switch(self, dest, url, rev_options):
self.run_command(['switch', url], cwd=dest)

def update(self, dest, url, rev_options):
cmd_args = ['pull', '-q'] + rev_options.to_args()
cmd_args = ['update', '-q'] + rev_options.to_args()
self.run_command(cmd_args, cwd=dest)

def get_url_rev_and_auth(self, url):
Expand Down