]> scripts.mit.edu Git - wizard.git/commitdiff
Generate merge commits if versions mismatch prior to upgrade.
authorEdward Z. Yang <ezyang@mit.edu>
Sat, 6 Feb 2010 08:32:06 +0000 (03:32 -0500)
committerEdward Z. Yang <ezyang@mit.edu>
Sat, 6 Feb 2010 08:32:06 +0000 (03:32 -0500)
Signed-off-by: Edward Z. Yang <ezyang@mit.edu>
wizard/command/upgrade.py

index aae43eee3fc309ff8b1335a03b444e2d48941360..f0771776f8776d06ae61ad5c7110d6a0a6fee9fe 100644 (file)
@@ -150,17 +150,25 @@ class Upgrade(object):
         attempting anything.
         """
         options = self.options
-        self.prod = deploy.ProductionCopy(".")
-        self.repo = self.prod.application.repository(options.srv_path)
-        # XXX: put this in Application
-        self.version = shell.eval("git", "--git-dir="+self.repo, "describe", "--tags", "master")
-        self.preflightBlacklist()
-        self.prod.verify()
-        self.prod.verifyTag(options.srv_path)
-        self.prod.verifyGit(options.srv_path)
-        self.prod.verifyConfigured()
-        shell.call("git", "fetch", "--tags") # XXX: hack since some installs have stale tags
-        self.prod.verifyVersion()
+        while True:
+            self.prod = deploy.ProductionCopy(".")
+            self.repo = self.prod.application.repository(options.srv_path)
+            # XXX: put this in Application
+            self.version = shell.eval("git", "--git-dir="+self.repo, "describe", "--tags", "master")
+            self.preflightBlacklist()
+            self.prod.verify()
+            self.prod.verifyTag(options.srv_path)
+            self.prod.verifyGit(options.srv_path)
+            self.prod.verifyConfigured()
+            shell.call("git", "fetch", "--tags") # XXX: hack since some installs have stale tags
+            try:
+                self.prod.verifyVersion()
+            except deploy.VersionMismatchError as e:
+                # XXX: kind of hacky, mainly it does change the Git working copy
+                # state (although /very/ non-destructively)
+                shell.call("git", "merge", "--strategy=ours", self.prod.application.makeVersion(str(e.real_version)).scripts_tag)
+                continue
+            break
         self.prod.verifyWeb()
         self.preflightAlreadyUpgraded()
         self.preflightQuota()