]> scripts.mit.edu Git - wizard.git/blobdiff - wizard/command/migrate.py
Make the commit not get call errors subsumed.
[wizard.git] / wizard / command / migrate.py
index 7af52a8e6c1251f4bcb70db5b604791623736e64..259d2e747861ae5728f061d3b2ff9923819b88ec 100644 (file)
@@ -41,10 +41,18 @@ def main(argv, baton):
     if options.force_version:
         version = deployment.application.makeVersion(options.force_version)
     else:
-        deployment.verifyVersion()
-        version = deployment.app_version
+        try:
+            deployment.verifyVersion()
+            version = deployment.app_version
+        except deploy.VersionMismatchError as e:
+            # well, we'll use that then
+            version = deployment.application.makeVersion(str(e.real_version))
     repo = version.application.repository(options.srv_path)
     tag = version.scripts_tag
+    try:
+        sh.call("git", "--git-dir=%s" % repo, "rev-parse", tag)
+    except shell.CallError:
+        raise UnsupportedVersion(version.version)
 
     with util.LockDirectory(".scripts-migrate-lock"):
         try:
@@ -160,3 +168,13 @@ with --force, but this will blow away the existing .git and
 .scripts directories (i.e. your history and Wizard configuration).)
 """
 
+class UnsupportedVersion(Error):
+    def __init__(self, version):
+        self.version = version
+    def __str__(self):
+        return """
+
+ERROR: This autoinstall is presently on %s, which is unsupported by
+Wizard.  Please manually upgrade it to one that is supported,
+and then retry the migration; usually the latest version is supported.
+""" % self.version