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 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
278 self.GitCreateBranch(self.Config("TRUNKBRANCH"), | 278 self.GitCreateBranch(self.Config("TRUNKBRANCH"), |
279 self.vc.RemoteCandidateBranch()) | 279 self.vc.RemoteCandidateBranch()) |
280 | 280 |
281 | 281 |
282 class ApplyChanges(Step): | 282 class ApplyChanges(Step): |
283 MESSAGE = "Apply squashed changes." | 283 MESSAGE = "Apply squashed changes." |
284 | 284 |
285 def RunStep(self): | 285 def RunStep(self): |
286 self.ApplyPatch(self.Config("PATCH_FILE")) | 286 self.ApplyPatch(self.Config("PATCH_FILE")) |
287 os.remove(self.Config("PATCH_FILE")) | 287 os.remove(self.Config("PATCH_FILE")) |
| 288 # The change log has been modified by the patch. Reset it to the version |
| 289 # on trunk and apply the exact changes determined by this PrepareChangeLog |
| 290 # step above. |
| 291 self.GitCheckoutFile(CHANGELOG_FILE, self.vc.RemoteCandidateBranch()) |
| 292 # The version file has been modified by the patch. Reset it to the version |
| 293 # on trunk. |
| 294 self.GitCheckoutFile(VERSION_FILE, self.vc.RemoteCandidateBranch()) |
288 | 295 |
289 | 296 |
290 class CommitSquash(Step): | 297 class CommitSquash(Step): |
291 MESSAGE = "Commit to local candidates branch." | 298 MESSAGE = "Commit to local candidates branch." |
292 | 299 |
293 def RunStep(self): | 300 def RunStep(self): |
294 # Make a first commit with a slightly different title to not confuse | 301 # Make a first commit with a slightly different title to not confuse |
295 # the tagging. | 302 # the tagging. |
296 msg = FileToText(self.Config("COMMITMSG_FILE")).splitlines() | 303 msg = FileToText(self.Config("COMMITMSG_FILE")).splitlines() |
297 msg[0] = msg[0].replace("(based on", "(squashed - based on") | 304 msg[0] = msg[0].replace("(based on", "(squashed - based on") |
298 self.GitCommit(message = "\n".join(msg)) | 305 self.GitCommit(message = "\n".join(msg)) |
299 | 306 |
300 | 307 |
301 class PrepareVersionBranch(Step): | 308 class PrepareVersionBranch(Step): |
302 MESSAGE = "Prepare new branch to commit version and changelog file." | 309 MESSAGE = "Prepare new branch to commit version and changelog file." |
303 | 310 |
304 def RunStep(self): | 311 def RunStep(self): |
305 self.GitCheckout("master") | 312 self.GitCheckout("master") |
306 self.Git("fetch") | 313 self.Git("fetch") |
307 self.GitDeleteBranch(self.Config("TRUNKBRANCH")) | 314 self.GitDeleteBranch(self.Config("TRUNKBRANCH")) |
308 self.GitCreateBranch(self.Config("TRUNKBRANCH"), | 315 self.GitCreateBranch(self.Config("TRUNKBRANCH"), |
309 self.vc.RemoteCandidateBranch()) | 316 self.vc.RemoteCandidateBranch()) |
310 | 317 |
311 | 318 |
312 class AddChangeLog(Step): | 319 class AddChangeLog(Step): |
313 MESSAGE = "Add ChangeLog changes to trunk branch." | 320 MESSAGE = "Add ChangeLog changes to trunk branch." |
314 | 321 |
315 def RunStep(self): | 322 def RunStep(self): |
316 # The change log has been modified by the patch. Reset it to the version | |
317 # on trunk and apply the exact changes determined by this PrepareChangeLog | |
318 # step above. | |
319 self.GitCheckoutFile(CHANGELOG_FILE, self.vc.RemoteCandidateBranch()) | |
320 changelog_entry = FileToText(self.Config("CHANGELOG_ENTRY_FILE")) | 323 changelog_entry = FileToText(self.Config("CHANGELOG_ENTRY_FILE")) |
321 old_change_log = FileToText(os.path.join(self.default_cwd, CHANGELOG_FILE)) | 324 old_change_log = FileToText(os.path.join(self.default_cwd, CHANGELOG_FILE)) |
322 new_change_log = "%s\n\n\n%s" % (changelog_entry, old_change_log) | 325 new_change_log = "%s\n\n\n%s" % (changelog_entry, old_change_log) |
323 TextToFile(new_change_log, os.path.join(self.default_cwd, CHANGELOG_FILE)) | 326 TextToFile(new_change_log, os.path.join(self.default_cwd, CHANGELOG_FILE)) |
324 os.remove(self.Config("CHANGELOG_ENTRY_FILE")) | 327 os.remove(self.Config("CHANGELOG_ENTRY_FILE")) |
325 | 328 |
326 | 329 |
327 class SetVersion(Step): | 330 class SetVersion(Step): |
328 MESSAGE = "Set correct version for trunk." | 331 MESSAGE = "Set correct version for trunk." |
329 | 332 |
330 def RunStep(self): | 333 def RunStep(self): |
331 # The version file has been modified by the patch. Reset it to the version | |
332 # on trunk and apply the correct version. | |
333 self.GitCheckoutFile(VERSION_FILE, self.vc.RemoteCandidateBranch()) | |
334 self.SetVersion(os.path.join(self.default_cwd, VERSION_FILE), "new_") | 334 self.SetVersion(os.path.join(self.default_cwd, VERSION_FILE), "new_") |
335 | 335 |
336 | 336 |
337 class CommitCandidate(Step): | 337 class CommitCandidate(Step): |
338 MESSAGE = "Commit version and changelog to local candidates branch." | 338 MESSAGE = "Commit version and changelog to local candidates branch." |
339 | 339 |
340 def RunStep(self): | 340 def RunStep(self): |
341 self.GitCommit(file_name = self.Config("COMMITMSG_FILE")) | 341 self.GitCommit(file_name = self.Config("COMMITMSG_FILE")) |
342 os.remove(self.Config("COMMITMSG_FILE")) | 342 os.remove(self.Config("COMMITMSG_FILE")) |
343 | 343 |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
443 SetVersion, | 443 SetVersion, |
444 CommitCandidate, | 444 CommitCandidate, |
445 Land, | 445 Land, |
446 TagRevision, | 446 TagRevision, |
447 CleanUp, | 447 CleanUp, |
448 ] | 448 ] |
449 | 449 |
450 | 450 |
451 if __name__ == "__main__": # pragma: no cover | 451 if __name__ == "__main__": # pragma: no cover |
452 sys.exit(PushToTrunk().Run()) | 452 sys.exit(PushToTrunk().Run()) |
OLD | NEW |