| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright 2015 the V8 project authors. All rights reserved. | 2 # Copyright 2015 the V8 project authors. All rights reserved. |
| 3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
| 4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
| 5 | 5 |
| 6 import argparse | 6 import argparse |
| 7 import os | 7 import os |
| 8 import sys | 8 import sys |
| 9 import tempfile | 9 import tempfile |
| 10 import urllib2 | 10 import urllib2 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 ] | 23 ] |
| 24 self.Git("fetch origin %s" % " ".join(fetchspecs)) | 24 self.Git("fetch origin %s" % " ".join(fetchspecs)) |
| 25 self.GitCheckout("origin/master") | 25 self.GitCheckout("origin/master") |
| 26 self.DeleteBranch("work-branch") | 26 self.DeleteBranch("work-branch") |
| 27 | 27 |
| 28 | 28 |
| 29 class PrepareBranchRevision(Step): | 29 class PrepareBranchRevision(Step): |
| 30 MESSAGE = "Check from which revision to branch off." | 30 MESSAGE = "Check from which revision to branch off." |
| 31 | 31 |
| 32 def RunStep(self): | 32 def RunStep(self): |
| 33 if self._options.revision: | 33 self["push_hash"] = (self._options.revision or |
| 34 self["push_hash"], tree_object = self.GitLog( | 34 self.GitLog(n=1, format="%H", branch="origin/master")) |
| 35 n=1, format="\"%H %T\"", git_hash=self._options.revision).split(" ") | 35 assert self["push_hash"] |
| 36 else: | |
| 37 self["push_hash"], tree_object = self.GitLog( | |
| 38 n=1, format="\"%H %T\"", branch="origin/master").split(" ") | |
| 39 print "Release revision %s" % self["push_hash"] | 36 print "Release revision %s" % self["push_hash"] |
| 40 assert self["push_hash"] | |
| 41 | |
| 42 pending_tuples = self.GitLog( | |
| 43 n=200, format="\"%H %T\"", branch="refs/pending/heads/master") | |
| 44 for hsh, tree in map(lambda s: s.split(" "), pending_tuples.splitlines()): | |
| 45 if tree == tree_object: | |
| 46 self["pending_hash"] = hsh | |
| 47 break | |
| 48 print "Pending release revision %s" % self["pending_hash"] | |
| 49 assert self["pending_hash"] | |
| 50 | 37 |
| 51 | 38 |
| 52 class IncrementVersion(Step): | 39 class IncrementVersion(Step): |
| 53 MESSAGE = "Increment version number." | 40 MESSAGE = "Increment version number." |
| 54 | 41 |
| 55 def RunStep(self): | 42 def RunStep(self): |
| 56 latest_version = self.GetLatestVersion() | 43 latest_version = self.GetLatestVersion() |
| 57 | 44 |
| 58 # The version file on master can be used to bump up major/minor at | 45 # The version file on master can be used to bump up major/minor at |
| 59 # branch time. | 46 # branch time. |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 167 | 154 |
| 168 # Safe new change log for adding it later to the candidates patch. | 155 # Safe new change log for adding it later to the candidates patch. |
| 169 TextToFile(changelog_entry, self.Config("CHANGELOG_ENTRY_FILE")) | 156 TextToFile(changelog_entry, self.Config("CHANGELOG_ENTRY_FILE")) |
| 170 | 157 |
| 171 | 158 |
| 172 class MakeBranch(Step): | 159 class MakeBranch(Step): |
| 173 MESSAGE = "Create the branch." | 160 MESSAGE = "Create the branch." |
| 174 | 161 |
| 175 def RunStep(self): | 162 def RunStep(self): |
| 176 self.Git("reset --hard origin/master") | 163 self.Git("reset --hard origin/master") |
| 177 self.Git("checkout -b work-branch %s" % self["pending_hash"]) | 164 self.Git("checkout -b work-branch %s" % self["push_hash"]) |
| 178 self.GitCheckoutFile(CHANGELOG_FILE, self["latest_version"]) | 165 self.GitCheckoutFile(CHANGELOG_FILE, self["latest_version"]) |
| 179 self.GitCheckoutFile(VERSION_FILE, self["latest_version"]) | 166 self.GitCheckoutFile(VERSION_FILE, self["latest_version"]) |
| 180 | 167 |
| 181 | 168 |
| 182 class AddChangeLog(Step): | 169 class AddChangeLog(Step): |
| 183 MESSAGE = "Add ChangeLog changes to release branch." | 170 MESSAGE = "Add ChangeLog changes to release branch." |
| 184 | 171 |
| 185 def RunStep(self): | 172 def RunStep(self): |
| 186 changelog_entry = FileToText(self.Config("CHANGELOG_ENTRY_FILE")) | 173 changelog_entry = FileToText(self.Config("CHANGELOG_ENTRY_FILE")) |
| 187 old_change_log = FileToText(os.path.join(self.default_cwd, CHANGELOG_FILE)) | 174 old_change_log = FileToText(os.path.join(self.default_cwd, CHANGELOG_FILE)) |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 222 os.remove(self.Config("COMMITMSG_FILE")) | 209 os.remove(self.Config("COMMITMSG_FILE")) |
| 223 os.remove(self.Config("CHANGELOG_ENTRY_FILE")) | 210 os.remove(self.Config("CHANGELOG_ENTRY_FILE")) |
| 224 | 211 |
| 225 | 212 |
| 226 class PushBranch(Step): | 213 class PushBranch(Step): |
| 227 MESSAGE = "Push changes." | 214 MESSAGE = "Push changes." |
| 228 | 215 |
| 229 def RunStep(self): | 216 def RunStep(self): |
| 230 pushspecs = [ | 217 pushspecs = [ |
| 231 "refs/heads/work-branch:refs/pending/heads/%s" % self["version"], | 218 "refs/heads/work-branch:refs/pending/heads/%s" % self["version"], |
| 232 "%s:refs/pending-tags/heads/%s" % | 219 "%s:refs/pending-tags/heads/%s" % (self["push_hash"], self["version"]), |
| 233 (self["pending_hash"], self["version"]), | |
| 234 "%s:refs/heads/%s" % (self["push_hash"], self["version"]), | 220 "%s:refs/heads/%s" % (self["push_hash"], self["version"]), |
| 235 ] | 221 ] |
| 236 cmd = "push origin %s" % " ".join(pushspecs) | 222 cmd = "push origin %s" % " ".join(pushspecs) |
| 237 if self._options.dry_run: | 223 if self._options.dry_run: |
| 238 print "Dry run. Command:\ngit %s" % cmd | 224 print "Dry run. Command:\ngit %s" % cmd |
| 239 else: | 225 else: |
| 240 self.Git(cmd) | 226 self.Git(cmd) |
| 241 | 227 |
| 242 | 228 |
| 243 class TagRevision(Step): | 229 class TagRevision(Step): |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 304 SetVersion, | 290 SetVersion, |
| 305 CommitBranch, | 291 CommitBranch, |
| 306 PushBranch, | 292 PushBranch, |
| 307 TagRevision, | 293 TagRevision, |
| 308 CleanUp, | 294 CleanUp, |
| 309 ] | 295 ] |
| 310 | 296 |
| 311 | 297 |
| 312 if __name__ == "__main__": # pragma: no cover | 298 if __name__ == "__main__": # pragma: no cover |
| 313 sys.exit(CreateRelease().Run()) | 299 sys.exit(CreateRelease().Run()) |
| OLD | NEW |