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

Add a repository parameter to coordinates_to_conandata(). #17722

Merged
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
7 changes: 5 additions & 2 deletions conan/tools/scm/git.py
Original file line number Diff line number Diff line change
Expand Up @@ -260,15 +260,18 @@ def included_files(self):
files = files.splitlines()
return files

def coordinates_to_conandata(self):
def coordinates_to_conandata(self, repository=False):
"""
Capture the "url" and "commit" from the Git repo, calling ``get_url_and_commit()``, and then
store those in the ``conandata.yml`` under the "scm" key. This information can be
used later to clone and checkout the exact source point that was used to create this
package, and can be useful even if the recipe uses ``exports_sources`` as mechanism to
embed the sources.

:param repository: By default gets the commit of the defined folder, use repository=True to get
the commit of the repository instead.
"""
scm_url, scm_commit = self.get_url_and_commit()
scm_url, scm_commit = self.get_url_and_commit(repository=repository)
update_conandata(self._conanfile, {"scm": {"commit": scm_commit, "url": scm_url}})

def checkout_from_conandata_coordinates(self):
Expand Down
Loading