| 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 625 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 636 commit_msg = """Line with "quotation marks".""" | 636 commit_msg = """Line with "quotation marks".""" |
| 637 self._TestSquashCommits(change_log, commit_msg) | 637 self._TestSquashCommits(change_log, commit_msg) |
| 638 | 638 |
| 639 def _PushToTrunk(self, force=False, manual=False): | 639 def _PushToTrunk(self, force=False, manual=False): |
| 640 TEST_CONFIG[DOT_GIT_LOCATION] = self.MakeEmptyTempFile() | 640 TEST_CONFIG[DOT_GIT_LOCATION] = self.MakeEmptyTempFile() |
| 641 TEST_CONFIG[VERSION_FILE] = self.MakeTempVersionFile() | 641 TEST_CONFIG[VERSION_FILE] = self.MakeTempVersionFile() |
| 642 TEST_CONFIG[CHANGELOG_ENTRY_FILE] = self.MakeEmptyTempFile() | 642 TEST_CONFIG[CHANGELOG_ENTRY_FILE] = self.MakeEmptyTempFile() |
| 643 TEST_CONFIG[CHANGELOG_FILE] = self.MakeEmptyTempFile() | 643 TEST_CONFIG[CHANGELOG_FILE] = self.MakeEmptyTempFile() |
| 644 if not os.path.exists(TEST_CONFIG[CHROMIUM]): | 644 if not os.path.exists(TEST_CONFIG[CHROMIUM]): |
| 645 os.makedirs(TEST_CONFIG[CHROMIUM]) | 645 os.makedirs(TEST_CONFIG[CHROMIUM]) |
| 646 TextToFile("1999-04-05: Version 3.22.4", TEST_CONFIG[CHANGELOG_FILE]) | 646 old_change_log = """1999-04-05: Version 3.22.4 |
| 647 |
| 648 Performance and stability improvements on all platforms.\n""" |
| 649 TextToFile(old_change_log, TEST_CONFIG[CHANGELOG_FILE]) |
| 647 TextToFile("Some line\n \"v8_revision\": \"123444\",\n some line", | 650 TextToFile("Some line\n \"v8_revision\": \"123444\",\n some line", |
| 648 TEST_CONFIG[DEPS_FILE]) | 651 TEST_CONFIG[DEPS_FILE]) |
| 649 os.environ["EDITOR"] = "vi" | 652 os.environ["EDITOR"] = "vi" |
| 650 | 653 |
| 651 def CheckPreparePush(): | 654 def CheckPreparePush(): |
| 652 cl = FileToText(TEST_CONFIG[CHANGELOG_FILE]) | 655 cl = FileToText(TEST_CONFIG[CHANGELOG_FILE]) |
| 653 self.assertTrue(re.search(r"Version 3.22.5", cl)) | 656 self.assertTrue(re.search(r"Version 3.22.5", cl)) |
| 654 self.assertTrue(re.search(r" Log text 1 \(issue 321\).", cl)) | 657 self.assertTrue(re.search(r" Log text 1 \(issue 321\).", cl)) |
| 655 self.assertFalse(re.search(r" \(author1@chromium\.org\)", cl)) | 658 self.assertFalse(re.search(r" \(author1@chromium\.org\)", cl)) |
| 656 | 659 |
| 657 # Make sure all comments got stripped. | 660 # Make sure all comments got stripped. |
| 658 self.assertFalse(re.search(r"^#", cl, flags=re.M)) | 661 self.assertFalse(re.search(r"^#", cl, flags=re.M)) |
| 659 | 662 |
| 660 version = FileToText(TEST_CONFIG[VERSION_FILE]) | 663 version = FileToText(TEST_CONFIG[VERSION_FILE]) |
| 661 self.assertTrue(re.search(r"#define BUILD_NUMBER\s+6", version)) | 664 self.assertTrue(re.search(r"#define BUILD_NUMBER\s+6", version)) |
| 662 | 665 |
| 666 def TrunkBranchSideEffects(): |
| 667 """On 'git co -b new_branch svn/trunk', the ChangLog will be reset to its |
| 668 original content.""" |
| 669 TextToFile(old_change_log, TEST_CONFIG[CHANGELOG_FILE]) |
| 670 |
| 663 def CheckSVNCommit(): | 671 def CheckSVNCommit(): |
| 664 commit = FileToText(TEST_CONFIG[COMMITMSG_FILE]) | 672 commit = FileToText(TEST_CONFIG[COMMITMSG_FILE]) |
| 665 self.assertEquals( | 673 self.assertEquals( |
| 666 """Version 3.22.5 (based on bleeding_edge revision r123455) | 674 """Version 3.22.5 (based on bleeding_edge revision r123455) |
| 667 | 675 |
| 668 Log text 1 (issue 321). | 676 Log text 1 (issue 321). |
| 669 | 677 |
| 670 Performance and stability improvements on all platforms.""", commit) | 678 Performance and stability improvements on all platforms.""", commit) |
| 671 version = FileToText(TEST_CONFIG[VERSION_FILE]) | 679 version = FileToText(TEST_CONFIG[VERSION_FILE]) |
| 672 self.assertTrue(re.search(r"#define MINOR_VERSION\s+22", version)) | 680 self.assertTrue(re.search(r"#define MINOR_VERSION\s+22", version)) |
| 673 self.assertTrue(re.search(r"#define BUILD_NUMBER\s+5", version)) | 681 self.assertTrue(re.search(r"#define BUILD_NUMBER\s+5", version)) |
| 674 self.assertFalse(re.search(r"#define BUILD_NUMBER\s+6", version)) | 682 self.assertFalse(re.search(r"#define BUILD_NUMBER\s+6", version)) |
| 675 self.assertTrue(re.search(r"#define PATCH_LEVEL\s+0", version)) | 683 self.assertTrue(re.search(r"#define PATCH_LEVEL\s+0", version)) |
| 676 self.assertTrue(re.search(r"#define IS_CANDIDATE_VERSION\s+0", version)) | 684 self.assertTrue(re.search(r"#define IS_CANDIDATE_VERSION\s+0", version)) |
| 677 | 685 |
| 686 # Check that the change log on the trunk branch got correctly modified. |
| 687 change_log = FileToText(TEST_CONFIG[CHANGELOG_FILE]) |
| 688 self.assertEquals( |
| 689 """1999-07-31: Version 3.22.5 |
| 690 |
| 691 Log text 1 (issue 321). |
| 692 |
| 693 Performance and stability improvements on all platforms. |
| 694 |
| 695 |
| 696 1999-04-05: Version 3.22.4 |
| 697 |
| 698 Performance and stability improvements on all platforms.\n""", |
| 699 change_log) |
| 700 |
| 678 force_flag = " -f" if not manual else "" | 701 force_flag = " -f" if not manual else "" |
| 679 review_suffix = "\n\nTBR=reviewer@chromium.org" if not manual else "" | 702 review_suffix = "\n\nTBR=reviewer@chromium.org" if not manual else "" |
| 680 self.ExpectGit([ | 703 self.ExpectGit([ |
| 681 Git("status -s -uno", ""), | 704 Git("status -s -uno", ""), |
| 682 Git("status -s -b -uno", "## some_branch\n"), | 705 Git("status -s -b -uno", "## some_branch\n"), |
| 683 Git("svn fetch", ""), | 706 Git("svn fetch", ""), |
| 684 Git("branch", " branch1\n* branch2\n"), | 707 Git("branch", " branch1\n* branch2\n"), |
| 685 Git("checkout -b %s" % TEST_CONFIG[TEMP_BRANCH], ""), | 708 Git("checkout -b %s" % TEST_CONFIG[TEMP_BRANCH], ""), |
| 686 Git("branch", " branch1\n* branch2\n"), | 709 Git("branch", " branch1\n* branch2\n"), |
| 687 Git("branch", " branch1\n* branch2\n"), | 710 Git("branch", " branch1\n* branch2\n"), |
| (...skipping 16 matching lines...) Expand all Loading... |
| 704 Git(("cl upload --send-mail --email \"author@chromium.org\" " | 727 Git(("cl upload --send-mail --email \"author@chromium.org\" " |
| 705 "-r \"reviewer@chromium.org\"%s" % force_flag), | 728 "-r \"reviewer@chromium.org\"%s" % force_flag), |
| 706 "done\n"), | 729 "done\n"), |
| 707 Git("cl presubmit", "Presubmit successfull\n"), | 730 Git("cl presubmit", "Presubmit successfull\n"), |
| 708 Git("cl dcommit -f --bypass-hooks", "Closing issue\n"), | 731 Git("cl dcommit -f --bypass-hooks", "Closing issue\n"), |
| 709 Git("svn fetch", "fetch result\n"), | 732 Git("svn fetch", "fetch result\n"), |
| 710 Git("checkout -f svn/bleeding_edge", ""), | 733 Git("checkout -f svn/bleeding_edge", ""), |
| 711 Git(("log -1 --format=%H --grep=\"Prepare push to trunk. " | 734 Git(("log -1 --format=%H --grep=\"Prepare push to trunk. " |
| 712 "Now working on version 3.22.6.\""), | 735 "Now working on version 3.22.6.\""), |
| 713 "hash1\n"), | 736 "hash1\n"), |
| 714 Git("diff --name-only svn/trunk hash1", "file1\nfile2\n"), | 737 # The ChangeLog file will be one of the files with differences between |
| 738 # trunk and bleeding edge. |
| 739 Git("diff --name-only svn/trunk hash1", |
| 740 "file1\n%s\nfile2\n" % TEST_CONFIG[CHANGELOG_FILE]), |
| 715 Git("diff svn/trunk hash1 file1 file2", "patch content"), | 741 Git("diff svn/trunk hash1 file1 file2", "patch content"), |
| 716 Git("svn find-rev hash1", "123455\n"), | 742 Git("svn find-rev hash1", "123455\n"), |
| 717 Git("checkout -b %s svn/trunk" % TEST_CONFIG[TRUNKBRANCH], ""), | 743 Git("checkout -b %s svn/trunk" % TEST_CONFIG[TRUNKBRANCH], "", |
| 744 cb=TrunkBranchSideEffects), |
| 718 Git("apply --index --reject \"%s\"" % TEST_CONFIG[PATCH_FILE], ""), | 745 Git("apply --index --reject \"%s\"" % TEST_CONFIG[PATCH_FILE], ""), |
| 719 Git("add \"%s\"" % TEST_CONFIG[VERSION_FILE], ""), | 746 Git("add \"%s\"" % TEST_CONFIG[VERSION_FILE], ""), |
| 720 Git("commit -aF \"%s\"" % TEST_CONFIG[COMMITMSG_FILE], "", | 747 Git("commit -aF \"%s\"" % TEST_CONFIG[COMMITMSG_FILE], "", |
| 721 cb=CheckSVNCommit), | 748 cb=CheckSVNCommit), |
| 722 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"), |
| 723 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\"", ""), |
| 724 Git("status -s -uno", ""), | 751 Git("status -s -uno", ""), |
| 725 Git("checkout -f master", ""), | 752 Git("checkout -f master", ""), |
| 726 Git("pull", ""), | 753 Git("pull", ""), |
| 727 Git("checkout -b v8-roll-123456", ""), | 754 Git("checkout -b v8-roll-123456", ""), |
| (...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1015 | 1042 |
| 1016 Review URL: https://codereview.chromium.org/83173002 | 1043 Review URL: https://codereview.chromium.org/83173002 |
| 1017 | 1044 |
| 1018 ------------------------------------------------------------------------""") | 1045 ------------------------------------------------------------------------""") |
| 1019 self.assertEquals( | 1046 self.assertEquals( |
| 1020 """Prepare push to trunk. Now working on version 3.23.11. | 1047 """Prepare push to trunk. Now working on version 3.23.11. |
| 1021 | 1048 |
| 1022 R=danno@chromium.org | 1049 R=danno@chromium.org |
| 1023 | 1050 |
| 1024 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) |
| OLD | NEW |