stack_lists: optimize repo handling more
authorZac Medico <zmedico@gentoo.org>
Sat, 27 Nov 2010 14:19:50 +0000 (06:19 -0800)
committerZac Medico <zmedico@gentoo.org>
Sat, 27 Nov 2010 14:19:50 +0000 (06:19 -0800)
pym/portage/util/__init__.py

index e8b60fbfd3ca716913360f616c0fecf5a27b4d88..4db33498cc93e096ffe5d5a138ab89925b822645 100644 (file)
@@ -272,7 +272,14 @@ def stack_lists(lists, incremental=1, remember_source_file=False,
                                                to_be_removed = []
                                                token_slice = token[1:]
                                                for atom in new_list:
-                                                       if atom.without_repo == token_slice:
+                                                       atom_without_repo = atom
+                                                       if atom.repo is not None:
+                                                               # Atom.without_repo instantiates a new Atom,
+                                                               # which is unnecessary here, so use string
+                                                               # replacement instead.
+                                                               atom_without_repo = \
+                                                                       atom.replace("::" + atom.repo, "", 1)
+                                                       if atom_without_repo == token_slice:
                                                                to_be_removed.append(atom)
                                                if to_be_removed:
                                                        matched = True