]> scripts.mit.edu Git - wizard.git/blobdiff - lib/wizard/command/migrate.py
Modify migration script to specify --shared; saves time and space.
[wizard.git] / lib / wizard / command / migrate.py
index 9b5bcd54694dd8aeadfaabb49c9fcd3e61ce3a33..12f0da6016035f51fb2feafe546036c984234137 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):
@@ -146,6 +144,10 @@ what repository and tag to use."""
         # create repository
         sh.call("git", "--git-dir=.git", "init")
         did_git_init = True
+        # configure our alternates (to save space and make this quick)
+        alternates = open(".git/objects/info/alternates", "w")
+        alternates.write(os.path.join(repo, "objects"))
+        alternates.close()
         # configure our remote
         sh.call("git", "remote", "add", "origin", repo)
         # configure what would normally be set up on a 'git clone' for consistency
@@ -161,8 +163,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...")