Skip to content

Document ConanFile::revision_mode attribute #1126

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

Merged
merged 2 commits into from
Mar 25, 2019
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
18 changes: 7 additions & 11 deletions mastering/revisions.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
.. _package_revisions:


Package Revisions
==================

Expand All @@ -23,18 +26,11 @@ How it works
**In the client**

- When a **recipe** is exported, Conan calculates a unique ID (revision). For every change,
a new recipe revision (RREV) will be calculated:

- If Conan detects some control version system (Git or SVN) in the conanfile directory, the commit hash will be used as the RREV.
- Otherwise, the checksum hash of the recipe manifest will be used as the RREV.

.. note::

In future versions Conan will let the user choose to use the "recipe manifest" instead of the scm. For example,
when you use a mono-repo with N recipes, it is more convenient to calculate each
recipe revision based on its contents and not in the common github repository commit hash.
(https://github.com/conan-io/conan/issues/4413)
a new recipe revision (RREV) will be calculated. By default it will use the checksum hash of the
recipe manifest.

Nevertheless, the recipe creator can explicitly declare the :ref:`revision mode<revision_mode_attribute>`,
it can be either ``scm`` (uses version control system or raises) or ``hash`` (use manifest hash).

- When a **package** is created (by running :ref:`conan create<conan_create>` or :ref:`conan export-pkg<conan_export-pkg>`)
a new package revision (PREV) will be calculated always using the hash of the package contents.
Expand Down
19 changes: 19 additions & 0 deletions reference/conanfile/attributes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1146,3 +1146,22 @@ To know more about the usage of ``scm`` check:

- :ref:`Creating packages/Recipe and sources in a different repo <external_repo>`
- :ref:`Creating packages/Recipe and sources in the same repo <package_repo>`


.. _revision_mode_attribute:

revision_mode
-------------

.. warning::

This attribute is part of the :ref:`package revisions<package_revisions>` feature, so
it is also an **experimental** feature subject to breaking changes in future releases.

This attribute allow each recipe to declare how the revision for the recipe itself should
be computed. It can take three different values:

- ``"hash"`` (by default): Conan will use the checksum hash of the recipe manifest to
compute the revision for the recipe.
- ``"scm"``: the commit ID will be used as the recipe revision if it belongs to a known
repository system (Git or SVN). If there is no repository it will raise an error.