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")
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()
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:
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,
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)
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):