Skip to content

Commit

Permalink
Add a repository parameter to coordinates_to_conandata().
Browse files Browse the repository at this point in the history
  • Loading branch information
Adnn committed Feb 6, 2025
1 parent 000fdee commit 93c745b
Showing 1 changed file with 5 additions and 2 deletions.
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)
update_conandata(self._conanfile, {"scm": {"commit": scm_commit, "url": scm_url}})

def checkout_from_conandata_coordinates(self):
Expand Down

0 comments on commit 93c745b

Please sign in to comment.