]> scripts.mit.edu Git - wizard.git/blobdiff - wizard/command/migrate.py
Refactoring.
[wizard.git] / wizard / command / migrate.py
index 0adfefde44da4af97790675de3984b7317e50d14..10de6d0841e130b67e79283cd5023489a2bee486 100644 (file)
@@ -20,6 +20,7 @@ def main(argv, baton):
 
     deployment = make_deployment() # uses chdir
 
+    # turn this into some kind of assert
     if not deployment.configured:
         raise NotConfiguredError(deployment.location)
 
@@ -32,6 +33,7 @@ def main(argv, baton):
 
     os.unsetenv("GIT_DIR") # prevent some perverse errors
 
+    # XXX: turn this into a context
     try:
         try:
             os.open(".scripts-migrate-lock", os.O_CREAT | os.O_EXCL)
@@ -40,6 +42,7 @@ def main(argv, baton):
                 raise DirectoryLockedError
             elif e.errno == errno.EACCES:
                 raise command.PermissionsError(dir)
+            raise
         make_repository(sh, options, repo, tag)
         check_variables(deployment, options)
     finally:
@@ -63,7 +66,8 @@ NOT run this command as root."""
     parser.add_option("--dry-run", dest="dry_run", action="store_true",
             default=False, help="Prints would would be run without changing anything")
     parser.add_option("--force", "-f", dest="force", action="store_true",
-            default=False, help="If .git or .scripts directory already exists, delete them and migrate")
+            default=False, help="If .git or .scripts directory already exists,"
+            "delete them and migrate")
     options, args = parser.parse_all(argv)
     if len(args) > 1:
         parser.error("too many arguments")
@@ -116,7 +120,7 @@ def make_deployment():
 
 def check_if_tag_exists(sh, repo, tag, version):
     # check if the version we're trying to convert exists. We assume
-    # a convention here, namely, v1.2.3-scripts is what we want. If
+    # a convention here, namely, app-1.2.3-scripts is what we want. If
     # you broke the convention... shame on you.
     try:
         sh.call("git", "--git-dir", repo, "rev-parse", tag)