- Remerges aren't reflected in the parent files, so `git diff` output is
spurious. Not sure how to fix this w/o tree hackery.
-- Missing ancestor means that certain files cannot be merged, for the curious files;
- this is indicated by 1,3 but missing 2. There might be some cleverness to be
- done here by finding a "fake" ancestor to use.
+- Sometimes users remove files. Well, if those files change, they automatically
+ get marked as conflicted. Maybe we should say for certain files "if they're
+ gone, they're gone forever"? What is the proper resolution?
- wizard install wordpress should ask for password. One problem with this is that
Wordpress will still send mail with the wrong username and password, so Wordpress
--- /dev/null
+#!/bin/bash -e
+cd `dirname $0`
+
+TESTNAME="mediawiki_alt_continue_upgrade"
+source ./setup
+
+source ./mediawiki-install
+
+# nuke the install
+FROB="RELEASE-NOTES"
+mv "$TESTDIR/$FROB" "$TESTDIR/$FROB.bak"
+echo "this is a bad file" > "$TESTDIR/$FROB"
+
+# attempt an upgrade, this will fail
+RESULT=`! wizard upgrade "$TESTDIR" --non-interactive`
+TMPTESTDIR=`echo "$RESULT" | awk '{print $2}'`
+
+# resolve the upgrade
+mv -f "$TESTDIR/$FROB.bak" "$TMPTESTDIR/$FROB"
+OLDDIR=`pwd`
+cd "$TMPTESTDIR"
+git add $FROB
+git commit -m "resolution commit"
+
+# perform continue from the wrong directory
+cd "$OLDDIR/$TESTDIR"
+wizard upgrade --continue
import tempfile
import itertools
import time
+import errno
from wizard import app, command, deploy, scripts, shell, util
In the event of a ``--continue`` flag, we have to restore state and
perform some sanity checks.
"""
+ self.resumeChdir()
self.resumeState()
self.resumeLogging()
util.chdir(shell.eval("git", "config", "remote.origin.url"))
self.resumeProd()
+ def resumeChdir(self):
+ """
+ If we called ``--continue`` inside a production copy, check if
+ :file:`.scripts/pending` exists and change to that directory if so.
+ """
+ if os.path.exists(".scripts/pending"):
+ newdir = open(".scripts/pending").read().strip()
+ logging.warning("Detected production copy; changing directory to %s", newdir)
+ os.chdir(newdir)
def resumeState(self):
self.temp_wc_dir = os.getcwd()
self.wc = deploy.WorkingCopy(".")
- self.user_commit, self.next_commit = open(".git/WIZARD_PARENTS", "r").read().split()
- self.version = open(".git/WIZARD_UPGRADE_VERSION", "r").read()
+ try:
+ self.user_commit, self.next_commit = open(".git/WIZARD_PARENTS", "r").read().split()
+ self.version = open(".git/WIZARD_UPGRADE_VERSION", "r").read()
+ except IOError as e:
+ if e.errno == errno.ENOENT:
+ raise CannotResumeError()
+ else:
+ raise
def resumeLogging(self):
options = self.options
if not options.log_file and os.path.exists(".git/WIZARD_LOG_FILE"):
print "Please resolve these conflicts (edit and then `git add`), and"
print "then type 'exit'. You will now be dropped into a shell whose working"
print "directory is %s" % self.temp_wc_dir
- shell.call(user_shell, "-i", interactive=True)
+ try:
+ shell.call(user_shell, "-i", interactive=True)
+ except shell.CallError as e:
+ logging.warning("Shell returned non-zero exit code %d" % e.code)
if shell.eval("git", "ls-files", "--unmerged").strip():
print
print "WARNING: There are still unmerged files."
mail.
The reason was: %s""" % self.reason
+
+class CannotResumeError(Error):
+ def __str__(self):
+ return """
+
+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.
+"""