Skip to content

Commit bff2ad9

Browse files
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= [email protected] Review URL: https://codereview.chromium.org/266083003 git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@21147 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
1 parent d1c0c95 commit bff2ad9

File tree

5 files changed

+14
-28
lines changed

5 files changed

+14
-28
lines changed

tools/push-to-trunk/common_includes.py

+4-8
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@
4242
from git_recipes import GitFailedException
4343

4444
PERSISTFILE_BASENAME = "PERSISTFILE_BASENAME"
45-
TEMP_BRANCH = "TEMP_BRANCH"
4645
BRANCHNAME = "BRANCHNAME"
4746
DOT_GIT_LOCATION = "DOT_GIT_LOCATION"
4847
VERSION_FILE = "VERSION_FILE"
@@ -176,13 +175,17 @@ def Command(cmd, args="", prefix="", pipe=True):
176175
# TODO(machenbach): Use timeout.
177176
cmd_line = "%s %s %s" % (prefix, cmd, args)
178177
print "Command: %s" % cmd_line
178+
sys.stdout.flush()
179179
try:
180180
if pipe:
181181
return subprocess.check_output(cmd_line, shell=True)
182182
else:
183183
return subprocess.check_call(cmd_line, shell=True)
184184
except subprocess.CalledProcessError:
185185
return None
186+
finally:
187+
sys.stdout.flush()
188+
sys.stderr.flush()
186189

187190

188191
# Wrapper for side effects.
@@ -376,18 +379,11 @@ def CommonPrepare(self):
376379
self.GitSVNFetch()
377380

378381
def PrepareBranch(self):
379-
# Get ahold of a safe temporary branch and check it out.
380-
if self["current_branch"] != self._config[TEMP_BRANCH]:
381-
self.DeleteBranch(self._config[TEMP_BRANCH])
382-
self.GitCreateBranch(self._config[TEMP_BRANCH])
383-
384382
# Delete the branch that will be created later if it exists already.
385383
self.DeleteBranch(self._config[BRANCHNAME])
386384

387385
def CommonCleanup(self):
388386
self.GitCheckout(self["current_branch"])
389-
if self._config[TEMP_BRANCH] != self["current_branch"]:
390-
self.GitDeleteBranch(self._config[TEMP_BRANCH])
391387
if self._config[BRANCHNAME] != self["current_branch"]:
392388
self.GitDeleteBranch(self._config[BRANCHNAME])
393389

tools/push-to-trunk/merge_to_branch.py

-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@
4141
PERSISTFILE_BASENAME: "/tmp/v8-merge-to-branch-tempfile",
4242
ALREADY_MERGING_SENTINEL_FILE:
4343
"/tmp/v8-merge-to-branch-tempfile-already-merging",
44-
TEMP_BRANCH: "prepare-merge-temporary-branch-created-by-script",
4544
DOT_GIT_LOCATION: ".git",
4645
VERSION_FILE: "src/version.cc",
4746
TEMPORARY_PATCH_FILE: "/tmp/v8-prepare-merge-tempfile-temporary-patch",

tools/push-to-trunk/push_to_trunk.py

+5-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@
3939
BRANCHNAME: "prepare-push",
4040
TRUNKBRANCH: "trunk-push",
4141
PERSISTFILE_BASENAME: "/tmp/v8-push-to-trunk-tempfile",
42-
TEMP_BRANCH: "prepare-push-temporary-branch-created-by-script",
4342
DOT_GIT_LOCATION: ".git",
4443
VERSION_FILE: "src/version.cc",
4544
CHANGELOG_FILE: "ChangeLog",
@@ -58,6 +57,11 @@ class Preparation(Step):
5857
def RunStep(self):
5958
self.InitialEnvironmentChecks()
6059
self.CommonPrepare()
60+
61+
if(self["current_branch"] == self.Config(TRUNKBRANCH)
62+
or self["current_branch"] == self.Config(BRANCHNAME)):
63+
print "Warning: Script started on branch %s" % self["current_branch"]
64+
6165
self.PrepareBranch()
6266
self.DeleteBranch(self.Config(TRUNKBRANCH))
6367

tools/push-to-trunk/releases.py

-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525

