Skip to content

Commit 6858c92

Browse files
authored
Merge pull request #11051 from devsagul/fix/svn-fails-with-verbose
fix svn and bazaar failing to checkout in verbose mode
2 parents 77d0ddc + eb87664 commit 6858c92

File tree

4 files changed

+51
-7
lines changed

4 files changed

+51
-7
lines changed

news/11050.bugfix.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Fix error on checkout for subversion and bazaar with verbose mode on.

src/pip/_internal/vcs/bazaar.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,13 +44,13 @@ def fetch_new(
4444
display_path(dest),
4545
)
4646
if verbosity <= 0:
47-
flag = "--quiet"
47+
flags = ["--quiet"]
4848
elif verbosity == 1:
49-
flag = ""
49+
flags = []
5050
else:
51-
flag = f"-{'v'*verbosity}"
51+
flags = [f"-{'v'*verbosity}"]
5252
cmd_args = make_command(
53-
"checkout", "--lightweight", flag, rev_options.to_args(), url, dest
53+
"checkout", "--lightweight", *flags, rev_options.to_args(), url, dest
5454
)
5555
self.run_command(cmd_args)
5656

src/pip/_internal/vcs/subversion.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -288,12 +288,12 @@ def fetch_new(
288288
display_path(dest),
289289
)
290290
if verbosity <= 0:
291-
flag = "--quiet"
291+
flags = ["--quiet"]
292292
else:
293-
flag = ""
293+
flags = []
294294
cmd_args = make_command(
295295
"checkout",
296-
flag,
296+
*flags,
297297
self.get_remote_call_options(),
298298
rev_options.to_args(),
299299
url,

tests/unit/test_vcs.py

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -777,6 +777,22 @@ def assert_call_args(self, args: CommandArgs) -> None:
777777
assert self.call_subprocess_mock.call_args[0][0] == args
778778

779779
def test_obtain(self) -> None:
780+
self.svn.obtain(self.dest, hide_url(self.url), verbosity=1)
781+
self.assert_call_args(
782+
[
783+
"svn",
784+
"checkout",
785+
"--non-interactive",
786+
"--username",
787+
"username",
788+
"--password",
789+
hide_value("password"),
790+
hide_url("http://svn.example.com/"),
791+
"/tmp/test",
792+
]
793+
)
794+
795+
def test_obtain_quiet(self) -> None:
780796
self.svn.obtain(self.dest, hide_url(self.url), verbosity=0)
781797
self.assert_call_args(
782798
[
@@ -794,6 +810,18 @@ def test_obtain(self) -> None:
794810
)
795811

796812
def test_fetch_new(self) -> None:
813+
self.svn.fetch_new(self.dest, hide_url(self.url), self.rev_options, verbosity=1)
814+
self.assert_call_args(
815+
[
816+
"svn",
817+
"checkout",
818+
"--non-interactive",
819+
hide_url("svn+http://username:[email protected]/"),
820+
"/tmp/test",
821+
]
822+
)
823+
824+
def test_fetch_new_quiet(self) -> None:
797825
self.svn.fetch_new(self.dest, hide_url(self.url), self.rev_options, verbosity=0)
798826
self.assert_call_args(
799827
[
@@ -807,6 +835,21 @@ def test_fetch_new(self) -> None:
807835
)
808836

809837
def test_fetch_new_revision(self) -> None:
838+
rev_options = RevOptions(Subversion, "123")
839+
self.svn.fetch_new(self.dest, hide_url(self.url), rev_options, verbosity=1)
840+
self.assert_call_args(
841+
[
842+
"svn",
843+
"checkout",
844+
"--non-interactive",
845+
"-r",
846+
"123",
847+
hide_url("svn+http://username:[email protected]/"),
848+
"/tmp/test",
849+
]
850+
)
851+
852+
def test_fetch_new_revision_quiet(self) -> None:
810853
rev_options = RevOptions(Subversion, "123")
811854
self.svn.fetch_new(self.dest, hide_url(self.url), rev_options, verbosity=0)
812855
self.assert_call_args(

0 commit comments

Comments
 (0)