Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix conan list ... --format=compact for package revisions #16490

Merged
merged 1 commit into from
Jun 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions conan/cli/commands/list.py
Original file line number Diff line number Diff line change
Expand Up @@ -184,8 +184,9 @@ def compact_diff(diffinfo):
pkg_common_options = compute_common_options(prefs)
pkg_common_options = pkg_common_options if len(pkg_common_options) > 4 else None
for pref, pref_contents in prefs.items():
pref_info = pref_contents.pop("info")
pref_contents.update(compact_format_info(pref_info, pkg_common_options))
pref_info = pref_contents.pop("info", None)
if pref_info is not None:
pref_contents.update(compact_format_info(pref_info, pkg_common_options))
diff_info = pref_contents.pop("diff", None)
if diff_info is not None:
pref_contents["diff"] = compact_diff(diff_info)
Expand Down
18 changes: 18 additions & 0 deletions test/integration/command_v2/list_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -812,6 +812,24 @@ def test_list_compact_no_settings_no_options(self):

assert expected == expected_output

@pytest.mark.parametrize("pattern", [
"pkg/*",
"pkg/1.0",
"pkg/1.0#*",
"pkg/1.0#*:*",
"pkg/1.0#*:*#*",
"pkg/1.0#a69a86bbd19ae2ef7eedc64ae645c531:*",
"pkg/1.0#a69a86bbd19ae2ef7eedc64ae645c531:*",
"pkg/1.0#a69a86bbd19ae2ef7eedc64ae645c531:*#*",
"pkg/1.0#a69a86bbd19ae2ef7eedc64ae645c531:da39a3ee5e6b4b0d3255bfef95601890afd80709#*",
"pkg/1.0#a69a86bbd19ae2ef7eedc64ae645c531:da39a3ee5e6b4b0d3255bfef95601890afd80709#0ba8627bd47edc3a501e8f0eb9a79e5e"
])
def test_list_compact_patterns(self, pattern):
c = TestClient(light=True)
c.save({"pkg/conanfile.py": GenConanfile("pkg", "1.0")})
c.run("create pkg")
c.run(f"list {pattern} --format=compact")


class TestListBinaryFilter:

Expand Down