# HG changeset patch
# User Sylvain Thénault <sylvain.thenault@logilab.fr>
# Date 1245392962 -7200
# Node ID 4ea13a828513c8679a3a9964a84c546a310b6047
# Parent  9a14e1ee0eabe5cc8e2c456874b11c2fe2670bca
add removedeps option to remove_cube to control wether a cube's dependencies should be removed as well or not

diff -r 9a14e1ee0eab -r 4ea13a828513 common/migration.py
--- a/common/migration.py	Fri Jun 19 08:28:19 2009 +0200
+++ b/common/migration.py	Fri Jun 19 08:29:22 2009 +0200
@@ -328,14 +328,13 @@
             self.config.add_cubes(newcubes)
         return newcubes
 
-    def cmd_remove_cube(self, cube):
+    def cmd_remove_cube(self, cube, removedeps=True):
+        if removedeps:
+            toremove = self.config.expand_cubes([cube])
+        else:
+            toremove = (cube,)
         origcubes = self.config._cubes
-        basecubes = list(origcubes)
-        for pkg in self.config.expand_cubes([cube]):
-            try:
-                basecubes.remove(pkg)
-            except ValueError:
-                continue
+        basecubes = [c for c in origcubes if not c in toremove]
         self.config._cubes = tuple(self.config.expand_cubes(basecubes))
         removed = [p for p in origcubes if not p in self.config._cubes]
         assert cube in removed, \
diff -r 9a14e1ee0eab -r 4ea13a828513 server/migractions.py
--- a/server/migractions.py	Fri Jun 19 08:28:19 2009 +0200
+++ b/server/migractions.py	Fri Jun 19 08:29:22 2009 +0200
@@ -523,8 +523,9 @@
             self.exec_event_script('postcreate', self.config.cube_dir(pack))
             self.commit()
 
-    def cmd_remove_cube(self, cube):
-        removedcubes = super(ServerMigrationHelper, self).cmd_remove_cube(cube)
+    def cmd_remove_cube(self, cube, removedeps=True):
+        removedcubes = super(ServerMigrationHelper, self).cmd_remove_cube(
+            cube, removedeps)
         if not removedcubes:
             return
         fsschema = self.fs_schema