Commit e48e4135 authored by machenbach's avatar machenbach Committed by Commit bot

Make release scripts even more robust.

Also clean up left alone release branch in the chromium
checkout of the v8rel script.

TBR=tandrii@chromium.org
NOTRY=true

Review URL: https://codereview.chromium.org/1003383003

Cr-Commit-Position: refs/heads/master@{#27197}
parent db7e074d
......@@ -511,12 +511,12 @@ class Step(GitRecipesMixin):
answer = self.ReadLine(default="Y")
return answer == "" or answer == "Y" or answer == "y"
def DeleteBranch(self, name):
for line in self.GitBranch().splitlines():
def DeleteBranch(self, name, cwd=None):
for line in self.GitBranch(cwd=cwd).splitlines():
if re.match(r"\*?\s*%s$" % re.escape(name), line):
msg = "Branch %s exists, do you want to delete it?" % name
if self.Confirm(msg):
self.GitDeleteBranch(name)
self.GitDeleteBranch(name, cwd=cwd)
print "Branch %s deleted." % name
else:
msg = "Can't continue. Please delete branch %s and try again." % name
......
......@@ -334,6 +334,7 @@ class UpdateChromiumCheckout(Step):
cwd = self._options.chromium
self.GitCheckout("master", cwd=cwd)
self.GitPull(cwd=cwd)
self.DeleteBranch(self.Config("BRANCHNAME"), cwd=cwd)
self.GitCreateBranch(self.Config("BRANCHNAME"), cwd=cwd)
......@@ -488,6 +489,7 @@ class Releases(ScriptsBase):
parser.add_argument("--json", help="Path to a JSON file for export.")
def _ProcessOptions(self, options): # pragma: no cover
options.force_readline_defaults = True
return True
def _Config(self):
......
......@@ -1406,6 +1406,10 @@ Cr-Commit-Position: refs/heads/4.2.71@{#1}
Cmd("git status -s -uno", "", cwd=chrome_dir),
Cmd("git checkout -f master", "", cwd=chrome_dir),
Cmd("git pull", "", cwd=chrome_dir),
Cmd("git branch", " branch1\n* %s" % TEST_CONFIG["BRANCHNAME"],
cwd=chrome_dir),
Cmd("git branch -D %s" % TEST_CONFIG["BRANCHNAME"], "",
cwd=chrome_dir),
Cmd("git new-branch %s" % TEST_CONFIG["BRANCHNAME"], "",
cwd=chrome_dir),
Cmd("git fetch origin", "", cwd=chrome_v8_dir),
......
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