Add a PackageVirtualDbapi.copy() method. (trunk r9982)
authorZac Medico <zmedico@gentoo.org>
Sun, 27 Apr 2008 00:26:28 +0000 (00:26 -0000)
committerZac Medico <zmedico@gentoo.org>
Sun, 27 Apr 2008 00:26:28 +0000 (00:26 -0000)
svn path=/main/branches/2.1.2/; revision=9988

bin/emerge

index 27b8ddc2ecff040db98a737031b2db5840963eae..456f6f4cdc808fff3855ecce9415bb0960a865ee 100755 (executable)
@@ -1652,6 +1652,15 @@ class PackageVirtualDbapi(portage.dbapi):
                self._cp_map = {}
                self._cpv_map = {}
 
+       def copy(self):
+               obj = PackageVirtualDbapi(self.settings)
+               obj._match_cache = self._match_cache.copy()
+               obj._cp_map = self._cp_map.copy()
+               for k, v in obj._cp_map.iteritems():
+                       obj._cp_map[k] = v[:]
+               obj._cpv_map = self._cpv_map.copy()
+               return obj
+
        def __contains__(self, item):
                existing = self._cpv_map.get(item.cpv)
                if existing is not None and \