Remove old branch logic from push scripts.

The old temporary branch is not needed anymore. All scripts create a different branch after creating the temporary branch.

This also fixes logging subprocesses and logs a warning to track down script failures due to wrong branches.

BUG=
R=jarin@chromium.org

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@21147 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 98cd2833
...@@ -42,7 +42,6 @@ from git_recipes import GitRecipesMixin ...@@ -42,7 +42,6 @@ from git_recipes import GitRecipesMixin
from git_recipes import GitFailedException from git_recipes import GitFailedException
PERSISTFILE_BASENAME = "PERSISTFILE_BASENAME" PERSISTFILE_BASENAME = "PERSISTFILE_BASENAME"
TEMP_BRANCH = "TEMP_BRANCH"
BRANCHNAME = "BRANCHNAME" BRANCHNAME = "BRANCHNAME"
DOT_GIT_LOCATION = "DOT_GIT_LOCATION" DOT_GIT_LOCATION = "DOT_GIT_LOCATION"
VERSION_FILE = "VERSION_FILE" VERSION_FILE = "VERSION_FILE"
...@@ -176,6 +175,7 @@ def Command(cmd, args="", prefix="", pipe=True): ...@@ -176,6 +175,7 @@ def Command(cmd, args="", prefix="", pipe=True):
# TODO(machenbach): Use timeout. # TODO(machenbach): Use timeout.
cmd_line = "%s %s %s" % (prefix, cmd, args) cmd_line = "%s %s %s" % (prefix, cmd, args)
print "Command: %s" % cmd_line print "Command: %s" % cmd_line
sys.stdout.flush()
try: try:
if pipe: if pipe:
return subprocess.check_output(cmd_line, shell=True) return subprocess.check_output(cmd_line, shell=True)
...@@ -183,6 +183,9 @@ def Command(cmd, args="", prefix="", pipe=True): ...@@ -183,6 +183,9 @@ def Command(cmd, args="", prefix="", pipe=True):
return subprocess.check_call(cmd_line, shell=True) return subprocess.check_call(cmd_line, shell=True)
except subprocess.CalledProcessError: except subprocess.CalledProcessError:
return None return None
finally:
sys.stdout.flush()
sys.stderr.flush()
# Wrapper for side effects. # Wrapper for side effects.
...@@ -376,18 +379,11 @@ class Step(GitRecipesMixin): ...@@ -376,18 +379,11 @@ class Step(GitRecipesMixin):
self.GitSVNFetch() self.GitSVNFetch()
def PrepareBranch(self): def PrepareBranch(self):
# Get ahold of a safe temporary branch and check it out.
if self["current_branch"] != self._config[TEMP_BRANCH]:
self.DeleteBranch(self._config[TEMP_BRANCH])
self.GitCreateBranch(self._config[TEMP_BRANCH])
# Delete the branch that will be created later if it exists already. # Delete the branch that will be created later if it exists already.
self.DeleteBranch(self._config[BRANCHNAME]) self.DeleteBranch(self._config[BRANCHNAME])
def CommonCleanup(self): def CommonCleanup(self):
self.GitCheckout(self["current_branch"]) self.GitCheckout(self["current_branch"])
if self._config[TEMP_BRANCH] != self["current_branch"]:
self.GitDeleteBranch(self._config[TEMP_BRANCH])
if self._config[BRANCHNAME] != self["current_branch"]: if self._config[BRANCHNAME] != self["current_branch"]:
self.GitDeleteBranch(self._config[BRANCHNAME]) self.GitDeleteBranch(self._config[BRANCHNAME])
......
...@@ -41,7 +41,6 @@ CONFIG = { ...@@ -41,7 +41,6 @@ CONFIG = {
PERSISTFILE_BASENAME: "/tmp/v8-merge-to-branch-tempfile", PERSISTFILE_BASENAME: "/tmp/v8-merge-to-branch-tempfile",
ALREADY_MERGING_SENTINEL_FILE: ALREADY_MERGING_SENTINEL_FILE:
"/tmp/v8-merge-to-branch-tempfile-already-merging", "/tmp/v8-merge-to-branch-tempfile-already-merging",
TEMP_BRANCH: "prepare-merge-temporary-branch-created-by-script",
DOT_GIT_LOCATION: ".git", DOT_GIT_LOCATION: ".git",
VERSION_FILE: "src/version.cc", VERSION_FILE: "src/version.cc",
TEMPORARY_PATCH_FILE: "/tmp/v8-prepare-merge-tempfile-temporary-patch", TEMPORARY_PATCH_FILE: "/tmp/v8-prepare-merge-tempfile-temporary-patch",
......
...@@ -39,7 +39,6 @@ CONFIG = { ...@@ -39,7 +39,6 @@ CONFIG = {
BRANCHNAME: "prepare-push", BRANCHNAME: "prepare-push",
TRUNKBRANCH: "trunk-push", TRUNKBRANCH: "trunk-push",
PERSISTFILE_BASENAME: "/tmp/v8-push-to-trunk-tempfile", PERSISTFILE_BASENAME: "/tmp/v8-push-to-trunk-tempfile",
TEMP_BRANCH: "prepare-push-temporary-branch-created-by-script",
DOT_GIT_LOCATION: ".git", DOT_GIT_LOCATION: ".git",
VERSION_FILE: "src/version.cc", VERSION_FILE: "src/version.cc",
CHANGELOG_FILE: "ChangeLog", CHANGELOG_FILE: "ChangeLog",
...@@ -58,6 +57,11 @@ class Preparation(Step): ...@@ -58,6 +57,11 @@ class Preparation(Step):
def RunStep(self): def RunStep(self):
self.InitialEnvironmentChecks() self.InitialEnvironmentChecks()
self.CommonPrepare() self.CommonPrepare()
if(self["current_branch"] == self.Config(TRUNKBRANCH)
or self["current_branch"] == self.Config(BRANCHNAME)):
print "Warning: Script started on branch %s" % self["current_branch"]
self.PrepareBranch() self.PrepareBranch()
self.DeleteBranch(self.Config(TRUNKBRANCH)) self.DeleteBranch(self.Config(TRUNKBRANCH))
......
...@@ -25,7 +25,6 @@ CHROMIUM = "CHROMIUM" ...@@ -25,7 +25,6 @@ CHROMIUM = "CHROMIUM"
CONFIG = { CONFIG = {
BRANCHNAME: "retrieve-v8-releases", BRANCHNAME: "retrieve-v8-releases",
TEMP_BRANCH: "unused-branch", # TODO(machenbach): Remove from infrastructure.
PERSISTFILE_BASENAME: "/tmp/v8-releases-tempfile", PERSISTFILE_BASENAME: "/tmp/v8-releases-tempfile",
DOT_GIT_LOCATION: ".git", DOT_GIT_LOCATION: ".git",
VERSION_FILE: "src/version.cc", VERSION_FILE: "src/version.cc",
......
...@@ -53,7 +53,6 @@ TEST_CONFIG = { ...@@ -53,7 +53,6 @@ TEST_CONFIG = {
BRANCHNAME: "test-prepare-push", BRANCHNAME: "test-prepare-push",
TRUNKBRANCH: "test-trunk-push", TRUNKBRANCH: "test-trunk-push",
PERSISTFILE_BASENAME: "/tmp/test-v8-push-to-trunk-tempfile", PERSISTFILE_BASENAME: "/tmp/test-v8-push-to-trunk-tempfile",
TEMP_BRANCH: "test-prepare-push-temporary-branch-created-by-script",
DOT_GIT_LOCATION: None, DOT_GIT_LOCATION: None,
VERSION_FILE: None, VERSION_FILE: None,
CHANGELOG_FILE: None, CHANGELOG_FILE: None,
...@@ -435,10 +434,8 @@ class ScriptTest(unittest.TestCase): ...@@ -435,10 +434,8 @@ class ScriptTest(unittest.TestCase):
Git("status -s -uno", ""), Git("status -s -uno", ""),
Git("status -s -b -uno", "## some_branch"), Git("status -s -b -uno", "## some_branch"),
Git("svn fetch", ""), Git("svn fetch", ""),
Git("branch", " branch1\n* %s" % TEST_CONFIG[TEMP_BRANCH]), Git("branch", " branch1\n* %s" % TEST_CONFIG[BRANCHNAME]),
Git("branch -D %s" % TEST_CONFIG[TEMP_BRANCH], ""), Git("branch -D %s" % TEST_CONFIG[BRANCHNAME], ""),
Git("checkout -b %s" % TEST_CONFIG[TEMP_BRANCH], ""),
Git("branch", ""),
]) ])
self.ExpectReadline([RL("Y")]) self.ExpectReadline([RL("Y")])
self.MakeStep().CommonPrepare() self.MakeStep().CommonPrepare()
...@@ -450,7 +447,7 @@ class ScriptTest(unittest.TestCase): ...@@ -450,7 +447,7 @@ class ScriptTest(unittest.TestCase):
Git("status -s -uno", ""), Git("status -s -uno", ""),
Git("status -s -b -uno", "## some_branch"), Git("status -s -b -uno", "## some_branch"),
Git("svn fetch", ""), Git("svn fetch", ""),
Git("branch", " branch1\n* %s" % TEST_CONFIG[TEMP_BRANCH]), Git("branch", " branch1\n* %s" % TEST_CONFIG[BRANCHNAME]),
]) ])
self.ExpectReadline([RL("n")]) self.ExpectReadline([RL("n")])
self.MakeStep().CommonPrepare() self.MakeStep().CommonPrepare()
...@@ -462,8 +459,8 @@ class ScriptTest(unittest.TestCase): ...@@ -462,8 +459,8 @@ class ScriptTest(unittest.TestCase):
Git("status -s -uno", ""), Git("status -s -uno", ""),
Git("status -s -b -uno", "## some_branch"), Git("status -s -b -uno", "## some_branch"),
Git("svn fetch", ""), Git("svn fetch", ""),
Git("branch", " branch1\n* %s" % TEST_CONFIG[TEMP_BRANCH]), Git("branch", " branch1\n* %s" % TEST_CONFIG[BRANCHNAME]),
Git("branch -D %s" % TEST_CONFIG[TEMP_BRANCH], None), Git("branch -D %s" % TEST_CONFIG[BRANCHNAME], None),
]) ])
self.ExpectReadline([RL("Y")]) self.ExpectReadline([RL("Y")])
self.MakeStep().CommonPrepare() self.MakeStep().CommonPrepare()
...@@ -727,8 +724,6 @@ Performance and stability improvements on all platforms.""", commit) ...@@ -727,8 +724,6 @@ Performance and stability improvements on all platforms.""", commit)
Git("status -s -b -uno", "## some_branch\n"), Git("status -s -b -uno", "## some_branch\n"),
Git("svn fetch", ""), Git("svn fetch", ""),
Git("branch", " branch1\n* branch2\n"), Git("branch", " branch1\n* branch2\n"),
Git("checkout -b %s" % TEST_CONFIG[TEMP_BRANCH], ""),
Git("branch", " branch1\n* branch2\n"),
Git("branch", " branch1\n* branch2\n"), Git("branch", " branch1\n* branch2\n"),
Git("checkout -b %s svn/bleeding_edge" % TEST_CONFIG[BRANCHNAME], ""), Git("checkout -b %s svn/bleeding_edge" % TEST_CONFIG[BRANCHNAME], ""),
Git("svn find-rev r123455", "push_hash\n"), Git("svn find-rev r123455", "push_hash\n"),
...@@ -761,7 +756,6 @@ Performance and stability improvements on all platforms.""", commit) ...@@ -761,7 +756,6 @@ Performance and stability improvements on all platforms.""", commit)
Git("svn dcommit 2>&1", "Some output\nCommitted r123456\nSome output\n"), Git("svn dcommit 2>&1", "Some output\nCommitted r123456\nSome output\n"),
Git("svn tag 3.22.5 -m \"Tagging version 3.22.5\"", ""), Git("svn tag 3.22.5 -m \"Tagging version 3.22.5\"", ""),
Git("checkout -f some_branch", ""), Git("checkout -f some_branch", ""),
Git("branch -D %s" % TEST_CONFIG[TEMP_BRANCH], ""),
Git("branch -D %s" % TEST_CONFIG[BRANCHNAME], ""), Git("branch -D %s" % TEST_CONFIG[BRANCHNAME], ""),
Git("branch -D %s" % TEST_CONFIG[TRUNKBRANCH], ""), Git("branch -D %s" % TEST_CONFIG[TRUNKBRANCH], ""),
]) ])
...@@ -1063,8 +1057,6 @@ LOG=N ...@@ -1063,8 +1057,6 @@ LOG=N
Git("status -s -b -uno", "## some_branch\n"), Git("status -s -b -uno", "## some_branch\n"),
Git("svn fetch", ""), Git("svn fetch", ""),
Git("branch", " branch1\n* branch2\n"), Git("branch", " branch1\n* branch2\n"),
Git("checkout -b %s" % TEST_CONFIG[TEMP_BRANCH], ""),
Git("branch", " branch1\n* branch2\n"),
Git("checkout -b %s svn/trunk" % TEST_CONFIG[BRANCHNAME], ""), Git("checkout -b %s svn/trunk" % TEST_CONFIG[BRANCHNAME], ""),
Git("log --format=%H --grep=\"Port r12345\" --reverse svn/bleeding_edge", Git("log --format=%H --grep=\"Port r12345\" --reverse svn/bleeding_edge",
"hash1\nhash2"), "hash1\nhash2"),
...@@ -1126,7 +1118,6 @@ LOG=N ...@@ -1126,7 +1118,6 @@ LOG=N
"https://v8.googlecode.com/svn/tags/3.22.5.1 -m " "https://v8.googlecode.com/svn/tags/3.22.5.1 -m "
"\"Tagging version 3.22.5.1\""), ""), "\"Tagging version 3.22.5.1\""), ""),
Git("checkout -f some_branch", ""), Git("checkout -f some_branch", ""),
Git("branch -D %s" % TEST_CONFIG[TEMP_BRANCH], ""),
Git("branch -D %s" % TEST_CONFIG[BRANCHNAME], ""), Git("branch -D %s" % TEST_CONFIG[BRANCHNAME], ""),
]) ])
...@@ -1177,8 +1168,6 @@ LOG=N ...@@ -1177,8 +1168,6 @@ LOG=N
Git("status -s -b -uno", "## some_branch\n"), Git("status -s -b -uno", "## some_branch\n"),
Git("svn fetch", ""), Git("svn fetch", ""),
Git("branch", " branch1\n* branch2\n"), Git("branch", " branch1\n* branch2\n"),
Git("checkout -b %s" % TEST_CONFIG[TEMP_BRANCH], ""),
Git("branch", " branch1\n* branch2\n"),
Git("checkout -b %s" % TEST_CONFIG[BRANCHNAME], ""), Git("checkout -b %s" % TEST_CONFIG[BRANCHNAME], ""),
Git("branch -r", " svn/3.21\n svn/3.3\n"), Git("branch -r", " svn/3.21\n svn/3.3\n"),
Git("reset --hard svn/3.3", ""), Git("reset --hard svn/3.3", ""),
...@@ -1236,7 +1225,6 @@ LOG=N ...@@ -1236,7 +1225,6 @@ LOG=N
Git("checkout -f master", ""), Git("checkout -f master", ""),
Git("branch -D %s" % TEST_CONFIG[BRANCHNAME], ""), Git("branch -D %s" % TEST_CONFIG[BRANCHNAME], ""),
Git("checkout -f some_branch", ""), Git("checkout -f some_branch", ""),
Git("branch -D %s" % TEST_CONFIG[TEMP_BRANCH], ""),
Git("branch -D %s" % TEST_CONFIG[BRANCHNAME], ""), Git("branch -D %s" % TEST_CONFIG[BRANCHNAME], ""),
]) ])
......
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