Skip to content

Commit 026ab4d

Browse files
committed
Some performance improvements for Bazaar:
* Use lightweight checkouts rather than a full branch clone * Export directly from the remote branch Fixes pypa#5444, pypa#5443
1 parent f4a41a2 commit 026ab4d

File tree

3 files changed

+11
-10
lines changed

3 files changed

+11
-10
lines changed

news/5443.bugfix

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Avoid creating an unnecessary local clone of a Bazaar branch when exporting.

news/5444.bugfix

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Use the much faster 'bzr co --lightweight' to obtain a copy of a Bazaar tree.

src/pip/_internal/vcs/bazaar.py

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -42,13 +42,11 @@ def export(self, location):
4242
if os.path.exists(location):
4343
rmtree(location)
4444

45-
with TempDirectory(kind="export") as temp_dir:
46-
self.unpack(temp_dir.path)
47-
48-
self.run_command(
49-
['export', location],
50-
cwd=temp_dir.path, show_stdout=False,
51-
)
45+
url, rev_options = self.get_url_rev_options()
46+
self.run_command(
47+
['export', location, url] + rev_options.to_args(),
48+
show_stdout=False,
49+
)
5250

5351
def fetch_new(self, dest, url, rev_options):
5452
rev_display = rev_options.to_display()
@@ -58,14 +56,15 @@ def fetch_new(self, dest, url, rev_options):
5856
rev_display,
5957
display_path(dest),
6058
)
61-
cmd_args = ['branch', '-q'] + rev_options.to_args() + [url, dest]
59+
cmd_args = (['checkout', '--lightweight', '-q'] +
60+
rev_options.to_args() + [url, dest])
6261
self.run_command(cmd_args)
6362

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

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

7170
def get_url_rev_and_auth(self, url):

0 commit comments

Comments
 (0)