Skip to content

Commit

Permalink
bazaar: Use lightweight checkouts rather than a full branch clone
Browse files Browse the repository at this point in the history
Fixes #5444
  • Loading branch information
jelmer committed Sep 4, 2022
1 parent e89e391 commit 7380239
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
1 change: 1 addition & 0 deletions news/5444.feature.rst
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.
15 changes: 13 additions & 2 deletions src/pip/_internal/vcs/bazaar.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,25 @@ def fetch_new(
flag = ""
else:
flag = f"-{'v'*verbosity}"
cmd_args = make_command("branch", flag, rev_options.to_args(), url, dest)
cmd_args = make_command(
"checkout", "--lightweight", flag, rev_options.to_args(), url, dest
)
self.run_command(cmd_args)

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

def update(self, dest: str, url: HiddenText, rev_options: RevOptions) -> None:
cmd_args = make_command("pull", "-q", rev_options.to_args())
output = self.run_command(
make_command("info"), show_stdout=False, stdout_only=True, cwd=dest
)
if output.startswith("Standalone "):
# Older versions of pip used to create standalone branches.
# Convert the standalone branch to a checkout by calling "bzr bind".
cmd_args = make_command("bind", "-q", url)
self.run_command(cmd_args, cwd=dest)

cmd_args = make_command("update", "-q", rev_options.to_args())
self.run_command(cmd_args, cwd=dest)

@classmethod
Expand Down

0 comments on commit 7380239

Please sign in to comment.