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

conan lock update comand #3784

Merged
merged 2 commits into from
Jul 2, 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
1 change: 1 addition & 0 deletions reference/commands/lock.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ In addition to these commands, most of the Conan commands that compute a graph,
- :doc:`conan lock remove <lock/remove>`: Manually remove items from a lockfile
- :doc:`conan lock create <lock/create>`: Evaluates a dependency graph and save a lockfile
- :doc:`conan lock merge <lock/merge>`: Merge several existing lockfiles into one.
- :doc:`conan lock update <lock/update>`: Manually update items from a lockfile


.. autocommand::
Expand Down
2 changes: 1 addition & 1 deletion reference/commands/lock/add.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ conan lock add
:command: conan lock add -h


The ``conan lock add`` command is able to add a package version to an existing or new lockfile ``requires``, ``build_requires`` or ``python_requires``.
The ``conan lock add`` command is able to add a package version to an existing or new lockfile ``requires``, ``build_requires``, ``python_requires`` or ``config_requires``.

For example, the following is able to create a lockfile (by default, named ``conan.lock``):

Expand Down
2 changes: 1 addition & 1 deletion reference/commands/lock/remove.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ conan lock remove
:command: conan lock remove -h


The ``conan lock remove`` command is able to remove ``requires``, ``build_requires`` or ``python_requires`` items from an existing lockfile.
The ``conan lock remove`` command is able to remove ``requires``, ``build_requires``, ``python_requires`` or ``config_requires`` items from an existing lockfile.

For example, if we have the following ``conan.lock``:

Expand Down
64 changes: 64 additions & 0 deletions reference/commands/lock/update.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
conan lock update
=================

.. autocommand::
:command: conan lock update -h


The ``conan lock update`` command is able to update ``requires``, ``build_requires``, ``python_requires`` or ``config_requires`` items from an existing lockfile.

For example, if we have the following ``conan.lock``:

.. code-block:: bash

$ cat conan.lock
{
"version": "0.5",
"requires": [
"math/1.0#85d927a4a067a531b1a9c7619522c015%1702683583.3411012",
"engine/1.0#fd2b006646a54397c16a1478ac4111ac%1702683583.3544693"
],
"build_requires": [
"cmake/1.0#85d927a4a067a531b1a9c7619522c015%1702683583.3411012",
"ninja/1.0#fd2b006646a54397c16a1478ac4111ac%1702683583.3544693"
],
"python_requires": [
"mytool/1.0#85d927a4a067a531b1a9c7619522c015%1702683583.3411012",
"othertool/1.0#fd2b006646a54397c16a1478ac4111ac%1702683583.3544693"
]
}



The ``conan lock update`` command:

.. code-block:: bash

$ conan lock update --requires=math/1.1 --build-requires=cmake/1.1

Will result in the following ``conan.lock``:

.. code-block:: bash

$ cat conan.lock
{
"version": "0.5",
"requires": [
"math/1.1",
"engine/1.0#fd2b006646a54397c16a1478ac4111ac%1702683583.3544693"
],
"build_requires": [
"cmake/1.1",
"ninja/1.0#fd2b006646a54397c16a1478ac4111ac%1702683583.3544693"
],
"python_requires": [
"mytool/1.0#85d927a4a067a531b1a9c7619522c015%1702683583.3411012",
"othertool/1.0#fd2b006646a54397c16a1478ac4111ac%1702683583.3544693"
]
}


The command will replace existing locked references that matches the same package name with the provided argument values.
If the provided references does not exist in the lockfile, they will be added (same as ``conan lock add`` command).

This command is similar to do a ``conan lock remove`` followed by a ``conan lock add`` command.