]> scripts.mit.edu Git - wizard.git/commitdiff
More robust handling for symlinks and Git rematching.
authorEdward Z. Yang <ezyang@mit.edu>
Tue, 9 Mar 2010 02:45:23 +0000 (21:45 -0500)
committerEdward Z. Yang <ezyang@mit.edu>
Tue, 9 Mar 2010 02:45:23 +0000 (21:45 -0500)
Signed-off-by: Edward Z. Yang <ezyang@mit.edu>
wizard/command/mass_migrate.py
wizard/command/upgrade.py
wizard/scripts.py

index 98c05091ee62f51f9d447cad6d5ef2bfda0fdf0b..956399a009d034a86a16e4ef5ea505981be4738b 100644 (file)
@@ -37,7 +37,7 @@ def main(argv, baton):
             def on_success(stdout, stderr):
                 if stderr:
                     logging.warning("Warnings [%04d] %s:\n%s" % (i, d.location, stderr))
-                    runtime.write("warning", i, d.location)
+                    runtime.write("warnings", i, d.location)
                 runtime.write("success", i, d.location)
             def on_error(e):
                 if e.name == "wizard.command.migrate.AlreadyMigratedError" or \
index d6ea50b6ba29b4634d741a8286032dd26c83ca90..3f142517f11d069f1d125fef8356efe438c8c67c 100644 (file)
@@ -150,7 +150,7 @@ class Upgrade(object):
         attempting anything.
         """
         options = self.options
-        while True:
+        for i in range(0,2):
             self.prod = deploy.ProductionCopy(".")
             self.prod.verify()
             self.repo = self.prod.application.repository(options.srv_path)
@@ -176,6 +176,8 @@ class Upgrade(object):
                 shell.call("git", "merge", "--strategy=ours", self.prod.application.makeVersion(str(e.real_version)).scripts_tag)
                 continue
             break
+        else:
+            raise VersionRematchFailed
         self.prod.verifyWeb()
         self.preflightAlreadyUpgraded()
         self.preflightQuota()
@@ -515,3 +517,12 @@ ERROR: We cannot resume the upgrade process; either this working
 copy is missing essential metadata, or you've attempt to continue
 from a production copy that does not have any pending upgrades.
 """
+
+class VersionRematchFailed(Error):
+    def __str__(self):
+        return """
+
+ERROR: Your Git version information was not consistent with your
+files on the system, and we were unable to create a fake merge
+to make the two consistent.  Please contact scripts@mit.edu.
+"""
index 50af4afb3c95870b53c63d0fd677bfd80e4c052d..9092f268d0be2a96cbe33344fba7c701e8bde536 100644 (file)
@@ -124,6 +124,7 @@ def get_disk_usage(dir=None, excluded_dir=".git"):
             if not os.path.join(root, name).startswith(dir + excluded_dir):
                 file = os.path.join(root, name)
                 try:
+                    if os.path.islink(file): continue
                     sum_sizes += os.path.getsize(file)
                 except OSError as e:
                     if e.errno == errno.ENOENT: