]> scripts.mit.edu Git - wizard.git/commitdiff
Add massmigrate stub.
authorEdward Z. Yang <edwardzyang@thewritingpot.com>
Wed, 17 Jun 2009 05:00:37 +0000 (01:00 -0400)
committerEdward Z. Yang <edwardzyang@thewritingpot.com>
Wed, 17 Jun 2009 05:00:37 +0000 (01:00 -0400)
Signed-off-by: Edward Z. Yang <edwardzyang@thewritingpot.com>
bin/wizard
lib/wizard/command/__init__.py
lib/wizard/command/massmigrate.py [new file with mode: 0644]
lib/wizard/shell.py

index 4a204e84d472cc706ac9f74c75fec780ce868d87..df9b8aeca5689ce4f8b913081e70cc13cf20e7ad 100755 (executable)
@@ -14,9 +14,10 @@ def main():
 Wizard is a Git-based autoinstall management system for scripts.
 
 Its commands are:
-    info        Reports information about an autoinstall
-    migrate     Migrate autoinstalls from old format to Git-based format
-    summary     Generate statistics about autoinstalls
+    info            Reports information about an autoinstall
+    massmigrate     Performs mass migration of autoinstalls of an application
+    migrate         Migrate autoinstalls from old format to Git-based format
+    summary         Generate statistics about autoinstalls
 
 See '%prog help COMMAND' for more information on a specific command."""
 
index c6e878d7f3e1c394b5df5223b05b18cd1750b10f..7b5f36bc47c14736c15c75716bb4cd67ce060113 100644 (file)
@@ -1,3 +1,4 @@
 from info import info
 from migrate import migrate
 from summary import summary
+from massmigrate import massmigrate
diff --git a/lib/wizard/command/massmigrate.py b/lib/wizard/command/massmigrate.py
new file mode 100644 (file)
index 0000000..51aea1f
--- /dev/null
@@ -0,0 +1,38 @@
+import optparse
+import sys
+import os
+import shutil
+
+import migrate
+import wizard.deploy as wd
+import wizard.shell as sh
+from wizard import *
+
+def massmigrate(argv, global_options, logger = None):
+    usage = """usage: %prog massmigrate [ARGS] APPLICATION
+
+Mass migrates an application to the new repository format.
+Essentially equivalent to running '%prog migrate' on all
+autoinstalls for a particular application found by parallel-find,
+but with advanced reporting.
+
+NOTE: --verbose implies --no-parallelize, as it results in
+output going to stdout/stderr."""
+    parser = WizardOptionParser(usage)
+    parser.add_option("--no-parallelize", dest="no_parallelize", action="store_true",
+            default=False, help="Turn off parallelization")
+    parser.add_option("--dry-run", dest="dry_run", action="store_true",
+            default=False, help="Print commands that would be run. Implies --no-parallelize")
+    options, args, logger = parser.parse_all(argv, logger)
+    if len(args) > 1:
+        parser.error("too many arguments")
+    elif not args:
+        parser.error("must specify application to migrate")
+    if options.verbose or options.dry_run:
+        options.no_parallelize = True
+    app = args[0]
+    base_args = []
+    if options.verbose: base_args.append("--verbose")
+    if options.dry_run: base_args.append("--dry-run")
+    logger.info(app)
+    raise NotImplementedError
index 40b09e6abe5024b7379a5d91072715dc5de0a3e9..a65a250abe6a566e54a364b7c6301cf8950617f4 100644 (file)
@@ -16,6 +16,8 @@ class Shell(object):
         proc = None
         if self.logger:
             if hasattr(self.logger, "verbose"):
+                # this is a special short-circuit to make redrawing
+                # output from Git work
                 proc = subprocess.Popen(args, stdout=sys.stdout, stderr=sys.stderr)
             else:
                 proc = subprocess.Popen(args, stdout=PIPE, stderr=STDOUT)