From 2731f5fae7fe3aedb5166242d576639156e16baa Mon Sep 17 00:00:00 2001 From: Luis Martinez de Bartolome Izquierdo Date: Wed, 24 Oct 2018 12:40:09 +0200 Subject: [PATCH] Don't touch registry when deleted from a remote --- conans/client/remover.py | 8 +------- conans/test/command/remote_test.py | 8 ++++---- 2 files changed, 5 insertions(+), 11 deletions(-) diff --git a/conans/client/remover.py b/conans/client/remover.py index d9938e5fdfa..37a113aa550 100644 --- a/conans/client/remover.py +++ b/conans/client/remover.py @@ -93,15 +93,9 @@ def __init__(self, client_cache, remote_manager, user_io, remote_registry): def _remote_remove(self, reference, package_ids, remote): assert(isinstance(remote, Remote)) if package_ids is None: - result = self._remote_manager.remove(reference, remote) - self._registry.refs.remove(reference, remote_name=remote.name) - self._registry.prefs.remove_all(reference, remote_name=remote.name) - return result + return self._remote_manager.remove(reference, remote) else: tmp = self._remote_manager.remove_packages(reference, package_ids, remote) - for pid in package_ids: - pref = PackageReference(reference, pid) - self._registry.prefs.remove(pref, remote_name=remote.name) return tmp def _local_remove(self, reference, src, build_ids, package_ids): diff --git a/conans/test/command/remote_test.py b/conans/test/command/remote_test.py index 6d1a7aebd7a..3b157884667 100644 --- a/conans/test/command/remote_test.py +++ b/conans/test/command/remote_test.py @@ -37,11 +37,11 @@ class HelloConan(ConanFile): self.client.run('remote list_ref') self.assertIn("lib/1.0@lasote/channel: remote1", self.client.out) - # Upload again to remote2 and remove from remote1, the ref should be removed + # Upload again to remote2 and remove from remote1, the ref shouldm't be removed self.client.run('upload "*" -c -r remote2') self.client.run('remove "lib/1.0@lasote/channel" -f -r remote1') self.client.run('remote list_ref') - self.assertNotIn("lib/1.0@lasote/channel: remote1", self.client.out) + self.assertIn("lib/1.0@lasote/channel: remote1", self.client.out) # Test the packages references now self.client.run('upload "*" -c -r remote1 --all') @@ -57,13 +57,13 @@ class HelloConan(ConanFile): self.assertIn("lib/1.0@lasote/channel:5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9: remote1", self.client.out) - # Upload again to remote2 and remove from remote1, the ref should be removed + # Upload again to remote2 and remove from remote1, the ref shouldn't be removed self.client.run('upload "*" -c -r remote2 --all') self.client.run('remove "lib/1.0@lasote/channel" ' '-p 5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9 -f -r remote1') self.client.run('remote list_ref') self.client.run('remote list_pref lib/1.0@lasote/channel') - self.assertNotIn("lib/1.0@lasote/channel:5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9: remote1", + self.assertIn("lib/1.0@lasote/channel:5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9: remote1", self.client.out) # Remove package locally