| 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 |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 last_push = self.FindLastTrunkPush(parent_hash=last_push) | 85 last_push = self.FindLastTrunkPush(parent_hash=last_push) |
| 87 | 86 |
| 88 if self._options.last_bleeding_edge: | 87 if self._options.last_bleeding_edge: |
| 89 # Read the bleeding edge revision of the last push from a command-line | 88 # Read the bleeding edge revision of the last push from a command-line |
| 90 # option. | 89 # option. |
| 91 last_push_bleeding_edge = self._options.last_bleeding_edge | 90 last_push_bleeding_edge = self._options.last_bleeding_edge |
| 92 else: | 91 else: |
| 93 # Retrieve the bleeding edge revision of the last push from the text in | 92 # Retrieve the bleeding edge revision of the last push from the text in |
| 94 # the push commit message. | 93 # the push commit message. |
| 95 last_push_title = self.GitLog(n=1, format="%s", git_hash=last_push) | 94 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 | 95 last_push_bleeding_edge = PUSH_MSG_GIT_RE.match( |
| 97 # removed after one successful trunk push. | 96 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 | 97 |
| 109 if not last_push_bleeding_edge: # pragma: no cover | 98 if not last_push_bleeding_edge: # pragma: no cover |
| 110 self.Die("Could not retrieve bleeding edge git hash for trunk push %s" | 99 self.Die("Could not retrieve bleeding edge git hash for trunk push %s" |
| 111 % last_push) | 100 % last_push) |
| 112 | 101 |
| 113 # This points to the git hash of the last push on trunk. | 102 # This points to the git hash of the last push on trunk. |
| 114 self["last_push_trunk"] = last_push | 103 self["last_push_trunk"] = last_push |
| 115 # This points to the last bleeding_edge revision that went into the last | 104 # This points to the last bleeding_edge revision that went into the last |
| 116 # push. | 105 # push. |
| 117 # TODO(machenbach): Do we need a check to make sure we're not pushing a | 106 # 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 | 339 |
| 351 def RunStep(self): | 340 def RunStep(self): |
| 352 # TODO(machenbach): Run presubmit script here as it is now missing in the | 341 # TODO(machenbach): Run presubmit script here as it is now missing in the |
| 353 # prepare push process. | 342 # prepare push process. |
| 354 if not self.Confirm("Please check if your local checkout is sane: Inspect " | 343 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 " | 344 "%s, compile, run tests. Do you want to commit this new trunk " |
| 356 "revision to the repository?" % VERSION_FILE): | 345 "revision to the repository?" % VERSION_FILE): |
| 357 self.Die("Execution canceled.") # pragma: no cover | 346 self.Die("Execution canceled.") # pragma: no cover |
| 358 | 347 |
| 359 | 348 |
| 360 class CommitSVN(Step): | 349 class Land(Step): |
| 361 MESSAGE = "Commit to SVN." | 350 MESSAGE = "Land the patch." |
| 362 | 351 |
| 363 def RunStep(self): | 352 def RunStep(self): |
| 364 if self._options.svn: | 353 self.vc.Land() |
| 365 self.SVNCommit("trunk", self["commit_title"]) | |
| 366 else: | |
| 367 self.vc.Land() | |
| 368 | 354 |
| 369 | 355 |
| 370 class TagRevision(Step): | 356 class TagRevision(Step): |
| 371 MESSAGE = "Tag the new revision." | 357 MESSAGE = "Tag the new revision." |
| 372 | 358 |
| 373 def RunStep(self): | 359 def RunStep(self): |
| 374 self.vc.Tag( | 360 self.vc.Tag( |
| 375 self["version"], self.vc.RemoteCandidateBranch(), self["commit_title"]) | 361 self["version"], self.vc.RemoteCandidateBranch(), self["commit_title"]) |
| 376 | 362 |
| 377 | 363 |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 438 PrepareChangeLog, | 424 PrepareChangeLog, |
| 439 EditChangeLog, | 425 EditChangeLog, |
| 440 StragglerCommits, | 426 StragglerCommits, |
| 441 SquashCommits, | 427 SquashCommits, |
| 442 NewBranch, | 428 NewBranch, |
| 443 ApplyChanges, | 429 ApplyChanges, |
| 444 AddChangeLog, | 430 AddChangeLog, |
| 445 SetVersion, | 431 SetVersion, |
| 446 CommitTrunk, | 432 CommitTrunk, |
| 447 SanityCheck, | 433 SanityCheck, |
| 448 CommitSVN, | 434 Land, |
| 449 TagRevision, | 435 TagRevision, |
| 450 CleanUp, | 436 CleanUp, |
| 451 ] | 437 ] |
| 452 | 438 |
| 453 | 439 |
| 454 if __name__ == "__main__": # pragma: no cover | 440 if __name__ == "__main__": # pragma: no cover |
| 455 sys.exit(PushToTrunk().Run()) | 441 sys.exit(PushToTrunk().Run()) |
| OLD | NEW |