Skip to content

Commit

Permalink
allow to copy & paste from compact format into conan-lock-add (#15262)
Browse files Browse the repository at this point in the history
* 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 <git@rinconblanco.es>
  • Loading branch information
memsharded and AbrilRBS authored Jan 4, 2024
1 parent 89a83ef commit 0ae23f2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion conan/cli/commands/list.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
8 changes: 5 additions & 3 deletions conans/test/integration/command_v2/list_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
""")
Expand Down

0 comments on commit 0ae23f2

Please sign in to comment.