Commit f737febb authored by Michael Achenbach's avatar Michael Achenbach Committed by Commit Bot

[release] Make auto-push script recover after failed branch attempt

NOTRY=true

Bug: chromium:1018099
Change-Id: I14de41aac11220fedb58cda9bf5ce66424ff381c
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1879932Reviewed-by: 's avatarTamer Tas <tmrts@chromium.org>
Commit-Queue: Michael Achenbach <machenbach@chromium.org>
Cr-Commit-Position: refs/heads/master@{#64557}
parent 9cb82371
......@@ -135,6 +135,21 @@ class EditChangeLog(Step):
TextToFile(changelog_entry, self.Config("CHANGELOG_ENTRY_FILE"))
class DeleteBranchRef(Step):
MESSAGE = "Delete branch ref."
def RunStep(self):
cmd = "push origin :refs/heads/%s" % self["version"]
if self._options.dry_run:
print("Dry run. Command:\ngit %s" % cmd)
else:
try:
self.Git(cmd)
except Exception:
# Be forgiving if branch ref does not exist.
pass
class PushBranchRef(Step):
MESSAGE = "Create branch ref."
......@@ -293,6 +308,7 @@ class CreateRelease(ScriptsBase):
DetectLastRelease,
PrepareChangeLog,
EditChangeLog,
DeleteBranchRef,
PushBranchRef,
MakeBranch,
AddChangeLog,
......
......@@ -926,6 +926,7 @@ TBR=reviewer@chromium.org"""
Cmd("git log -1 --format=%s rev1", "Log text 1.\n"),
Cmd("git log -1 --format=%B rev1", "Text\nLOG=YES\nBUG=v8:321\nText\n"),
Cmd("git log -1 --format=%an rev1", "author1@chromium.org\n"),
Cmd("git push origin :refs/heads/3.22.5", ""),
Cmd("git push origin push_hash:refs/heads/3.22.5", ""),
Cmd("git reset --hard origin/master", ""),
Cmd("git new-branch work-branch --upstream origin/3.22.5", ""),
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment