Skip to content

Commit

Permalink
Modify pref.copy_clear_rev() behavior
Browse files Browse the repository at this point in the history
  • Loading branch information
danimtb committed Oct 7, 2019
1 parent 358be67 commit d8e6b43
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 11 deletions.
2 changes: 1 addition & 1 deletion conans/client/graph/graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ def new_build_order(self):
new_level = []
for n in level:
if n.binary == BINARY_BUILD and n.pref not in total_prefs:
new_level.append((n.id, n.pref.copy_with_revs(n.pref.ref.revision, None)))
new_level.append((n.id, n.pref.copy_clear_rev()))
total_prefs.add(n.pref)
if new_level:
result.append(new_level)
Expand Down
4 changes: 2 additions & 2 deletions conans/client/rest/client_routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,15 +87,15 @@ def recipe_snapshot(self, ref):

def package_snapshot(self, pref):
"""get recipe manifest url"""
return self.base_url + self._for_package(pref.copy_clear_rev())
return self.base_url + self._for_package(pref.copy_clear_revs())

def recipe_manifest(self, ref):
"""get recipe manifest url"""
return self.base_url + _format_ref(routes.v1_recipe_digest, ref.copy_clear_rev())

def package_manifest(self, pref):
"""get manifest url"""
return self.base_url + _format_pref(routes.v1_package_digest, pref.copy_clear_rev())
return self.base_url + _format_pref(routes.v1_package_digest, pref.copy_clear_revs())

def recipe_download_urls(self, ref):
""" urls to download the recipe"""
Expand Down
3 changes: 1 addition & 2 deletions conans/model/ref.py
Original file line number Diff line number Diff line change
Expand Up @@ -290,8 +290,7 @@ def copy_with_revs(self, revision, p_revision):
return PackageReference(self.ref.copy_with_rev(revision), self.id, p_revision)

def copy_clear_rev(self):
ref = self.ref.copy_clear_rev()
return PackageReference(ref, self.id, revision=None)
return self.copy_with_revs(self.ref.revision, None)

def copy_clear_revs(self):
return self.copy_with_revs(None, None)
Expand Down
12 changes: 6 additions & 6 deletions conans/test/integration/revisions_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -424,10 +424,10 @@ def test_new_exported_recipe_clears_outdated_packages(self, v1):
msg = "Removing the local binary packages from different recipe revisions"
if v1:
self.assertNotIn(msg, client.out)
self.assertTrue(client.package_exists(pref_outdated.copy_clear_rev()))
self.assertTrue(client.package_exists(pref_outdated.copy_clear_revs()))
else:
self.assertIn(msg, client.out)
self.assertFalse(client.package_exists(pref_outdated.copy_clear_rev()))
self.assertFalse(client.package_exists(pref_outdated.copy_clear_revs()))

self.assertTrue(client.package_exists(pref_ok))

Expand Down Expand Up @@ -492,18 +492,18 @@ def test_remove_oudated_packages_locally_removes_orphan_prevs(self):
layout = self.c_v1.cache.package_layout(pref.ref.copy_clear_rev())

# Assert pref (outdated) is in the cache
self.assertTrue(layout.package_exists(pref.copy_clear_rev()))
self.assertTrue(layout.package_exists(pref.copy_clear_revs()))

# Assert pref2 is also in the cache
self.assertTrue(layout.package_exists(pref2.copy_clear_rev()))
self.assertTrue(layout.package_exists(pref2.copy_clear_revs()))

self.c_v1.run("remove {} --outdated -f".format(pref.ref))

# Assert pref (outdated) is not in the cache anymore
self.assertFalse(layout.package_exists(pref.copy_clear_rev()))
self.assertFalse(layout.package_exists(pref.copy_clear_revs()))

# Assert pref2 is in the cache
self.assertTrue(layout.package_exists(pref2.copy_clear_rev()))
self.assertTrue(layout.package_exists(pref2.copy_clear_revs()))

@parameterized.expand([(True,), (False,)])
def test_remove_oudated_packages_remote(self, v1):
Expand Down

0 comments on commit d8e6b43

Please sign in to comment.