]> scripts.mit.edu Git - wizard.git/commitdiff
More refactoring, fix broken wizard migrate.
authorEdward Z. Yang <edwardzyang@thewritingpot.com>
Fri, 26 Jun 2009 04:50:35 +0000 (00:50 -0400)
committerEdward Z. Yang <edwardzyang@thewritingpot.com>
Fri, 26 Jun 2009 04:50:35 +0000 (00:50 -0400)
Signed-off-by: Edward Z. Yang <edwardzyang@thewritingpot.com>
lib/wizard/command/massmigrate.py
lib/wizard/command/migrate.py
lib/wizard/deploy.py
lib/wizard/shell.py

index 9b5de9adc1aff3253a5b4346206aa593d3507bdd..c183e46c9f63298780f43d852280d9e9faabdf39 100644 (file)
@@ -1,9 +1,8 @@
 import optparse
 
 from wizard import deploy
-
-import _base
-import migrate
+from wizard.command import _base
+from wizard.command import migrate
 
 def massmigrate(argv, global_options, logger = None):
     usage = """usage: %prog massmigrate [ARGS] APPLICATION
index 9b5bcd54694dd8aeadfaabb49c9fcd3e61ce3a33..f181dd0d6052f0770fac9d949ce4b4b22bcee621 100644 (file)
@@ -6,9 +6,7 @@ import logging.handlers
 
 from wizard import deploy
 from wizard import shell
-
-import _base
-import wizard
+from wizard.command import _base
 
 class Error(_base.Error):
     """Base exception for all exceptions raised by migrate"""
@@ -46,8 +44,8 @@ class AlreadyMigratedError(Error):
     def __str__(self):
         return """
 
-ERROR: Directory already contains a .git directory.
-Did you already migrate it?
+ERROR: Directory already contains a .git and/or
+.scripts directory.  Did you already migrate it?
 """
 
 class NotAutoinstallError(Error):
@@ -161,8 +159,14 @@ what repository and tag to use."""
         # XXX: setup .scripts/version???
         # for verbose purposes, give us a git status and git diff
         if options.verbose:
-            sh.call("git", "status")
-            sh.call("git", "diff")
+            try:
+                sh.call("git", "status")
+            except shell.CalledProcessError:
+                pass
+            try:
+                sh.call("git", "diff")
+            except shell.CalledProcessError:
+                pass
     except:
         # this... is pretty bad
         logger.critical("ERROR: Exception detected! Rolling back...")
index cc8058d7ab5e3bbfaca4df3497253425506ceef2..8299e17841999148deec4420216dfd132a666ab6 100644 (file)
@@ -2,7 +2,7 @@ import os.path
 import math
 import fileinput
 import dateutil.parser
-from distutils.version import LooseVersion as Version
+import distutils.version
 
 def getInstallLines(global_options):
     """Retrieves a list of lines from the version directory that
@@ -83,7 +83,7 @@ class Application(object):
         self._c_exists = {}
     def getVersion(self, version):
         if version not in self.versions:
-            self.versions[version] = ApplicationVersion(Version(version), self)
+            self.versions[version] = ApplicationVersion(distutils.version.LooseVersion(version), self)
         return self.versions[version]
     # XXX: This code should go in summary.py; maybe as a mixin, maybe as
     # a visitor acceptor
index a65a250abe6a566e54a364b7c6301cf8950617f4..3484163f2001b3359ee191ee31ff70cb76620beb 100644 (file)
@@ -1,7 +1,9 @@
 import subprocess
-from subprocess import CalledProcessError, PIPE, STDOUT
 import sys
 
+class CalledProcessError(subprocess.CalledProcessError):
+    pass
+
 class Shell(object):
     """An advanced shell, with the ability to do dry-run and log commands"""
     def __init__(self, logger = False, dry = False):
@@ -20,7 +22,7 @@ class Shell(object):
                 # output from Git work
                 proc = subprocess.Popen(args, stdout=sys.stdout, stderr=sys.stderr)
             else:
-                proc = subprocess.Popen(args, stdout=PIPE, stderr=STDOUT)
+                proc = subprocess.Popen(args, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
         else:
             proc = subprocess.Popen(args)
         stdout, _ = proc.communicate()