Changes to instance naming:
[mdk.git] / mdk / commands / backport.py
index e3b36b0..010dca3 100644 (file)
@@ -51,10 +51,13 @@ class BackportCommand(Command):
                 }
             ),
             (
-                ['-i', '--integration'],
+                ['--backport-to'],
                 {
-                    'action': 'store_true',
-                    'help': 'backport to integration instances'
+                    'action': 'store',
+                    'choices': ['integration', 'review', 'stable'],
+                    'default': 'stable',
+                    'help': 'which instances to backport to',
+                    'metavar': 'instances'
                 }
             ),
             (
@@ -115,7 +118,7 @@ class BackportCommand(Command):
         M = None
         branch = args.branch
         versions = args.versions
-        integration = args.integration
+        backportto = args.backport_to
 
         # If we don't have a branch, we need an instance
         M = self.Wp.resolve(args.name)
@@ -147,7 +150,14 @@ class BackportCommand(Command):
 
         # Integration?
         if M:
-            integration = M.isIntegration()
+            if M.isIntegration():
+                backportto = 'integration'
+
+            if M.isStable():
+                backportto = 'stable'
+
+            if M.isReview():
+                backportto = 'review'
 
         def stashPop(stash):
             """Small helper to pop the stash has we have to do it in some different places"""
@@ -162,7 +172,7 @@ class BackportCommand(Command):
         for v in versions:
 
             # Gets the instance to cherry-pick to
-            name = self.Wp.generateInstanceName(v, integration=integration)
+            name = self.Wp.generateInstanceName(v, purpose=backportto)
             if not self.Wp.isMoodle(name):
                 logging.warning('Could not find instance %s for version %s' % (name, v))
                 continue