Skip to content

Commit fc9779b

Browse files
committed
bazaar: Use lightweight checkouts rather than a full branch clone
Fixes pypa#5444
1 parent e89e391 commit fc9779b

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

news/5444.feature.rst

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: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,14 +49,24 @@ def fetch_new(
4949
flag = ""
5050
else:
5151
flag = f"-{'v'*verbosity}"
52-
cmd_args = make_command("branch", flag, rev_options.to_args(), url, dest)
52+
cmd_args = make_command(
53+
"checkout", "--lightweight", flag, rev_options.to_args(), url, dest
54+
)
5355
self.run_command(cmd_args)
5456

5557
def switch(self, dest: str, url: HiddenText, rev_options: RevOptions) -> None:
5658
self.run_command(make_command("switch", url), cwd=dest)
5759

5860
def update(self, dest: str, url: HiddenText, rev_options: RevOptions) -> None:
59-
cmd_args = make_command("pull", "-q", rev_options.to_args())
61+
output = self.run_command(
62+
make_command("info"), show_stdout=False, stdout_only=True, cwd=dest)
63+
if output.startswith('Standalone '):
64+
# Older versions of pip used to create standalone branches.
65+
# Convert the standalone branch to a checkout by calling "bzr bind".
66+
cmd_args = make_command("bind", "-q", url)
67+
self.run_command(cmd_args, cwd=dest)
68+
69+
cmd_args = make_command("update", "-q", rev_options.to_args())
6070
self.run_command(cmd_args, cwd=dest)
6171

6272
@classmethod

0 commit comments

Comments
 (0)