Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(190)

Side by Side Diff: tools/push-to-trunk/push_to_trunk.py

Issue 870923003: Push version and changelog as a separate commit. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | tools/push-to-trunk/test_scripts.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 269 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 288
289 289
290 class CommitSquash(Step):
291 MESSAGE = "Commit to local candidates branch."
292
293 def RunStep(self):
294 # Make a first commit with a slightly different title to not confuse
295 # the tagging.
296 msg = FileToText(self.Config("COMMITMSG_FILE")).splitlines()
297 msg[0] = msg[0].replace("(based on", "(squashed - based on")
298 self.GitCommit(message = "\n".join(msg))
299
300
301 class PrepareVersionBranch(Step):
302 MESSAGE = "Prepare new branch to commit version and changelog file."
303
304 def RunStep(self):
305 self.GitCheckout("master")
306 self.Git("fetch")
307 self.GitDeleteBranch(self.Config("TRUNKBRANCH"))
308 self.GitCreateBranch(self.Config("TRUNKBRANCH"),
309 self.vc.RemoteCandidateBranch())
310
311
290 class AddChangeLog(Step): 312 class AddChangeLog(Step):
291 MESSAGE = "Add ChangeLog changes to trunk branch." 313 MESSAGE = "Add ChangeLog changes to trunk branch."
292 314
293 def RunStep(self): 315 def RunStep(self):
294 # The change log has been modified by the patch. Reset it to the version 316 # The change log has been modified by the patch. Reset it to the version
295 # on trunk and apply the exact changes determined by this PrepareChangeLog 317 # on trunk and apply the exact changes determined by this PrepareChangeLog
296 # step above. 318 # step above.
297 self.GitCheckoutFile(CHANGELOG_FILE, self.vc.RemoteCandidateBranch()) 319 self.GitCheckoutFile(CHANGELOG_FILE, self.vc.RemoteCandidateBranch())
298 changelog_entry = FileToText(self.Config("CHANGELOG_ENTRY_FILE")) 320 changelog_entry = FileToText(self.Config("CHANGELOG_ENTRY_FILE"))
299 old_change_log = FileToText(os.path.join(self.default_cwd, CHANGELOG_FILE)) 321 old_change_log = FileToText(os.path.join(self.default_cwd, CHANGELOG_FILE))
300 new_change_log = "%s\n\n\n%s" % (changelog_entry, old_change_log) 322 new_change_log = "%s\n\n\n%s" % (changelog_entry, old_change_log)
301 TextToFile(new_change_log, os.path.join(self.default_cwd, CHANGELOG_FILE)) 323 TextToFile(new_change_log, os.path.join(self.default_cwd, CHANGELOG_FILE))
302 os.remove(self.Config("CHANGELOG_ENTRY_FILE")) 324 os.remove(self.Config("CHANGELOG_ENTRY_FILE"))
303 325
304 326
305 class SetVersion(Step): 327 class SetVersion(Step):
306 MESSAGE = "Set correct version for trunk." 328 MESSAGE = "Set correct version for trunk."
307 329
308 def RunStep(self): 330 def RunStep(self):
309 # The version file has been modified by the patch. Reset it to the version 331 # The version file has been modified by the patch. Reset it to the version
310 # on trunk and apply the correct version. 332 # on trunk and apply the correct version.
311 self.GitCheckoutFile(VERSION_FILE, self.vc.RemoteCandidateBranch()) 333 self.GitCheckoutFile(VERSION_FILE, self.vc.RemoteCandidateBranch())
312 self.SetVersion(os.path.join(self.default_cwd, VERSION_FILE), "new_") 334 self.SetVersion(os.path.join(self.default_cwd, VERSION_FILE), "new_")
313 335
314 336
315 class CommitTrunk(Step): 337 class CommitCandidate(Step):
316 MESSAGE = "Commit to local trunk branch." 338 MESSAGE = "Commit version and changelog to local candidates branch."
317 339
318 def RunStep(self): 340 def RunStep(self):
319 self.GitCommit(file_name = self.Config("COMMITMSG_FILE")) 341 self.GitCommit(file_name = self.Config("COMMITMSG_FILE"))
320 os.remove(self.Config("COMMITMSG_FILE")) 342 os.remove(self.Config("COMMITMSG_FILE"))
321 343
322 344
323 class SanityCheck(Step): 345 class SanityCheck(Step):
324 MESSAGE = "Sanity check." 346 MESSAGE = "Sanity check."
325 347
326 def RunStep(self): 348 def RunStep(self):
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
406 PreparePushRevision, 428 PreparePushRevision,
407 DetectLastPush, 429 DetectLastPush,
408 GetLatestVersion, 430 GetLatestVersion,
409 IncrementVersion, 431 IncrementVersion,
410 PrepareChangeLog, 432 PrepareChangeLog,
411 EditChangeLog, 433 EditChangeLog,
412 StragglerCommits, 434 StragglerCommits,
413 SquashCommits, 435 SquashCommits,
414 NewBranch, 436 NewBranch,
415 ApplyChanges, 437 ApplyChanges,
438 CommitSquash,
439 SanityCheck,
440 Land,
441 PrepareVersionBranch,
416 AddChangeLog, 442 AddChangeLog,
417 SetVersion, 443 SetVersion,
418 CommitTrunk, 444 CommitCandidate,
419 SanityCheck,
420 Land, 445 Land,
421 TagRevision, 446 TagRevision,
422 CleanUp, 447 CleanUp,
423 ] 448 ]
424 449
425 450
426 if __name__ == "__main__": # pragma: no cover 451 if __name__ == "__main__": # pragma: no cover
427 sys.exit(PushToTrunk().Run()) 452 sys.exit(PushToTrunk().Run())
OLDNEW
« no previous file with comments | « no previous file | tools/push-to-trunk/test_scripts.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698