Skip to content

Commit 4241bc8

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

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-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: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,14 +49,22 @@ 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+
if not os.path.exists(os.path.join(dest, '.bzr', 'branch', 'location')):
62+
# Older versions of pip used to create standalone branches.
63+
# Convert the standalone branch to a checkout by calling "bzr bind".
64+
cmd_args = make_command("bind", "-q", url)
65+
self.run_command(cmd_args, cwd=dest)
66+
67+
cmd_args = make_command("update", "-q", rev_options.to_args())
6068
self.run_command(cmd_args, cwd=dest)
6169

6270
@classmethod

0 commit comments

Comments
 (0)