2626
CONFIG = {
2727
BRANCHNAME: "retrieve-v8-releases",
28-
TEMP_BRANCH: "unused-branch", # TODO(machenbach): Remove from infrastructure.
2928
PERSISTFILE_BASENAME: "/tmp/v8-releases-tempfile",
3029
DOT_GIT_LOCATION: ".git",
3130
VERSION_FILE: "src/version.cc",

tools/push-to-trunk/test_scripts.py

+5-17
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@
5353
BRANCHNAME: "test-prepare-push",
5454
TRUNKBRANCH: "test-trunk-push",
5555
PERSISTFILE_BASENAME: "/tmp/test-v8-push-to-trunk-tempfile",
56-
TEMP_BRANCH: "test-prepare-push-temporary-branch-created-by-script",
5756
DOT_GIT_LOCATION: None,
5857
VERSION_FILE: None,
5958
CHANGELOG_FILE: None,
@@ -435,10 +434,8 @@ def testCommonPrepareDefault(self):
435434
Git("status -s -uno", ""),
436435
Git("status -s -b -uno", "## some_branch"),
437436
Git("svn fetch", ""),
438-
Git("branch", " branch1\n* %s" % TEST_CONFIG[TEMP_BRANCH]),
439-
Git("branch -D %s" % TEST_CONFIG[TEMP_BRANCH], ""),
440-
Git("checkout -b %s" % TEST_CONFIG[TEMP_BRANCH], ""),
441-
Git("branch", ""),
437+
Git("branch", " branch1\n* %s" % TEST_CONFIG[BRANCHNAME]),
438+
Git("branch -D %s" % TEST_CONFIG[BRANCHNAME], ""),
442439
])
443440
self.ExpectReadline([RL("Y")])
444441
self.MakeStep().CommonPrepare()
@@ -450,7 +447,7 @@ def testCommonPrepareNoConfirm(self):
450447
Git("status -s -uno", ""),
451448
Git("status -s -b -uno", "## some_branch"),
452449
Git("svn fetch", ""),
453-
Git("branch", " branch1\n* %s" % TEST_CONFIG[TEMP_BRANCH]),
450+
Git("branch", " branch1\n* %s" % TEST_CONFIG[BRANCHNAME]),
454451
])
455452
self.ExpectReadline([RL("n")])
456453
self.MakeStep().CommonPrepare()
@@ -462,8 +459,8 @@ def testCommonPrepareDeleteBranchFailure(self):
462459
Git("status -s -uno", ""),
463460
Git("status -s -b -uno", "## some_branch"),
464461
Git("svn fetch", ""),
465-
Git("branch", " branch1\n* %s" % TEST_CONFIG[TEMP_BRANCH]),
466-
Git("branch -D %s" % TEST_CONFIG[TEMP_BRANCH], None),
462+
Git("branch", " branch1\n* %s" % TEST_CONFIG[BRANCHNAME]),
463+
Git("branch -D %s" % TEST_CONFIG[BRANCHNAME], None),
467464
])
468465
self.ExpectReadline([RL("Y")])
469466
self.MakeStep().CommonPrepare()
@@ -727,8 +724,6 @@ def CheckSVNCommit():
727724
Git("status -s -b -uno", "## some_branch\n"),
728725
Git("svn fetch", ""),
729726
Git("branch", " branch1\n* branch2\n"),
730-
Git("checkout -b %s" % TEST_CONFIG[TEMP_BRANCH], ""),
731-
Git("branch", " branch1\n* branch2\n"),
732727
Git("branch", " branch1\n* branch2\n"),
733728
Git("checkout -b %s svn/bleeding_edge" % TEST_CONFIG[BRANCHNAME], ""),
734729
Git("svn find-rev r123455", "push_hash\n"),
@@ -761,7 +756,6 @@ def CheckSVNCommit():
761756
Git("svn dcommit 2>&1", "Some output\nCommitted r123456\nSome output\n"),
762757
Git("svn tag 3.22.5 -m \"Tagging version 3.22.5\"", ""),
763758
Git("checkout -f some_branch", ""),
764-
Git("branch -D %s" % TEST_CONFIG[TEMP_BRANCH], ""),
765759
Git("branch -D %s" % TEST_CONFIG[BRANCHNAME], ""),
766760
Git("branch -D %s" % TEST_CONFIG[TRUNKBRANCH], ""),
767761
])
@@ -1063,8 +1057,6 @@ def VerifySVNCommit():
10631057
Git("status -s -b -uno", "## some_branch\n"),
10641058
Git("svn fetch", ""),
10651059
Git("branch", " branch1\n* branch2\n"),
1066-
Git("checkout -b %s" % TEST_CONFIG[TEMP_BRANCH], ""),
1067-
Git("branch", " branch1\n* branch2\n"),
10681060
Git("checkout -b %s svn/trunk" % TEST_CONFIG[BRANCHNAME], ""),
10691061
Git("log --format=%H --grep=\"Port r12345\" --reverse svn/bleeding_edge",
10701062
"hash1\nhash2"),
@@ -1126,7 +1118,6 @@ def VerifySVNCommit():
11261118
"https://v8.googlecode.com/svn/tags/3.22.5.1 -m "
11271119
"\"Tagging version 3.22.5.1\""), ""),
11281120
Git("checkout -f some_branch", ""),
1129-
Git("branch -D %s" % TEST_CONFIG[TEMP_BRANCH], ""),
11301121
Git("branch -D %s" % TEST_CONFIG[BRANCHNAME], ""),
11311122
])
11321123

@@ -1177,8 +1168,6 @@ def ResetDEPS(revision):
11771168
Git("status -s -b -uno", "## some_branch\n"),
11781169
Git("svn fetch", ""),
11791170
Git("branch", " branch1\n* branch2\n"),
1180-
Git("checkout -b %s" % TEST_CONFIG[TEMP_BRANCH], ""),
1181-
Git("branch", " branch1\n* branch2\n"),
11821171
Git("checkout -b %s" % TEST_CONFIG[BRANCHNAME], ""),
11831172
Git("branch -r", " svn/3.21\n svn/3.3\n"),
11841173
Git("reset --hard svn/3.3", ""),
@@ -1236,7 +1225,6 @@ def ResetDEPS(revision):
12361225
Git("checkout -f master", ""),
12371226
Git("branch -D %s" % TEST_CONFIG[BRANCHNAME], ""),
12381227
Git("checkout -f some_branch", ""),
1239-
Git("branch -D %s" % TEST_CONFIG[TEMP_BRANCH], ""),
12401228
Git("branch -D %s" % TEST_CONFIG[BRANCHNAME], ""),
12411229
])
12421230

0 commit comments

Comments
 (0)