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

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

Issue 197313005: Revert "Maintain change log file directly on trunk branch in push-to-trunk." and related changes. (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 571 matching lines...) Expand 10 before | Expand all | Expand 10 after
582 582
583 cl = GetLastChangeLogEntries(TEST_CONFIG[CHANGELOG_FILE]) 583 cl = GetLastChangeLogEntries(TEST_CONFIG[CHANGELOG_FILE])
584 self.assertEquals(cl_chunk, cl) 584 self.assertEquals(cl_chunk, cl)
585 585
586 def _TestSquashCommits(self, change_log, expected_msg): 586 def _TestSquashCommits(self, change_log, expected_msg):
587 TEST_CONFIG[CHANGELOG_ENTRY_FILE] = self.MakeEmptyTempFile() 587 TEST_CONFIG[CHANGELOG_ENTRY_FILE] = self.MakeEmptyTempFile()
588 with open(TEST_CONFIG[CHANGELOG_ENTRY_FILE], "w") as f: 588 with open(TEST_CONFIG[CHANGELOG_ENTRY_FILE], "w") as f:
589 f.write(change_log) 589 f.write(change_log)
590 590
591 self.ExpectGit([ 591 self.ExpectGit([
592 Git("diff --name-only svn/trunk hash1", "file1\nfile2\n"), 592 Git("diff svn/trunk hash1", "patch content"),
593 Git("diff svn/trunk hash1 file1 file2", "patch content"),
594 Git("svn find-rev hash1", "123455\n"), 593 Git("svn find-rev hash1", "123455\n"),
595 ]) 594 ])
596 595
597 self._state["prepare_commit_hash"] = "hash1" 596 self._state["prepare_commit_hash"] = "hash1"
598 self._state["date"] = "1999-11-11" 597 self._state["date"] = "1999-11-11"
599 598
600 self.RunStep(PushToTrunk, SquashCommits) 599 self.RunStep(PushToTrunk, SquashCommits)
601 self.assertEquals(FileToText(TEST_CONFIG[COMMITMSG_FILE]), expected_msg) 600 self.assertEquals(FileToText(TEST_CONFIG[COMMITMSG_FILE]), expected_msg)
602 601
603 patch = FileToText(TEST_CONFIG[ PATCH_FILE]) 602 patch = FileToText(TEST_CONFIG[ PATCH_FILE])
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
636 commit_msg = """Line with "quotation marks".""" 635 commit_msg = """Line with "quotation marks"."""
637 self._TestSquashCommits(change_log, commit_msg) 636 self._TestSquashCommits(change_log, commit_msg)
638 637
639 def _PushToTrunk(self, force=False, manual=False): 638 def _PushToTrunk(self, force=False, manual=False):
640 TEST_CONFIG[DOT_GIT_LOCATION] = self.MakeEmptyTempFile() 639 TEST_CONFIG[DOT_GIT_LOCATION] = self.MakeEmptyTempFile()
641 TEST_CONFIG[VERSION_FILE] = self.MakeTempVersionFile() 640 TEST_CONFIG[VERSION_FILE] = self.MakeTempVersionFile()
642 TEST_CONFIG[CHANGELOG_ENTRY_FILE] = self.MakeEmptyTempFile() 641 TEST_CONFIG[CHANGELOG_ENTRY_FILE] = self.MakeEmptyTempFile()
643 TEST_CONFIG[CHANGELOG_FILE] = self.MakeEmptyTempFile() 642 TEST_CONFIG[CHANGELOG_FILE] = self.MakeEmptyTempFile()
644 if not os.path.exists(TEST_CONFIG[CHROMIUM]): 643 if not os.path.exists(TEST_CONFIG[CHROMIUM]):
645 os.makedirs(TEST_CONFIG[CHROMIUM]) 644 os.makedirs(TEST_CONFIG[CHROMIUM])
646 old_change_log = """1999-04-05: Version 3.22.4 645 TextToFile("1999-04-05: Version 3.22.4", TEST_CONFIG[CHANGELOG_FILE])
647
648 Performance and stability improvements on all platforms.\n"""
649 TextToFile(old_change_log, TEST_CONFIG[CHANGELOG_FILE])
650 TextToFile("Some line\n \"v8_revision\": \"123444\",\n some line", 646 TextToFile("Some line\n \"v8_revision\": \"123444\",\n some line",
651 TEST_CONFIG[DEPS_FILE]) 647 TEST_CONFIG[DEPS_FILE])
652 os.environ["EDITOR"] = "vi" 648 os.environ["EDITOR"] = "vi"
653 649
654 def CheckPreparePush(): 650 def CheckPreparePush():
655 cl = FileToText(TEST_CONFIG[CHANGELOG_FILE]) 651 cl = FileToText(TEST_CONFIG[CHANGELOG_FILE])
656 self.assertTrue(re.search(r"Version 3.22.5", cl)) 652 self.assertTrue(re.search(r"Version 3.22.5", cl))
657 self.assertTrue(re.search(r" Log text 1 \(issue 321\).", cl)) 653 self.assertTrue(re.search(r" Log text 1 \(issue 321\).", cl))
658 self.assertFalse(re.search(r" \(author1@chromium\.org\)", cl)) 654 self.assertFalse(re.search(r" \(author1@chromium\.org\)", cl))
659 655
660 # Make sure all comments got stripped. 656 # Make sure all comments got stripped.
661 self.assertFalse(re.search(r"^#", cl, flags=re.M)) 657 self.assertFalse(re.search(r"^#", cl, flags=re.M))
662 658
663 version = FileToText(TEST_CONFIG[VERSION_FILE]) 659 version = FileToText(TEST_CONFIG[VERSION_FILE])
664 self.assertTrue(re.search(r"#define BUILD_NUMBER\s+6", version)) 660 self.assertTrue(re.search(r"#define BUILD_NUMBER\s+6", version))
665 661
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
671 def CheckSVNCommit(): 662 def CheckSVNCommit():
672 commit = FileToText(TEST_CONFIG[COMMITMSG_FILE]) 663 commit = FileToText(TEST_CONFIG[COMMITMSG_FILE])
673 self.assertEquals( 664 self.assertEquals(
674 """Version 3.22.5 (based on bleeding_edge revision r123455) 665 """Version 3.22.5 (based on bleeding_edge revision r123455)
675 666
676 Log text 1 (issue 321). 667 Log text 1 (issue 321).
677 668
678 Performance and stability improvements on all platforms.""", commit) 669 Performance and stability improvements on all platforms.""", commit)
679 version = FileToText(TEST_CONFIG[VERSION_FILE]) 670 version = FileToText(TEST_CONFIG[VERSION_FILE])
680 self.assertTrue(re.search(r"#define MINOR_VERSION\s+22", version)) 671 self.assertTrue(re.search(r"#define MINOR_VERSION\s+22", version))
681 self.assertTrue(re.search(r"#define BUILD_NUMBER\s+5", version)) 672 self.assertTrue(re.search(r"#define BUILD_NUMBER\s+5", version))
682 self.assertFalse(re.search(r"#define BUILD_NUMBER\s+6", version)) 673 self.assertFalse(re.search(r"#define BUILD_NUMBER\s+6", version))
683 self.assertTrue(re.search(r"#define PATCH_LEVEL\s+0", version)) 674 self.assertTrue(re.search(r"#define PATCH_LEVEL\s+0", version))
684 self.assertTrue(re.search(r"#define IS_CANDIDATE_VERSION\s+0", version)) 675 self.assertTrue(re.search(r"#define IS_CANDIDATE_VERSION\s+0", version))
685 676
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
701 force_flag = " -f" if not manual else "" 677 force_flag = " -f" if not manual else ""
702 review_suffix = "\n\nTBR=reviewer@chromium.org" if not manual else "" 678 review_suffix = "\n\nTBR=reviewer@chromium.org" if not manual else ""
703 self.ExpectGit([ 679 self.ExpectGit([
704 Git("status -s -uno", ""), 680 Git("status -s -uno", ""),
705 Git("status -s -b -uno", "## some_branch\n"), 681 Git("status -s -b -uno", "## some_branch\n"),
706 Git("svn fetch", ""), 682 Git("svn fetch", ""),
707 Git("branch", " branch1\n* branch2\n"), 683 Git("branch", " branch1\n* branch2\n"),
708 Git("checkout -b %s" % TEST_CONFIG[TEMP_BRANCH], ""), 684 Git("checkout -b %s" % TEST_CONFIG[TEMP_BRANCH], ""),
709 Git("branch", " branch1\n* branch2\n"), 685 Git("branch", " branch1\n* branch2\n"),
710 Git("branch", " branch1\n* branch2\n"), 686 Git("branch", " branch1\n* branch2\n"),
(...skipping 16 matching lines...) Expand all
727 Git(("cl upload --send-mail --email \"author@chromium.org\" " 703 Git(("cl upload --send-mail --email \"author@chromium.org\" "
728 "-r \"reviewer@chromium.org\"%s" % force_flag), 704 "-r \"reviewer@chromium.org\"%s" % force_flag),
729 "done\n"), 705 "done\n"),
730 Git("cl presubmit", "Presubmit successfull\n"), 706 Git("cl presubmit", "Presubmit successfull\n"),
731 Git("cl dcommit -f --bypass-hooks", "Closing issue\n"), 707 Git("cl dcommit -f --bypass-hooks", "Closing issue\n"),
732 Git("svn fetch", "fetch result\n"), 708 Git("svn fetch", "fetch result\n"),
733 Git("checkout -f svn/bleeding_edge", ""), 709 Git("checkout -f svn/bleeding_edge", ""),
734 Git(("log -1 --format=%H --grep=\"Prepare push to trunk. " 710 Git(("log -1 --format=%H --grep=\"Prepare push to trunk. "
735 "Now working on version 3.22.6.\""), 711 "Now working on version 3.22.6.\""),
736 "hash1\n"), 712 "hash1\n"),
737 # The ChangeLog file will be one of the files with differences between 713 Git("diff svn/trunk hash1", "patch content\n"),
738 # trunk and bleeding edge.
739 Git("diff --name-only svn/trunk hash1",
740 "file1\n%s\nfile2\n" % TEST_CONFIG[CHANGELOG_FILE]),
741 Git("diff svn/trunk hash1 file1 file2", "patch content"),
742 Git("svn find-rev hash1", "123455\n"), 714 Git("svn find-rev hash1", "123455\n"),
743 Git("checkout -b %s svn/trunk" % TEST_CONFIG[TRUNKBRANCH], "", 715 Git("checkout -b %s svn/trunk" % TEST_CONFIG[TRUNKBRANCH], ""),
744 cb=TrunkBranchSideEffects),
745 Git("apply --index --reject \"%s\"" % TEST_CONFIG[PATCH_FILE], ""), 716 Git("apply --index --reject \"%s\"" % TEST_CONFIG[PATCH_FILE], ""),
746 Git("add \"%s\"" % TEST_CONFIG[VERSION_FILE], ""), 717 Git("add \"%s\"" % TEST_CONFIG[VERSION_FILE], ""),
747 Git("commit -aF \"%s\"" % TEST_CONFIG[COMMITMSG_FILE], "", 718 Git("commit -aF \"%s\"" % TEST_CONFIG[COMMITMSG_FILE], "",
748 cb=CheckSVNCommit), 719 cb=CheckSVNCommit),
749 Git("svn dcommit 2>&1", "Some output\nCommitted r123456\nSome output\n"), 720 Git("svn dcommit 2>&1", "Some output\nCommitted r123456\nSome output\n"),
750 Git("svn tag 3.22.5 -m \"Tagging version 3.22.5\"", ""), 721 Git("svn tag 3.22.5 -m \"Tagging version 3.22.5\"", ""),
751 Git("status -s -uno", ""), 722 Git("status -s -uno", ""),
752 Git("checkout -f master", ""), 723 Git("checkout -f master", ""),
753 Git("pull", ""), 724 Git("pull", ""),
754 Git("checkout -b v8-roll-123456", ""), 725 Git("checkout -b v8-roll-123456", ""),
(...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after
1042 1013
1043 Review URL: https://codereview.chromium.org/83173002 1014 Review URL: https://codereview.chromium.org/83173002
1044 1015
1045 ------------------------------------------------------------------------""") 1016 ------------------------------------------------------------------------""")
1046 self.assertEquals( 1017 self.assertEquals(
1047 """Prepare push to trunk. Now working on version 3.23.11. 1018 """Prepare push to trunk. Now working on version 3.23.11.
1048 1019
1049 R=danno@chromium.org 1020 R=danno@chromium.org
1050 1021
1051 Committed: https://code.google.com/p/v8/source/detail?r=17997""", body) 1022 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