Skip to content

Commit

Permalink
conan lock update comand (#3784)
Browse files Browse the repository at this point in the history
* conan lock update comand

* missing file
  • Loading branch information
memsharded authored Jul 2, 2024
1 parent 22a2eef commit 83e510b
Show file tree
Hide file tree
Showing 4 changed files with 67 additions and 2 deletions.
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.

0 comments on commit 83e510b

Please sign in to comment.