]> scripts.mit.edu Git - wizard.git/commitdiff
Refinements from running in practice.
authorEdward Z. Yang <ezyang@mit.edu>
Sat, 3 Oct 2009 22:32:37 +0000 (18:32 -0400)
committerEdward Z. Yang <ezyang@mit.edu>
Sat, 3 Oct 2009 22:32:37 +0000 (18:32 -0400)
* Relax MediaWiki webCheck
* Add 'wizard restore top' support
* Fix bugs in 'wizard upgrade' if you didn't commit

Signed-off-by: Edward Z. Yang <ezyang@mit.edu>
wizard/app/mediawiki.py
wizard/command/restore.py
wizard/command/upgrade.py

index dab8ba4681f408b3ac18cf8d1bcf3c347d1fc97b..a1a1eec56908f32700aa3bee89c824b8ef9152d6 100644 (file)
@@ -55,8 +55,8 @@ class Application(deploy.Application):
         if not match: return None
         return distutils.version.LooseVersion(match.group(2)[1:-1])
     def checkWeb(self, d):
-        page = d.fetch("index.php?title=Special:Version")
-        return page.find("MediaWiki is free software") != -1
+        page = d.fetch("index.php")
+        return page.find("<!-- Served by") != -1
     def install(self, version, options):
         try:
             os.unlink("LocalSettings.php")
index cadc1f878aefb86b370054da0af396aaa71f8132..c5d73c98b2844ff33d72c55585849b54ab10e2dd 100644 (file)
@@ -26,10 +26,15 @@ def main(argv, baton):
             logging.warning("Pruned %d empty backups" % count)
         return
     backup = args[0]
+    if backup == "top":
+        try:
+            backup = sorted(os.listdir(backups))[-1]
+        except IndexError:
+            raise Exception("No restore points available")
     bits = backup.split('-')
     date = '-'.join(bits[-3:])
     version = '-'.join(bits[0:-3])
-    shell.drop_priviledges(dir, options.log_file)
+    shell.drop_priviledges(".", options.log_file)
     d = deploy.Deployment(".")
     d.verify()
     d.verifyConfigured()
@@ -47,7 +52,10 @@ def parse_args(argv, baton):
 
 Takes a backup from the backups/ directory and does
 a full restore back to it.  CURRENT DATA IS DESTROYED,
-so you may want to do a backup before you do a restore."""
+so you may want to do a backup before you do a restore.
+
+You can specify 'top' as the ID in order to restore from
+the latest backup."""
     parser = command.WizardOptionParser(usage)
     options, args = parser.parse_all(argv)
     if len(args) > 1:
index 051ee22efc62cc7e14586b71d8c4007840b1a164..969404379c57bd8a3e7d61e78507da170560a236 100644 (file)
@@ -60,6 +60,11 @@ def main(argv, baton):
             perform_merge(sh, repo, d, version)
     # variables: version, user_commit, next_commit, temp_wc_dir
     with util.ChangeDirectory(temp_wc_dir):
+        try:
+            sh.call("git", "status")
+            sh.call("git", "commit", "-m", "throw-away commit")
+        except shell.CallError:
+            pass
         message = make_commit_message(version)
         new_tree = sh.eval("git", "rev-parse", "HEAD^{tree}")
         final_commit = sh.eval("git", "commit-tree", new_tree,
@@ -71,6 +76,7 @@ def main(argv, baton):
         except shell.CallError:
             sh.call("git", "checkout", "master", "--")
         sh.call("git", "reset", "--hard", final_commit)
+        d.verifyVersion()
     # Till now, all of our operations were in a tmp sandbox.
     if options.dry_run:
         logging.info("Dry run, bailing.  See results at %s" % temp_wc_dir)
@@ -214,9 +220,8 @@ class MergeFailed(Error):
 
 ERROR: Merge failed.  Resolve the merge by cd'ing to the
 temporary directory, finding conflicted files with `git status`,
-resolving the files, adding them using `git add`, and then
-committing your changes with `git commit` (your log message
-will be ignored), and then running `wizard upgrade --continue`."""
+resolving the files, adding them using `git add` and then
+running `wizard upgrade --continue`."""
 
 class LocalChangesError(Error):
     def __str__(self):