Skip to content

Commit

Permalink
new revision_mode (#16195)
Browse files Browse the repository at this point in the history
  • Loading branch information
memsharded authored May 7, 2024
1 parent 69a251c commit fa8b03d
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
16 changes: 16 additions & 0 deletions conans/model/info.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,14 @@ def full_package_mode(self):
self.package_id = self._package_id
self.recipe_revision = None

def revision_mode(self):
self.name = self._ref.name
self.version = self._ref.version
self.user = self._ref.user
self.channel = self._ref.channel
self.package_id = None
self.recipe_revision = self._ref.revision

def full_mode(self):
self.name = self._ref.name
self.version = self._ref.version
Expand Down Expand Up @@ -223,6 +231,10 @@ def full_package_mode(self):
for r in self._data.values():
r.full_package_mode()

def revision_mode(self):
for r in self._data.values():
r.revision_mode()

def full_mode(self):
for r in self._data.values():
r.full_mode()
Expand Down Expand Up @@ -285,6 +297,10 @@ def full_recipe_mode(self):
for r in self._refs:
r.full_recipe_mode()

def revision_mode(self):
for r in self._refs:
r.revision_mode()

def full_mode(self):
for r in self._refs:
r.full_mode()
Expand Down
4 changes: 3 additions & 1 deletion conans/test/integration/package_id/test_config_package_id.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
("myconfig/1.2.3#rev1:pid1#prev1", "minor_mode", "myconfig/1.2.Z"),
("myconfig/1.2.3#rev1:pid1#prev1", "patch_mode", "myconfig/1.2.3"),
("myconfig/1.2.3#rev1:pid1#prev1", "full_mode", "myconfig/1.2.3#rev1:pid1"),
("myconfig/1.2.3#rev1:pid1#prev1", "revision_mode", "myconfig/1.2.3#rev1"),
("myconfig/1.2.3", "minor_mode", "myconfig/1.2.Z")])
def test_config_package_id(config_version, mode, result):
c = TestClient()
Expand All @@ -24,7 +25,8 @@ def test_config_package_id(config_version, mode, result):
rrev = info["Local Cache"]["pkg/0.1"]["revisions"]["485dad6cb11e2fa99d9afbe44a57a164"]
package_id = {"myconfig/1.2.Z": "c78b4d8224154390356fe04fe598d67aec930199",
"myconfig/1.2.3": "60005f5b11bef3ddd686b13f5c6bf576a9b882b8",
"myconfig/1.2.3#rev1:pid1": "b1525975eb5420cef45b4ddd1544f87c29c773a5"}
"myconfig/1.2.3#rev1:pid1": "b1525975eb5420cef45b4ddd1544f87c29c773a5",
"myconfig/1.2.3#rev1": "aae875ae226416f177bf386a3e4ad6aaffce09e7"}
package_id = package_id.get(result)
pkg = rrev["packages"][package_id]
assert pkg["info"] == {"config_version": [result]}
Expand Down

0 comments on commit fa8b03d

Please sign in to comment.