From 0ae23f2760d5ef3961a2d8bfebfb1985a01ab560 Mon Sep 17 00:00:00 2001 From: James Date: Thu, 4 Jan 2024 23:15:48 +0100 Subject: [PATCH] allow to copy & paste from compact format into conan-lock-add (#15262) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * allow to copy & paste from compact format into conan-lock-add * Revert, and just print the %timestamp too * Remove float timestamp from conan list --format=text * Fix test --------- Co-authored-by: Rubén Rincón Blanco --- conan/cli/commands/list.py | 2 +- conans/test/integration/command_v2/list_test.py | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/conan/cli/commands/list.py b/conan/cli/commands/list.py index 48a7cdffd5a..61b067a766d 100644 --- a/conan/cli/commands/list.py +++ b/conan/cli/commands/list.py @@ -109,7 +109,7 @@ def prepare_pkglist_compact(pkglist): new_rrev = f"{ref}#{rrev}" timestamp = rrev_info.pop("timestamp", None) if timestamp: - new_rrev += f" ({timestamp_to_str(timestamp)})" + new_rrev += f"%{timestamp} ({timestamp_to_str(timestamp)})" packages = rrev_info.pop("packages", None) if packages: diff --git a/conans/test/integration/command_v2/list_test.py b/conans/test/integration/command_v2/list_test.py index 2368045035e..6248e99dab6 100644 --- a/conans/test/integration/command_v2/list_test.py +++ b/conans/test/integration/command_v2/list_test.py @@ -778,14 +778,16 @@ def test_list_compact_no_settings_no_options(self): c.run("create pkg -s os=Windows -s arch=x86") c.run("create other") c.run("list *:* --format=compact") - expected_output = re.sub(r"\(.*\)", "(timestamp)", c.stdout) + expected_output = re.sub(r"%.* ", "%timestamp ", + re.sub(r"\(.*\)", "(timestamp)", c.stdout)) + expected = textwrap.dedent("""\ Local Cache other/1.0 - other/1.0#d3c8cc5e6d23ca8c6f0eaa6285c04cbd (timestamp) + other/1.0#d3c8cc5e6d23ca8c6f0eaa6285c04cbd%timestamp (timestamp) other/1.0#d3c8cc5e6d23ca8c6f0eaa6285c04cbd:da39a3ee5e6b4b0d3255bfef95601890afd80709 pkg/1.0 - pkg/1.0#d24b74828b7681f08d8f5ba0e7fd791e (timestamp) + pkg/1.0#d24b74828b7681f08d8f5ba0e7fd791e%timestamp (timestamp) pkg/1.0#d24b74828b7681f08d8f5ba0e7fd791e:c11e463c49652ba9c5adc62573ee49f966bd8417 settings: Windows, x86 """)