app.restore_database(backup_dir, deployment)
def remove(self, deployment, options):
app.remove_database(deployment)
+
+Application.resolutions = {
+'wp-config.php': [
+ ("""
+<<<<<<<
+
+/** WordPress absolute path to the Wordpress directory. */
+|||||||
+/** WordPress absolute path to the Wordpress directory. */
+=======
+/** Absolute path to the WordPress directory. */
+>>>>>>>
+""", [0])
+],
+}
import logging.handlers
import tempfile
import itertools
+import time
from wizard import app, command, deploy, scripts, shell, util
sh.call("git", "config", "merge.conflictstyle", "diff3")
sh.call("git", "merge", next_virtual_commit)
except shell.CallError as e:
- conflicts = e.stdout.count("CONFLICT") # not perfect, if there is a file named CONFLICT
logging.info("Merge failed with these messages:\n\n" + e.stderr)
# Run the application's specific merge resolution algorithms
# and see if we can salvage it
logging.info("Resolved conflicts with application specific knowledge")
sh.call("git", "commit", "-a", "-m", "merge")
return os.getcwd()
- # XXX: Maybe should recalculate conflicts
logging.info("Conflict info:\n" + sh.eval("git", "diff"))
+ outlines = sh.eval("git", "ls-files", "--unmerged").splitlines()
+ files = set()
+ for line in outlines:
+ _, _, _, name = line.split(None, 3)
+ files.add(name)
+ conflicts = len(files)
curdir = mv_shm_to_tmp(curdir, use_shm)
os.chdir(curdir)
open(os.path.join(d.location, ".scripts/pending"), "w").write(curdir)
print
print "ERROR: The merge failed with %d conflicts in these files:" % conflicts
print
- outlines = sh.eval("git", "ls-files", "--unmerged").splitlines()
- files = set()
- for line in outlines:
- _, _, _, name = line.split(None, 3)
- files.add(name)
for file in sorted(files):
print " * %s" % file
print
import decorator
import datetime
import tempfile
+import time
+import traceback
+import shutil
import wizard
from wizard import app, git, old_log, scripts, shell, sql, util
shutil.rmtree(tmpdir)
raise
backup = None
- while 1:
- backup = str(self.version) + "-" + datetime.datetime.today().strftime("%Y-%m-%dT%H%M%S")
- outdir = os.path.join(backupdir, backup)
- if os.path.exists(outdir):
- logging.warning("Backup: A backup occurred in the last second. Trying again in a second...")
- time.sleep(1)
- continue
- try:
- os.rename(tmpdir, outdir)
- except OSError:
- logging.warning("Backup: We lost the race, trying again in a second...")
- time.sleep(1)
- continue
- break
+ with util.LockDirectory(os.path.join(backupdir, "lock")):
+ while 1:
+ backup = str(self.version) + "-" + datetime.datetime.today().strftime("%Y-%m-%dT%H%M%S")
+ outdir = os.path.join(backupdir, backup)
+ if os.path.exists(outdir):
+ logging.warning("Backup: A backup occurred in the last second. Trying again in a second...")
+ time.sleep(1)
+ continue
+ try:
+ shutil.move(tmpdir, outdir)
+ except:
+ # don't leave half-baked stuff lying around
+ try:
+ shutil.rmtree(outdir)
+ except OSError:
+ pass
+ raise
+ break
return backup
@chdir_to_location
def restore(self, backup, options):