Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright 2013 the V8 project authors. All rights reserved. | 2 # Copyright 2013 the V8 project authors. All rights reserved. |
| 3 # Redistribution and use in source and binary forms, with or without | 3 # Redistribution and use in source and binary forms, with or without |
| 4 # modification, are permitted provided that the following conditions are | 4 # modification, are permitted provided that the following conditions are |
| 5 # met: | 5 # met: |
| 6 # | 6 # |
| 7 # * Redistributions of source code must retain the above copyright | 7 # * Redistributions of source code must retain the above copyright |
| 8 # notice, this list of conditions and the following disclaimer. | 8 # notice, this list of conditions and the following disclaimer. |
| 9 # * Redistributions in binary form must reproduce the above | 9 # * Redistributions in binary form must reproduce the above |
| 10 # copyright notice, this list of conditions and the following | 10 # copyright notice, this list of conditions and the following |
| (...skipping 16 matching lines...) Expand all Loading... | |
| 27 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 27 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 28 | 28 |
| 29 import argparse | 29 import argparse |
| 30 import os | 30 import os |
| 31 import sys | 31 import sys |
| 32 import tempfile | 32 import tempfile |
| 33 import urllib2 | 33 import urllib2 |
| 34 | 34 |
| 35 from common_includes import * | 35 from common_includes import * |
| 36 | 36 |
| 37 PUSH_MSG_SVN_RE = re.compile(r".* \(based on bleeding_edge revision r(\d+)\)$") | |
| 38 PUSH_MSG_GIT_SUFFIX = " (based on %s)" | 37 PUSH_MSG_GIT_SUFFIX = " (based on %s)" |
| 39 PUSH_MSG_GIT_RE = re.compile(r".* \(based on (?P<git_rev>[a-fA-F0-9]+)\)$") | 38 PUSH_MSG_GIT_RE = re.compile(r".* \(based on (?P<git_rev>[a-fA-F0-9]+)\)$") |
| 40 | 39 |
| 41 class Preparation(Step): | 40 class Preparation(Step): |
| 42 MESSAGE = "Preparation." | 41 MESSAGE = "Preparation." |
| 43 | 42 |
| 44 def RunStep(self): | 43 def RunStep(self): |
| 45 self.InitialEnvironmentChecks(self.default_cwd) | 44 self.InitialEnvironmentChecks(self.default_cwd) |
| 46 self.CommonPrepare() | 45 self.CommonPrepare() |
| 47 | 46 |
| 48 if(self["current_branch"] == self.Config("TRUNKBRANCH") | 47 if(self["current_branch"] == self.Config("TRUNKBRANCH") |
| 49 or self["current_branch"] == self.Config("BRANCHNAME")): | 48 or self["current_branch"] == self.Config("BRANCHNAME")): |
| 50 print "Warning: Script started on branch %s" % self["current_branch"] | 49 print "Warning: Script started on branch %s" % self["current_branch"] |
| 51 | 50 |
| 52 self.PrepareBranch() | 51 self.PrepareBranch() |
| 53 self.DeleteBranch(self.Config("TRUNKBRANCH")) | 52 self.DeleteBranch(self.Config("TRUNKBRANCH")) |
| 54 | 53 |
| 54 # Allow directly pushing to candidates. | |
| 55 if not self.Git("config --get remote.origin.push").strip(): | |
| 56 self.Git("config --add remote.origin.push " | |
| 57 "refs/remotes/origin/candidates:refs/pending/heads/candidates") | |
| 58 | |
|
tandrii(chromium)
2014/11/12 13:52:31
lgtm
| |
| 55 | 59 |
| 56 class FreshBranch(Step): | 60 class FreshBranch(Step): |
| 57 MESSAGE = "Create a fresh branch." | 61 MESSAGE = "Create a fresh branch." |
| 58 | 62 |
| 59 def RunStep(self): | 63 def RunStep(self): |
| 60 self.GitCreateBranch(self.Config("BRANCHNAME"), | 64 self.GitCreateBranch(self.Config("BRANCHNAME"), |
| 61 self.vc.RemoteMasterBranch()) | 65 self.vc.RemoteMasterBranch()) |
| 62 | 66 |
| 63 | 67 |
| 64 class PreparePushRevision(Step): | 68 class PreparePushRevision(Step): |
| (...skipping 21 matching lines...) Expand all Loading... | |
| 86 last_push = self.FindLastTrunkPush(parent_hash=last_push) | 90 last_push = self.FindLastTrunkPush(parent_hash=last_push) |
| 87 | 91 |
| 88 if self._options.last_bleeding_edge: | 92 if self._options.last_bleeding_edge: |
| 89 # Read the bleeding edge revision of the last push from a command-line | 93 # Read the bleeding edge revision of the last push from a command-line |
| 90 # option. | 94 # option. |
| 91 last_push_bleeding_edge = self._options.last_bleeding_edge | 95 last_push_bleeding_edge = self._options.last_bleeding_edge |
| 92 else: | 96 else: |
| 93 # Retrieve the bleeding edge revision of the last push from the text in | 97 # Retrieve the bleeding edge revision of the last push from the text in |
| 94 # the push commit message. | 98 # the push commit message. |
| 95 last_push_title = self.GitLog(n=1, format="%s", git_hash=last_push) | 99 last_push_title = self.GitLog(n=1, format="%s", git_hash=last_push) |
| 96 # TODO(machenbach): This is only needed for the git transition. Can be | 100 last_push_bleeding_edge = PUSH_MSG_GIT_RE.match( |
| 97 # removed after one successful trunk push. | 101 last_push_title).group("git_rev") |
| 98 match = PUSH_MSG_SVN_RE.match(last_push_title) | |
| 99 if match: | |
| 100 last_push_be_svn = match.group(1) | |
| 101 if not last_push_be_svn: # pragma: no cover | |
| 102 self.Die("Could not retrieve bleeding edge rev for trunk push %s" | |
| 103 % last_push) | |
| 104 last_push_bleeding_edge = self.vc.SvnGit(last_push_be_svn) | |
| 105 else: | |
| 106 last_push_bleeding_edge = PUSH_MSG_GIT_RE.match( | |
| 107 last_push_title).group("git_rev") | |
| 108 | 102 |
| 109 if not last_push_bleeding_edge: # pragma: no cover | 103 if not last_push_bleeding_edge: # pragma: no cover |
| 110 self.Die("Could not retrieve bleeding edge git hash for trunk push %s" | 104 self.Die("Could not retrieve bleeding edge git hash for trunk push %s" |
| 111 % last_push) | 105 % last_push) |
| 112 | 106 |
| 113 # This points to the git hash of the last push on trunk. | 107 # This points to the git hash of the last push on trunk. |
| 114 self["last_push_trunk"] = last_push | 108 self["last_push_trunk"] = last_push |
| 115 # This points to the last bleeding_edge revision that went into the last | 109 # This points to the last bleeding_edge revision that went into the last |
| 116 # push. | 110 # push. |
| 117 # TODO(machenbach): Do we need a check to make sure we're not pushing a | 111 # TODO(machenbach): Do we need a check to make sure we're not pushing a |
| (...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 350 | 344 |
| 351 def RunStep(self): | 345 def RunStep(self): |
| 352 # TODO(machenbach): Run presubmit script here as it is now missing in the | 346 # TODO(machenbach): Run presubmit script here as it is now missing in the |
| 353 # prepare push process. | 347 # prepare push process. |
| 354 if not self.Confirm("Please check if your local checkout is sane: Inspect " | 348 if not self.Confirm("Please check if your local checkout is sane: Inspect " |
| 355 "%s, compile, run tests. Do you want to commit this new trunk " | 349 "%s, compile, run tests. Do you want to commit this new trunk " |
| 356 "revision to the repository?" % VERSION_FILE): | 350 "revision to the repository?" % VERSION_FILE): |
| 357 self.Die("Execution canceled.") # pragma: no cover | 351 self.Die("Execution canceled.") # pragma: no cover |
| 358 | 352 |
| 359 | 353 |
| 360 class CommitSVN(Step): | 354 class Land(Step): |
| 361 MESSAGE = "Commit to SVN." | 355 MESSAGE = "Land the patch." |
| 362 | 356 |
| 363 def RunStep(self): | 357 def RunStep(self): |
| 364 if self._options.svn: | 358 self.vc.Land() |
| 365 self.SVNCommit("trunk", self["commit_title"]) | |
| 366 else: | |
| 367 self.vc.Land() | |
| 368 | 359 |
| 369 | 360 |
| 370 class TagRevision(Step): | 361 class TagRevision(Step): |
| 371 MESSAGE = "Tag the new revision." | 362 MESSAGE = "Tag the new revision." |
| 372 | 363 |
| 373 def RunStep(self): | 364 def RunStep(self): |
| 374 self.vc.Tag( | 365 self.vc.Tag( |
| 375 self["version"], self.vc.RemoteCandidateBranch(), self["commit_title"]) | 366 self["version"], self.vc.RemoteCandidateBranch(), self["commit_title"]) |
| 376 | 367 |
| 377 | 368 |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 438 PrepareChangeLog, | 429 PrepareChangeLog, |
| 439 EditChangeLog, | 430 EditChangeLog, |
| 440 StragglerCommits, | 431 StragglerCommits, |
| 441 SquashCommits, | 432 SquashCommits, |
| 442 NewBranch, | 433 NewBranch, |
| 443 ApplyChanges, | 434 ApplyChanges, |
| 444 AddChangeLog, | 435 AddChangeLog, |
| 445 SetVersion, | 436 SetVersion, |
| 446 CommitTrunk, | 437 CommitTrunk, |
| 447 SanityCheck, | 438 SanityCheck, |
| 448 CommitSVN, | 439 Land, |
| 449 TagRevision, | 440 TagRevision, |
| 450 CleanUp, | 441 CleanUp, |
| 451 ] | 442 ] |
| 452 | 443 |
| 453 | 444 |
| 454 if __name__ == "__main__": # pragma: no cover | 445 if __name__ == "__main__": # pragma: no cover |
| 455 sys.exit(PushToTrunk().Run()) | 446 sys.exit(PushToTrunk().Run()) |
| OLD | NEW |