Skip to content

Commit 83e510b

Browse files
authored
conan lock update comand (#3784)
* conan lock update comand * missing file
1 parent 22a2eef commit 83e510b

File tree

4 files changed

+67
-2
lines changed

4 files changed

+67
-2
lines changed

reference/commands/lock.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ In addition to these commands, most of the Conan commands that compute a graph,
1818
- :doc:`conan lock remove <lock/remove>`: Manually remove items from a lockfile
1919
- :doc:`conan lock create <lock/create>`: Evaluates a dependency graph and save a lockfile
2020
- :doc:`conan lock merge <lock/merge>`: Merge several existing lockfiles into one.
21+
- :doc:`conan lock update <lock/update>`: Manually update items from a lockfile
2122

2223

2324
.. autocommand::

reference/commands/lock/add.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ conan lock add
55
:command: conan lock add -h
66

77

8-
The ``conan lock add`` command is able to add a package version to an existing or new lockfile ``requires``, ``build_requires`` or ``python_requires``.
8+
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``.
99

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

reference/commands/lock/remove.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ conan lock remove
55
:command: conan lock remove -h
66

77

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

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

reference/commands/lock/update.rst

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
conan lock update
2+
=================
3+
4+
.. autocommand::
5+
:command: conan lock update -h
6+
7+
8+
The ``conan lock update`` command is able to update ``requires``, ``build_requires``, ``python_requires`` or ``config_requires`` items from an existing lockfile.
9+
10+
For example, if we have the following ``conan.lock``:
11+
12+
.. code-block:: bash
13+
14+
$ cat conan.lock
15+
{
16+
"version": "0.5",
17+
"requires": [
18+
"math/1.0#85d927a4a067a531b1a9c7619522c015%1702683583.3411012",
19+
"engine/1.0#fd2b006646a54397c16a1478ac4111ac%1702683583.3544693"
20+
],
21+
"build_requires": [
22+
"cmake/1.0#85d927a4a067a531b1a9c7619522c015%1702683583.3411012",
23+
"ninja/1.0#fd2b006646a54397c16a1478ac4111ac%1702683583.3544693"
24+
],
25+
"python_requires": [
26+
"mytool/1.0#85d927a4a067a531b1a9c7619522c015%1702683583.3411012",
27+
"othertool/1.0#fd2b006646a54397c16a1478ac4111ac%1702683583.3544693"
28+
]
29+
}
30+
31+
32+
33+
The ``conan lock update`` command:
34+
35+
.. code-block:: bash
36+
37+
$ conan lock update --requires=math/1.1 --build-requires=cmake/1.1
38+
39+
Will result in the following ``conan.lock``:
40+
41+
.. code-block:: bash
42+
43+
$ cat conan.lock
44+
{
45+
"version": "0.5",
46+
"requires": [
47+
"math/1.1",
48+
"engine/1.0#fd2b006646a54397c16a1478ac4111ac%1702683583.3544693"
49+
],
50+
"build_requires": [
51+
"cmake/1.1",
52+
"ninja/1.0#fd2b006646a54397c16a1478ac4111ac%1702683583.3544693"
53+
],
54+
"python_requires": [
55+
"mytool/1.0#85d927a4a067a531b1a9c7619522c015%1702683583.3411012",
56+
"othertool/1.0#fd2b006646a54397c16a1478ac4111ac%1702683583.3544693"
57+
]
58+
}
59+
60+
61+
The command will replace existing locked references that matches the same package name with the provided argument values.
62+
If the provided references does not exist in the lockfile, they will be added (same as ``conan lock add`` command).
63+
64+
This command is similar to do a ``conan lock remove`` followed by a ``conan lock add`` command.

0 commit comments

Comments
 (0)