Skip to content

Commit

Permalink
Merge pull request #11051 from devsagul/fix/svn-fails-with-verbose
Browse files Browse the repository at this point in the history
fix svn and bazaar failing to checkout in verbose mode
  • Loading branch information
pfmoore authored Apr 19, 2024
2 parents 77d0ddc + eb87664 commit 6858c92
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 7 deletions.
1 change: 1 addition & 0 deletions news/11050.bugfix.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix error on checkout for subversion and bazaar with verbose mode on.
8 changes: 4 additions & 4 deletions src/pip/_internal/vcs/bazaar.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,13 @@ def fetch_new(
display_path(dest),
)
if verbosity <= 0:
flag = "--quiet"
flags = ["--quiet"]
elif verbosity == 1:
flag = ""
flags = []
else:
flag = f"-{'v'*verbosity}"
flags = [f"-{'v'*verbosity}"]
cmd_args = make_command(
"checkout", "--lightweight", flag, rev_options.to_args(), url, dest
"checkout", "--lightweight", *flags, rev_options.to_args(), url, dest
)
self.run_command(cmd_args)

Expand Down
6 changes: 3 additions & 3 deletions src/pip/_internal/vcs/subversion.py
Original file line number Diff line number Diff line change
Expand Up @@ -288,12 +288,12 @@ def fetch_new(
display_path(dest),
)
if verbosity <= 0:
flag = "--quiet"
flags = ["--quiet"]
else:
flag = ""
flags = []
cmd_args = make_command(
"checkout",
flag,
*flags,
self.get_remote_call_options(),
rev_options.to_args(),
url,
Expand Down
43 changes: 43 additions & 0 deletions tests/unit/test_vcs.py
Original file line number Diff line number Diff line change
Expand Up @@ -777,6 +777,22 @@ def assert_call_args(self, args: CommandArgs) -> None:
assert self.call_subprocess_mock.call_args[0][0] == args

def test_obtain(self) -> None:
self.svn.obtain(self.dest, hide_url(self.url), verbosity=1)
self.assert_call_args(
[
"svn",
"checkout",
"--non-interactive",
"--username",
"username",
"--password",
hide_value("password"),
hide_url("http://svn.example.com/"),
"/tmp/test",
]
)

def test_obtain_quiet(self) -> None:
self.svn.obtain(self.dest, hide_url(self.url), verbosity=0)
self.assert_call_args(
[
Expand All @@ -794,6 +810,18 @@ def test_obtain(self) -> None:
)

def test_fetch_new(self) -> None:
self.svn.fetch_new(self.dest, hide_url(self.url), self.rev_options, verbosity=1)
self.assert_call_args(
[
"svn",
"checkout",
"--non-interactive",
hide_url("svn+http://username:[email protected]/"),
"/tmp/test",
]
)

def test_fetch_new_quiet(self) -> None:
self.svn.fetch_new(self.dest, hide_url(self.url), self.rev_options, verbosity=0)
self.assert_call_args(
[
Expand All @@ -807,6 +835,21 @@ def test_fetch_new(self) -> None:
)

def test_fetch_new_revision(self) -> None:
rev_options = RevOptions(Subversion, "123")
self.svn.fetch_new(self.dest, hide_url(self.url), rev_options, verbosity=1)
self.assert_call_args(
[
"svn",
"checkout",
"--non-interactive",
"-r",
"123",
hide_url("svn+http://username:[email protected]/"),
"/tmp/test",
]
)

def test_fetch_new_revision_quiet(self) -> None:
rev_options = RevOptions(Subversion, "123")
self.svn.fetch_new(self.dest, hide_url(self.url), rev_options, verbosity=0)
self.assert_call_args(
Expand Down

0 comments on commit 6858c92

Please sign in to comment.