attempting anything.
"""
options = self.options
- while True:
+ for i in range(0,2):
self.prod = deploy.ProductionCopy(".")
self.prod.verify()
self.repo = self.prod.application.repository(options.srv_path)
- util.assert_all_writable()
# XXX: put this in Application
self.version = shell.eval("git", "--git-dir="+self.repo, "describe", "--tags", "master")
self.preflightBlacklist()
+ self.prod.verify()
+ self.prod.verifyDatabase()
self.prod.verifyTag(options.srv_path)
self.prod.verifyGit(options.srv_path)
self.prod.verifyConfigured()
shell.call("git", "merge", "--strategy=ours", self.prod.application.makeVersion(str(e.real_version)).scripts_tag)
continue
break
+ else:
+ raise VersionRematchFailed
self.prod.verifyWeb()
self.preflightAlreadyUpgraded()
self.preflightQuota()
self.mergeSaveState()
self.mergePerform()
def mergePreCommit(self):
+ def get_file_set(rev):
+ return set(shell.eval("git", "ls-tree", "-r", "--name-only", rev).split("\n"))
+ # add all files that are unversioned but would be replaced by the pull,
+ # and generate a new commit
+ old_files = get_file_set("HEAD")
+ new_files = get_file_set(self.version)
+ added_files = new_files - old_files
+ for f in added_files:
+ if os.path.exists(f):
+ shell.call("git", "add", f)
message = "Pre-commit of %s locker before autoinstall upgrade.\n\n%s" % (util.get_dir_owner(), util.get_git_footer())
try:
message += "\nPre-commit-by: " + util.get_operator_git()
pass
try:
shell.call("git", "commit", "-a", "-m", message)
- except shell.CallError:
+ except shell.CallError as e:
+ if "Permission denied" in e.stderr:
+ raise util.PermissionsError
+ elif e.stderr:
+ raise
logging.info("No changes detected")
def mergeClone(self):
# If /dev/shm exists, it's a tmpfs and we can use it
copy is missing essential metadata, or you've attempt to continue
from a production copy that does not have any pending upgrades.
"""
+
+class VersionRematchFailed(Error):
+ def __str__(self):
+ return """
+
+ERROR: Your Git version information was not consistent with your
+files on the system, and we were unable to create a fake merge
+to make the two consistent. Please contact scripts@mit.edu.
+"""