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

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

Issue 196473012: Reland "Maintain change log file directly on trunk branch in push-to-trunk." (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 9 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 | Annotate | Revision Log
« no previous file with comments | « tools/push-to-trunk/push_to_trunk.py ('k') | no next file » | 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 624 matching lines...) Expand 10 before | Expand all | Expand 10 after
635 commit_msg = """Line with "quotation marks".""" 635 commit_msg = """Line with "quotation marks"."""
636 self._TestSquashCommits(change_log, commit_msg) 636 self._TestSquashCommits(change_log, commit_msg)
637 637
638 def _PushToTrunk(self, force=False, manual=False): 638 def _PushToTrunk(self, force=False, manual=False):
639 TEST_CONFIG[DOT_GIT_LOCATION] = self.MakeEmptyTempFile() 639 TEST_CONFIG[DOT_GIT_LOCATION] = self.MakeEmptyTempFile()
640 TEST_CONFIG[VERSION_FILE] = self.MakeTempVersionFile() 640 TEST_CONFIG[VERSION_FILE] = self.MakeTempVersionFile()
641 TEST_CONFIG[CHANGELOG_ENTRY_FILE] = self.MakeEmptyTempFile() 641 TEST_CONFIG[CHANGELOG_ENTRY_FILE] = self.MakeEmptyTempFile()
642 TEST_CONFIG[CHANGELOG_FILE] = self.MakeEmptyTempFile() 642 TEST_CONFIG[CHANGELOG_FILE] = self.MakeEmptyTempFile()
643 if not os.path.exists(TEST_CONFIG[CHROMIUM]): 643 if not os.path.exists(TEST_CONFIG[CHROMIUM]):
644 os.makedirs(TEST_CONFIG[CHROMIUM]) 644 os.makedirs(TEST_CONFIG[CHROMIUM])
645 TextToFile("1999-04-05: Version 3.22.4", TEST_CONFIG[CHANGELOG_FILE]) 645 bleeding_edge_change_log = """1999-02-03: Version 3.12.2
646
647 Performance and stability improvements on all platforms.\n"""
648 TextToFile(bleeding_edge_change_log, TEST_CONFIG[CHANGELOG_FILE])
646 TextToFile("Some line\n \"v8_revision\": \"123444\",\n some line", 649 TextToFile("Some line\n \"v8_revision\": \"123444\",\n some line",
647 TEST_CONFIG[DEPS_FILE]) 650 TEST_CONFIG[DEPS_FILE])
648 os.environ["EDITOR"] = "vi" 651 os.environ["EDITOR"] = "vi"
649 652
650 def CheckPreparePush(): 653 def CheckPreparePush():
651 cl = FileToText(TEST_CONFIG[CHANGELOG_FILE]) 654 cl = FileToText(TEST_CONFIG[CHANGELOG_FILE])
652 self.assertTrue(re.search(r"Version 3.22.5", cl)) 655 self.assertTrue(re.search(r"Version 3.22.5", cl))
653 self.assertTrue(re.search(r" Log text 1 \(issue 321\).", cl)) 656 self.assertTrue(re.search(r" Log text 1 \(issue 321\).", cl))
654 self.assertFalse(re.search(r" \(author1@chromium\.org\)", cl)) 657 self.assertFalse(re.search(r" \(author1@chromium\.org\)", cl))
655 658
656 # Make sure all comments got stripped. 659 # Make sure all comments got stripped.
657 self.assertFalse(re.search(r"^#", cl, flags=re.M)) 660 self.assertFalse(re.search(r"^#", cl, flags=re.M))
658 661
659 version = FileToText(TEST_CONFIG[VERSION_FILE]) 662 version = FileToText(TEST_CONFIG[VERSION_FILE])
660 self.assertTrue(re.search(r"#define BUILD_NUMBER\s+6", version)) 663 self.assertTrue(re.search(r"#define BUILD_NUMBER\s+6", version))
661 664
665 def ResetChangeLog():
666 """On 'git co -b new_branch svn/trunk', and 'git checkout -- ChangeLog',
667 the ChangLog will be reset to its content on trunk."""
668 trunk_change_log = """1999-04-05: Version 3.22.4
669
670 Performance and stability improvements on all platforms.\n"""
671 TextToFile(trunk_change_log, TEST_CONFIG[CHANGELOG_FILE])
672
662 def CheckSVNCommit(): 673 def CheckSVNCommit():
663 commit = FileToText(TEST_CONFIG[COMMITMSG_FILE]) 674 commit = FileToText(TEST_CONFIG[COMMITMSG_FILE])
664 self.assertEquals( 675 self.assertEquals(
665 """Version 3.22.5 (based on bleeding_edge revision r123455) 676 """Version 3.22.5 (based on bleeding_edge revision r123455)
666 677
667 Log text 1 (issue 321). 678 Log text 1 (issue 321).
668 679
669 Performance and stability improvements on all platforms.""", commit) 680 Performance and stability improvements on all platforms.""", commit)
670 version = FileToText(TEST_CONFIG[VERSION_FILE]) 681 version = FileToText(TEST_CONFIG[VERSION_FILE])
671 self.assertTrue(re.search(r"#define MINOR_VERSION\s+22", version)) 682 self.assertTrue(re.search(r"#define MINOR_VERSION\s+22", version))
672 self.assertTrue(re.search(r"#define BUILD_NUMBER\s+5", version)) 683 self.assertTrue(re.search(r"#define BUILD_NUMBER\s+5", version))
673 self.assertFalse(re.search(r"#define BUILD_NUMBER\s+6", version)) 684 self.assertFalse(re.search(r"#define BUILD_NUMBER\s+6", version))
674 self.assertTrue(re.search(r"#define PATCH_LEVEL\s+0", version)) 685 self.assertTrue(re.search(r"#define PATCH_LEVEL\s+0", version))
675 self.assertTrue(re.search(r"#define IS_CANDIDATE_VERSION\s+0", version)) 686 self.assertTrue(re.search(r"#define IS_CANDIDATE_VERSION\s+0", version))
676 687
688 # Check that the change log on the trunk branch got correctly modified.
689 change_log = FileToText(TEST_CONFIG[CHANGELOG_FILE])
690 self.assertEquals(
691 """1999-07-31: Version 3.22.5
692
693 Log text 1 (issue 321).
694
695 Performance and stability improvements on all platforms.
696
697
698 1999-04-05: Version 3.22.4
699
700 Performance and stability improvements on all platforms.\n""",
701 change_log)
702
677 force_flag = " -f" if not manual else "" 703 force_flag = " -f" if not manual else ""
678 review_suffix = "\n\nTBR=reviewer@chromium.org" if not manual else "" 704 review_suffix = "\n\nTBR=reviewer@chromium.org" if not manual else ""
679 self.ExpectGit([ 705 self.ExpectGit([
680 Git("status -s -uno", ""), 706 Git("status -s -uno", ""),
681 Git("status -s -b -uno", "## some_branch\n"), 707 Git("status -s -b -uno", "## some_branch\n"),
682 Git("svn fetch", ""), 708 Git("svn fetch", ""),
683 Git("branch", " branch1\n* branch2\n"), 709 Git("branch", " branch1\n* branch2\n"),
684 Git("checkout -b %s" % TEST_CONFIG[TEMP_BRANCH], ""), 710 Git("checkout -b %s" % TEST_CONFIG[TEMP_BRANCH], ""),
685 Git("branch", " branch1\n* branch2\n"), 711 Git("branch", " branch1\n* branch2\n"),
686 Git("branch", " branch1\n* branch2\n"), 712 Git("branch", " branch1\n* branch2\n"),
(...skipping 18 matching lines...) Expand all
705 "done\n"), 731 "done\n"),
706 Git("cl presubmit", "Presubmit successfull\n"), 732 Git("cl presubmit", "Presubmit successfull\n"),
707 Git("cl dcommit -f --bypass-hooks", "Closing issue\n"), 733 Git("cl dcommit -f --bypass-hooks", "Closing issue\n"),
708 Git("svn fetch", "fetch result\n"), 734 Git("svn fetch", "fetch result\n"),
709 Git("checkout -f svn/bleeding_edge", ""), 735 Git("checkout -f svn/bleeding_edge", ""),
710 Git(("log -1 --format=%H --grep=\"Prepare push to trunk. " 736 Git(("log -1 --format=%H --grep=\"Prepare push to trunk. "
711 "Now working on version 3.22.6.\""), 737 "Now working on version 3.22.6.\""),
712 "hash1\n"), 738 "hash1\n"),
713 Git("diff svn/trunk hash1", "patch content\n"), 739 Git("diff svn/trunk hash1", "patch content\n"),
714 Git("svn find-rev hash1", "123455\n"), 740 Git("svn find-rev hash1", "123455\n"),
715 Git("checkout -b %s svn/trunk" % TEST_CONFIG[TRUNKBRANCH], ""), 741 Git("checkout -b %s svn/trunk" % TEST_CONFIG[TRUNKBRANCH], "",
742 cb=ResetChangeLog),
716 Git("apply --index --reject \"%s\"" % TEST_CONFIG[PATCH_FILE], ""), 743 Git("apply --index --reject \"%s\"" % TEST_CONFIG[PATCH_FILE], ""),
744 Git("checkout -- %s" % TEST_CONFIG[CHANGELOG_FILE], "",
745 cb=ResetChangeLog),
717 Git("add \"%s\"" % TEST_CONFIG[VERSION_FILE], ""), 746 Git("add \"%s\"" % TEST_CONFIG[VERSION_FILE], ""),
718 Git("commit -aF \"%s\"" % TEST_CONFIG[COMMITMSG_FILE], "", 747 Git("commit -aF \"%s\"" % TEST_CONFIG[COMMITMSG_FILE], "",
719 cb=CheckSVNCommit), 748 cb=CheckSVNCommit),
720 Git("svn dcommit 2>&1", "Some output\nCommitted r123456\nSome output\n"), 749 Git("svn dcommit 2>&1", "Some output\nCommitted r123456\nSome output\n"),
721 Git("svn tag 3.22.5 -m \"Tagging version 3.22.5\"", ""), 750 Git("svn tag 3.22.5 -m \"Tagging version 3.22.5\"", ""),
722 Git("status -s -uno", ""), 751 Git("status -s -uno", ""),
723 Git("checkout -f master", ""), 752 Git("checkout -f master", ""),
724 Git("pull", ""), 753 Git("pull", ""),
725 Git("checkout -b v8-roll-123456", ""), 754 Git("checkout -b v8-roll-123456", ""),
726 Git(("commit -am \"Update V8 to version 3.22.5 " 755 Git(("commit -am \"Update V8 to version 3.22.5 "
(...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after
1013 1042
1014 Review URL: https://codereview.chromium.org/83173002 1043 Review URL: https://codereview.chromium.org/83173002
1015 1044
1016 ------------------------------------------------------------------------""") 1045 ------------------------------------------------------------------------""")
1017 self.assertEquals( 1046 self.assertEquals(
1018 """Prepare push to trunk. Now working on version 3.23.11. 1047 """Prepare push to trunk. Now working on version 3.23.11.
1019 1048
1020 R=danno@chromium.org 1049 R=danno@chromium.org
1021 1050
1022 Committed: https://code.google.com/p/v8/source/detail?r=17997""", body) 1051 Committed: https://code.google.com/p/v8/source/detail?r=17997""", body)
OLDNEW
« no previous file with comments | « tools/push-to-trunk/push_to_trunk.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698