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 428 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
439 self.Expect([Cmd("git --version", "git version 1.2.3"), | 439 self.Expect([Cmd("git --version", "git version 1.2.3"), |
440 Cmd("git dummy", "")]) | 440 Cmd("git dummy", "")]) |
441 self.assertEquals("git version 1.2.3", self.MakeStep().Git("--version")) | 441 self.assertEquals("git version 1.2.3", self.MakeStep().Git("--version")) |
442 self.assertEquals("", self.MakeStep().Git("dummy")) | 442 self.assertEquals("", self.MakeStep().Git("dummy")) |
443 | 443 |
444 def testCommonPrepareDefault(self): | 444 def testCommonPrepareDefault(self): |
445 self.Expect([ | 445 self.Expect([ |
446 Cmd("git status -s -uno", ""), | 446 Cmd("git status -s -uno", ""), |
447 Cmd("git status -s -b -uno", "## some_branch"), | 447 Cmd("git status -s -b -uno", "## some_branch"), |
448 Cmd("git fetch", ""), | 448 Cmd("git fetch", ""), |
449 Cmd("git svn fetch", ""), | |
450 Cmd("git branch", " branch1\n* %s" % TEST_CONFIG["BRANCHNAME"]), | 449 Cmd("git branch", " branch1\n* %s" % TEST_CONFIG["BRANCHNAME"]), |
451 RL("Y"), | 450 RL("Y"), |
452 Cmd("git branch -D %s" % TEST_CONFIG["BRANCHNAME"], ""), | 451 Cmd("git branch -D %s" % TEST_CONFIG["BRANCHNAME"], ""), |
453 ]) | 452 ]) |
454 self.MakeStep().CommonPrepare() | 453 self.MakeStep().CommonPrepare() |
455 self.MakeStep().PrepareBranch() | 454 self.MakeStep().PrepareBranch() |
456 self.assertEquals("some_branch", self._state["current_branch"]) | 455 self.assertEquals("some_branch", self._state["current_branch"]) |
457 | 456 |
458 def testCommonPrepareNoConfirm(self): | 457 def testCommonPrepareNoConfirm(self): |
459 self.Expect([ | 458 self.Expect([ |
460 Cmd("git status -s -uno", ""), | 459 Cmd("git status -s -uno", ""), |
461 Cmd("git status -s -b -uno", "## some_branch"), | 460 Cmd("git status -s -b -uno", "## some_branch"), |
462 Cmd("git fetch", ""), | 461 Cmd("git fetch", ""), |
463 Cmd("git svn fetch", ""), | |
464 Cmd("git branch", " branch1\n* %s" % TEST_CONFIG["BRANCHNAME"]), | 462 Cmd("git branch", " branch1\n* %s" % TEST_CONFIG["BRANCHNAME"]), |
465 RL("n"), | 463 RL("n"), |
466 ]) | 464 ]) |
467 self.MakeStep().CommonPrepare() | 465 self.MakeStep().CommonPrepare() |
468 self.assertRaises(Exception, self.MakeStep().PrepareBranch) | 466 self.assertRaises(Exception, self.MakeStep().PrepareBranch) |
469 self.assertEquals("some_branch", self._state["current_branch"]) | 467 self.assertEquals("some_branch", self._state["current_branch"]) |
470 | 468 |
471 def testCommonPrepareDeleteBranchFailure(self): | 469 def testCommonPrepareDeleteBranchFailure(self): |
472 self.Expect([ | 470 self.Expect([ |
473 Cmd("git status -s -uno", ""), | 471 Cmd("git status -s -uno", ""), |
474 Cmd("git status -s -b -uno", "## some_branch"), | 472 Cmd("git status -s -b -uno", "## some_branch"), |
475 Cmd("git fetch", ""), | 473 Cmd("git fetch", ""), |
476 Cmd("git svn fetch", ""), | |
477 Cmd("git branch", " branch1\n* %s" % TEST_CONFIG["BRANCHNAME"]), | 474 Cmd("git branch", " branch1\n* %s" % TEST_CONFIG["BRANCHNAME"]), |
478 RL("Y"), | 475 RL("Y"), |
479 Cmd("git branch -D %s" % TEST_CONFIG["BRANCHNAME"], None), | 476 Cmd("git branch -D %s" % TEST_CONFIG["BRANCHNAME"], None), |
480 ]) | 477 ]) |
481 self.MakeStep().CommonPrepare() | 478 self.MakeStep().CommonPrepare() |
482 self.assertRaises(Exception, self.MakeStep().PrepareBranch) | 479 self.assertRaises(Exception, self.MakeStep().PrepareBranch) |
483 self.assertEquals("some_branch", self._state["current_branch"]) | 480 self.assertEquals("some_branch", self._state["current_branch"]) |
484 | 481 |
485 def testInitialEnvironmentChecks(self): | 482 def testInitialEnvironmentChecks(self): |
486 TextToFile("", os.path.join(TEST_CONFIG["DEFAULT_CWD"], ".git")) | 483 TextToFile("", os.path.join(TEST_CONFIG["DEFAULT_CWD"], ".git")) |
487 os.environ["EDITOR"] = "vi" | 484 os.environ["EDITOR"] = "vi" |
488 self.Expect([ | 485 self.Expect([ |
489 Cmd("which vi", "/usr/bin/vi"), | 486 Cmd("which vi", "/usr/bin/vi"), |
490 ]) | 487 ]) |
491 self.MakeStep().InitialEnvironmentChecks(TEST_CONFIG["DEFAULT_CWD"]) | 488 self.MakeStep().InitialEnvironmentChecks(TEST_CONFIG["DEFAULT_CWD"]) |
492 | 489 |
493 def testTagTimeout(self): | 490 def testTagTimeout(self): |
494 self.Expect([ | 491 self.Expect([ |
495 Cmd("git fetch", ""), | 492 Cmd("git fetch", ""), |
496 Cmd("git log -1 --format=%H --grep=\"Title\" origin/candidates", ""), | 493 Cmd("git log -1 --format=%H --grep=\"Title\" origin/candidates", ""), |
497 Cmd("git fetch", ""), | 494 Cmd("git fetch", ""), |
498 Cmd("git log -1 --format=%H --grep=\"Title\" origin/candidates", ""), | 495 Cmd("git log -1 --format=%H --grep=\"Title\" origin/candidates", ""), |
499 Cmd("git fetch", ""), | 496 Cmd("git fetch", ""), |
500 Cmd("git log -1 --format=%H --grep=\"Title\" origin/candidates", ""), | 497 Cmd("git log -1 --format=%H --grep=\"Title\" origin/candidates", ""), |
501 Cmd("git fetch", ""), | 498 Cmd("git fetch", ""), |
502 Cmd("git log -1 --format=%H --grep=\"Title\" origin/candidates", ""), | 499 Cmd("git log -1 --format=%H --grep=\"Title\" origin/candidates", ""), |
503 ]) | 500 ]) |
504 args = ["--branch", "candidates", "--vc-interface", "git_read_svn_write", | 501 args = ["--branch", "candidates", "ab12345"] |
505 "ab12345"] | |
506 self._state["version"] = "tag_name" | 502 self._state["version"] = "tag_name" |
507 self._state["commit_title"] = "Title" | 503 self._state["commit_title"] = "Title" |
508 self.assertRaises(Exception, | 504 self.assertRaises(Exception, |
509 lambda: self.RunStep(MergeToBranch, TagRevision, args)) | 505 lambda: self.RunStep(MergeToBranch, TagRevision, args)) |
510 | 506 |
511 def testReadAndPersistVersion(self): | 507 def testReadAndPersistVersion(self): |
512 self.WriteFakeVersionFile(build=5) | 508 self.WriteFakeVersionFile(build=5) |
513 step = self.MakeStep() | 509 step = self.MakeStep() |
514 step.ReadAndPersistVersion() | 510 step.ReadAndPersistVersion() |
515 self.assertEquals("3", step["major"]) | 511 self.assertEquals("3", step["major"]) |
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
767 change_log) | 763 change_log) |
768 | 764 |
769 force_flag = " -f" if not manual else "" | 765 force_flag = " -f" if not manual else "" |
770 expectations = [] | 766 expectations = [] |
771 if not force: | 767 if not force: |
772 expectations.append(Cmd("which vi", "/usr/bin/vi")) | 768 expectations.append(Cmd("which vi", "/usr/bin/vi")) |
773 expectations += [ | 769 expectations += [ |
774 Cmd("git status -s -uno", ""), | 770 Cmd("git status -s -uno", ""), |
775 Cmd("git status -s -b -uno", "## some_branch\n"), | 771 Cmd("git status -s -b -uno", "## some_branch\n"), |
776 Cmd("git fetch", ""), | 772 Cmd("git fetch", ""), |
777 Cmd("git svn fetch", ""), | |
778 Cmd("git branch", " branch1\n* branch2\n"), | 773 Cmd("git branch", " branch1\n* branch2\n"), |
779 Cmd("git branch", " branch1\n* branch2\n"), | 774 Cmd("git branch", " branch1\n* branch2\n"), |
| 775 Cmd("git config --get remote.origin.push", ""), |
| 776 Cmd("git config --add remote.origin.push " |
| 777 "refs/remotes/origin/candidates:refs/pending/heads/candidates", ""), |
780 Cmd(("git new-branch %s --upstream origin/master" % | 778 Cmd(("git new-branch %s --upstream origin/master" % |
781 TEST_CONFIG["BRANCHNAME"]), | 779 TEST_CONFIG["BRANCHNAME"]), |
782 ""), | 780 ""), |
783 Cmd(("git log -1 --format=%H --grep=" | 781 Cmd(("git log -1 --format=%H --grep=" |
784 "\"^Version [[:digit:]]*\.[[:digit:]]*\.[[:digit:]]* (based\" " | 782 "\"^Version [[:digit:]]*\.[[:digit:]]*\.[[:digit:]]* (based\" " |
785 "origin/candidates"), "hash2\n"), | 783 "origin/candidates"), "hash2\n"), |
786 Cmd("git log -1 hash2", "Log message\n"), | 784 Cmd("git log -1 hash2", "Log message\n"), |
787 ] | 785 ] |
788 if manual: | 786 if manual: |
789 expectations.append(RL("Y")) # Confirm last push. | 787 expectations.append(RL("Y")) # Confirm last push. |
(...skipping 13 matching lines...) Expand all Loading... |
803 Cmd("git log -1 --format=%B rev1", "Text\nLOG=YES\nBUG=v8:321\nText\n"), | 801 Cmd("git log -1 --format=%B rev1", "Text\nLOG=YES\nBUG=v8:321\nText\n"), |
804 Cmd("git log -1 --format=%an rev1", "author1@chromium.org\n"), | 802 Cmd("git log -1 --format=%an rev1", "author1@chromium.org\n"), |
805 ] | 803 ] |
806 if manual: | 804 if manual: |
807 expectations.append(RL("")) # Open editor. | 805 expectations.append(RL("")) # Open editor. |
808 if not force: | 806 if not force: |
809 expectations.append( | 807 expectations.append( |
810 Cmd("vi %s" % TEST_CONFIG["CHANGELOG_ENTRY_FILE"], "")) | 808 Cmd("vi %s" % TEST_CONFIG["CHANGELOG_ENTRY_FILE"], "")) |
811 expectations += [ | 809 expectations += [ |
812 Cmd("git fetch", ""), | 810 Cmd("git fetch", ""), |
813 Cmd("git svn fetch", "fetch result\n"), | |
814 Cmd("git checkout -f origin/master", ""), | 811 Cmd("git checkout -f origin/master", ""), |
815 Cmd("git diff origin/candidates push_hash", "patch content\n"), | 812 Cmd("git diff origin/candidates push_hash", "patch content\n"), |
816 Cmd(("git new-branch %s --upstream origin/candidates" % | 813 Cmd(("git new-branch %s --upstream origin/candidates" % |
817 TEST_CONFIG["TRUNKBRANCH"]), "", cb=ResetToTrunk), | 814 TEST_CONFIG["TRUNKBRANCH"]), "", cb=ResetToTrunk), |
818 Cmd("git apply --index --reject \"%s\"" % TEST_CONFIG["PATCH_FILE"], ""), | 815 Cmd("git apply --index --reject \"%s\"" % TEST_CONFIG["PATCH_FILE"], ""), |
819 Cmd("git checkout -f origin/candidates -- ChangeLog", "", | 816 Cmd("git checkout -f origin/candidates -- ChangeLog", "", |
820 cb=ResetChangeLog), | 817 cb=ResetChangeLog), |
821 Cmd("git checkout -f origin/candidates -- src/version.cc", "", | 818 Cmd("git checkout -f origin/candidates -- src/version.cc", "", |
822 cb=self.WriteFakeVersionFile), | 819 cb=self.WriteFakeVersionFile), |
823 Cmd("git commit -aF \"%s\"" % TEST_CONFIG["COMMITMSG_FILE"], "", | 820 Cmd("git commit -aF \"%s\"" % TEST_CONFIG["COMMITMSG_FILE"], "", |
824 cb=CheckSVNCommit), | 821 cb=CheckSVNCommit), |
825 ] | 822 ] |
826 if manual: | 823 if manual: |
827 expectations.append(RL("Y")) # Sanity check. | 824 expectations.append(RL("Y")) # Sanity check. |
828 expectations += [ | 825 expectations += [ |
829 Cmd("git svn dcommit 2>&1", ""), | 826 Cmd("git push origin", ""), |
830 Cmd("git fetch", ""), | 827 Cmd("git fetch", ""), |
831 Cmd("git log -1 --format=%H --grep=" | 828 Cmd("git log -1 --format=%H --grep=" |
832 "\"Version 3.22.5 (based on push_hash)\"" | 829 "\"Version 3.22.5 (based on push_hash)\"" |
833 " origin/candidates", "hsh_to_tag"), | 830 " origin/candidates", "hsh_to_tag"), |
834 Cmd("git tag 3.22.5 hsh_to_tag", ""), | 831 Cmd("git tag 3.22.5 hsh_to_tag", ""), |
835 Cmd("git push origin 3.22.5", ""), | 832 Cmd("git push origin 3.22.5", ""), |
836 Cmd("git checkout -f some_branch", ""), | 833 Cmd("git checkout -f some_branch", ""), |
837 Cmd("git branch -D %s" % TEST_CONFIG["BRANCHNAME"], ""), | 834 Cmd("git branch -D %s" % TEST_CONFIG["BRANCHNAME"], ""), |
838 Cmd("git branch -D %s" % TEST_CONFIG["TRUNKBRANCH"], ""), | 835 Cmd("git branch -D %s" % TEST_CONFIG["TRUNKBRANCH"], ""), |
839 ] | 836 ] |
840 self.Expect(expectations) | 837 self.Expect(expectations) |
841 | 838 |
842 args = ["-a", "author@chromium.org", "--revision", "push_hash", | 839 args = ["-a", "author@chromium.org", "--revision", "push_hash"] |
843 "--vc-interface", "git_read_svn_write",] | |
844 if force: args.append("-f") | 840 if force: args.append("-f") |
845 if manual: args.append("-m") | 841 if manual: args.append("-m") |
846 else: args += ["-r", "reviewer@chromium.org"] | 842 else: args += ["-r", "reviewer@chromium.org"] |
847 PushToTrunk(TEST_CONFIG, self).Run(args) | 843 PushToTrunk(TEST_CONFIG, self).Run(args) |
848 | 844 |
849 cl = FileToText(os.path.join(TEST_CONFIG["DEFAULT_CWD"], CHANGELOG_FILE)) | 845 cl = FileToText(os.path.join(TEST_CONFIG["DEFAULT_CWD"], CHANGELOG_FILE)) |
850 self.assertTrue(re.search(r"^\d\d\d\d\-\d+\-\d+: Version 3\.22\.5", cl)) | 846 self.assertTrue(re.search(r"^\d\d\d\d\-\d+\-\d+: Version 3\.22\.5", cl)) |
851 self.assertTrue(re.search(r" Log text 1 \(issue 321\).", cl)) | 847 self.assertTrue(re.search(r" Log text 1 \(issue 321\).", cl)) |
852 self.assertTrue(re.search(r"1999\-04\-05: Version 3\.22\.4", cl)) | 848 self.assertTrue(re.search(r"1999\-04\-05: Version 3\.22\.4", cl)) |
853 | 849 |
854 # Note: The version file is on build number 5 again in the end of this test | 850 # Note: The version file is on build number 5 again in the end of this test |
855 # since the git command that merges to the bleeding edge branch is mocked | 851 # since the git command that merges to the bleeding edge branch is mocked |
856 # out. | 852 # out. |
857 | 853 |
858 def testPushToTrunkManual(self): | 854 def testPushToTrunkManual(self): |
859 self._PushToTrunk(manual=True) | 855 self._PushToTrunk(manual=True) |
860 | 856 |
861 def testPushToTrunkSemiAutomatic(self): | 857 def testPushToTrunkSemiAutomatic(self): |
862 self._PushToTrunk() | 858 self._PushToTrunk() |
863 | 859 |
864 def testPushToTrunkForced(self): | 860 def testPushToTrunkForced(self): |
865 self._PushToTrunk(force=True) | 861 self._PushToTrunk(force=True) |
866 | 862 |
867 def testPushToTrunkGit(self): | |
868 svn_root = self.MakeEmptyTempDirectory() | |
869 TextToFile("", os.path.join(TEST_CONFIG["DEFAULT_CWD"], ".git")) | |
870 | |
871 # The version file on bleeding edge has build level 5, while the version | |
872 # file from trunk has build level 4. | |
873 self.WriteFakeVersionFile(build=5) | |
874 | |
875 TEST_CONFIG["CHANGELOG_ENTRY_FILE"] = self.MakeEmptyTempFile() | |
876 bleeding_edge_change_log = "2014-03-17: Sentinel\n" | |
877 TextToFile(bleeding_edge_change_log, | |
878 os.path.join(TEST_CONFIG["DEFAULT_CWD"], CHANGELOG_FILE)) | |
879 | |
880 def ResetChangeLog(): | |
881 """On 'git co -b new_branch svn/trunk', and 'git checkout -- ChangeLog', | |
882 the ChangLog will be reset to its content on trunk.""" | |
883 trunk_change_log = """1999-04-05: Version 3.22.4 | |
884 | |
885 Performance and stability improvements on all platforms.\n""" | |
886 TextToFile(trunk_change_log, | |
887 os.path.join(TEST_CONFIG["DEFAULT_CWD"], CHANGELOG_FILE)) | |
888 | |
889 def ResetToTrunk(): | |
890 ResetChangeLog() | |
891 self.WriteFakeVersionFile() | |
892 | |
893 def CheckSVNCommit(): | |
894 commit = FileToText(TEST_CONFIG["COMMITMSG_FILE"]) | |
895 self.assertEquals( | |
896 """Version 3.22.5 (based on push_hash) | |
897 | |
898 Log text 1 (issue 321). | |
899 | |
900 Performance and stability improvements on all platforms.""", commit) | |
901 version = FileToText( | |
902 os.path.join(TEST_CONFIG["DEFAULT_CWD"], VERSION_FILE)) | |
903 self.assertTrue(re.search(r"#define MINOR_VERSION\s+22", version)) | |
904 self.assertTrue(re.search(r"#define BUILD_NUMBER\s+5", version)) | |
905 self.assertFalse(re.search(r"#define BUILD_NUMBER\s+6", version)) | |
906 self.assertTrue(re.search(r"#define PATCH_LEVEL\s+0", version)) | |
907 self.assertTrue(re.search(r"#define IS_CANDIDATE_VERSION\s+0", version)) | |
908 | |
909 # Check that the change log on the trunk branch got correctly modified. | |
910 change_log = FileToText( | |
911 os.path.join(TEST_CONFIG["DEFAULT_CWD"], CHANGELOG_FILE)) | |
912 self.assertEquals( | |
913 """1999-07-31: Version 3.22.5 | |
914 | |
915 Log text 1 (issue 321). | |
916 | |
917 Performance and stability improvements on all platforms. | |
918 | |
919 | |
920 1999-04-05: Version 3.22.4 | |
921 | |
922 Performance and stability improvements on all platforms.\n""", | |
923 change_log) | |
924 | |
925 expectations = [ | |
926 Cmd("git status -s -uno", ""), | |
927 Cmd("git status -s -b -uno", "## some_branch\n"), | |
928 Cmd("git fetch", ""), | |
929 Cmd("git branch", " branch1\n* branch2\n"), | |
930 Cmd("git branch", " branch1\n* branch2\n"), | |
931 Cmd(("git new-branch %s --upstream origin/master" % | |
932 TEST_CONFIG["BRANCHNAME"]), | |
933 ""), | |
934 Cmd(("git log -1 --format=%H --grep=" | |
935 "\"^Version [[:digit:]]*\.[[:digit:]]*\.[[:digit:]]* (based\" " | |
936 "origin/candidates"), "hash2\n"), | |
937 Cmd("git log -1 hash2", "Log message\n"), | |
938 Cmd("git log -1 --format=%s hash2", | |
939 "Version 3.4.5 (based on abc3)\n"), | |
940 Cmd("git checkout -f origin/master -- src/version.cc", | |
941 "", cb=self.WriteFakeVersionFile), | |
942 Cmd("git checkout -f hash2 -- src/version.cc", "", | |
943 cb=self.WriteFakeVersionFile), | |
944 Cmd("git log --format=%H abc3..push_hash", "rev1\n"), | |
945 Cmd("git log -1 --format=%s rev1", "Log text 1.\n"), | |
946 Cmd("git log -1 --format=%B rev1", "Text\nLOG=YES\nBUG=v8:321\nText\n"), | |
947 Cmd("git log -1 --format=%an rev1", "author1@chromium.org\n"), | |
948 Cmd("git fetch", ""), | |
949 Cmd("git checkout -f origin/master", ""), | |
950 Cmd("git diff origin/candidates push_hash", "patch content\n"), | |
951 Cmd(("git new-branch %s --upstream origin/candidates" % | |
952 TEST_CONFIG["TRUNKBRANCH"]), "", cb=ResetToTrunk), | |
953 Cmd("git apply --index --reject \"%s\"" % TEST_CONFIG["PATCH_FILE"], ""), | |
954 Cmd("git checkout -f origin/candidates -- ChangeLog", "", | |
955 cb=ResetChangeLog), | |
956 Cmd("git checkout -f origin/candidates -- src/version.cc", "", | |
957 cb=self.WriteFakeVersionFile), | |
958 Cmd("git commit -aF \"%s\"" % TEST_CONFIG["COMMITMSG_FILE"], "", | |
959 cb=CheckSVNCommit), | |
960 # TODO(machenbach): Change test to pure git after flag day. | |
961 # Cmd("git push origin", ""), | |
962 Cmd("git diff HEAD^ HEAD", "patch content"), | |
963 Cmd("svn update", "", cwd=svn_root), | |
964 Cmd("svn status", "", cwd=svn_root), | |
965 Cmd("patch -d trunk -p1 -i %s" % | |
966 TEST_CONFIG["PATCH_FILE"], "Applied patch...", cwd=svn_root), | |
967 Cmd("svn status", "M OWNERS\n? new_file\n! AUTHORS", | |
968 cwd=svn_root), | |
969 Cmd("svn add --force new_file", "", cwd=svn_root), | |
970 Cmd("svn delete --force AUTHORS", "", cwd=svn_root), | |
971 Cmd("svn commit --non-interactive --username=author@chromium.org " | |
972 "--config-dir=[CONFIG_DIR] " | |
973 "-m \"Version 3.22.5 (based on push_hash)\"", | |
974 "", cwd=svn_root), | |
975 Cmd("git fetch", ""), | |
976 Cmd("git log -1 --format=%H --grep=" | |
977 "\"Version 3.22.5 (based on push_hash)\"" | |
978 " origin/candidates", "hsh_to_tag"), | |
979 Cmd("git tag 3.22.5 hsh_to_tag", ""), | |
980 Cmd("git push https://chromium.googlesource.com/v8/v8 3.22.5", ""), | |
981 Cmd("git checkout -f some_branch", ""), | |
982 Cmd("git branch -D %s" % TEST_CONFIG["BRANCHNAME"], ""), | |
983 Cmd("git branch -D %s" % TEST_CONFIG["TRUNKBRANCH"], ""), | |
984 ] | |
985 self.Expect(expectations) | |
986 | |
987 args = ["-a", "author@chromium.org", "--revision", "push_hash", | |
988 "--vc-interface", "git", "-f", "-r", "reviewer@chromium.org", | |
989 "--svn", svn_root, "--svn-config", "[CONFIG_DIR]", | |
990 "--work-dir", TEST_CONFIG["DEFAULT_CWD"]] | |
991 PushToTrunk(TEST_CONFIG, self).Run(args) | |
992 | |
993 cl = FileToText(os.path.join(TEST_CONFIG["DEFAULT_CWD"], CHANGELOG_FILE)) | |
994 self.assertTrue(re.search(r"^\d\d\d\d\-\d+\-\d+: Version 3\.22\.5", cl)) | |
995 self.assertTrue(re.search(r" Log text 1 \(issue 321\).", cl)) | |
996 self.assertTrue(re.search(r"1999\-04\-05: Version 3\.22\.4", cl)) | |
997 | |
998 # Note: The version file is on build number 5 again in the end of this test | |
999 # since the git command that merges to the bleeding edge branch is mocked | |
1000 # out. | |
1001 | |
1002 C_V8_22624_LOG = """V8 CL. | 863 C_V8_22624_LOG = """V8 CL. |
1003 | 864 |
1004 git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@22624 123 | 865 git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@22624 123 |
1005 | 866 |
1006 """ | 867 """ |
1007 | 868 |
1008 C_V8_123455_LOG = """V8 CL. | 869 C_V8_123455_LOG = """V8 CL. |
1009 | 870 |
1010 git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@123455 123 | 871 git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@123455 123 |
1011 | 872 |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1099 "{\"message\": \"Tree is throttled\"}"), | 960 "{\"message\": \"Tree is throttled\"}"), |
1100 URL("https://v8-status.appspot.com/lkgr", Exception("Network problem")), | 961 URL("https://v8-status.appspot.com/lkgr", Exception("Network problem")), |
1101 URL("https://v8-status.appspot.com/lkgr", "abc123"), | 962 URL("https://v8-status.appspot.com/lkgr", "abc123"), |
1102 Cmd(("git log -1 --format=%H --grep=\"" | 963 Cmd(("git log -1 --format=%H --grep=\"" |
1103 "^Version [[:digit:]]*\.[[:digit:]]*\.[[:digit:]]* (based\"" | 964 "^Version [[:digit:]]*\.[[:digit:]]*\.[[:digit:]]* (based\"" |
1104 " origin/candidates"), "push_hash\n"), | 965 " origin/candidates"), "push_hash\n"), |
1105 Cmd("git log -1 --format=%s push_hash", | 966 Cmd("git log -1 --format=%s push_hash", |
1106 "Version 3.4.5 (based on abc101)\n"), | 967 "Version 3.4.5 (based on abc101)\n"), |
1107 ]) | 968 ]) |
1108 | 969 |
1109 auto_push.AutoPush(TEST_CONFIG, self).Run( | 970 auto_push.AutoPush(TEST_CONFIG, self).Run(AUTO_PUSH_ARGS + ["--push"]) |
1110 AUTO_PUSH_ARGS + ["--push", "--vc-interface", "git"]) | |
1111 | 971 |
1112 state = json.loads(FileToText("%s-state.json" | 972 state = json.loads(FileToText("%s-state.json" |
1113 % TEST_CONFIG["PERSISTFILE_BASENAME"])) | 973 % TEST_CONFIG["PERSISTFILE_BASENAME"])) |
1114 | 974 |
1115 self.assertEquals("abc123", state["lkgr"]) | 975 self.assertEquals("abc123", state["lkgr"]) |
1116 | 976 |
1117 def testAutoPushStoppedBySettings(self): | 977 def testAutoPushStoppedBySettings(self): |
1118 TextToFile("", os.path.join(TEST_CONFIG["DEFAULT_CWD"], ".git")) | 978 TextToFile("", os.path.join(TEST_CONFIG["DEFAULT_CWD"], ".git")) |
1119 TEST_CONFIG["SETTINGS_LOCATION"] = self.MakeEmptyTempFile() | 979 TEST_CONFIG["SETTINGS_LOCATION"] = self.MakeEmptyTempFile() |
1120 TextToFile("{\"enable_auto_push\": false}", | 980 TextToFile("{\"enable_auto_push\": false}", |
1121 TEST_CONFIG["SETTINGS_LOCATION"]) | 981 TEST_CONFIG["SETTINGS_LOCATION"]) |
1122 | 982 |
1123 self.Expect([ | 983 self.Expect([ |
1124 Cmd("git status -s -uno", ""), | 984 Cmd("git status -s -uno", ""), |
1125 Cmd("git status -s -b -uno", "## some_branch\n"), | 985 Cmd("git status -s -b -uno", "## some_branch\n"), |
1126 Cmd("git fetch", ""), | 986 Cmd("git fetch", ""), |
1127 Cmd("git svn fetch", ""), | |
1128 ]) | 987 ]) |
1129 | 988 |
1130 def RunAutoPush(): | 989 def RunAutoPush(): |
1131 auto_push.AutoPush(TEST_CONFIG, self).Run(AUTO_PUSH_ARGS) | 990 auto_push.AutoPush(TEST_CONFIG, self).Run(AUTO_PUSH_ARGS) |
1132 self.assertRaises(Exception, RunAutoPush) | 991 self.assertRaises(Exception, RunAutoPush) |
1133 | 992 |
1134 def testAutoPushStoppedByTreeStatus(self): | 993 def testAutoPushStoppedByTreeStatus(self): |
1135 TextToFile("", os.path.join(TEST_CONFIG["DEFAULT_CWD"], ".git")) | 994 TextToFile("", os.path.join(TEST_CONFIG["DEFAULT_CWD"], ".git")) |
1136 TEST_CONFIG["SETTINGS_LOCATION"] = "~/.doesnotexist" | 995 TEST_CONFIG["SETTINGS_LOCATION"] = "~/.doesnotexist" |
1137 | 996 |
1138 self.Expect([ | 997 self.Expect([ |
1139 Cmd("git status -s -uno", ""), | 998 Cmd("git status -s -uno", ""), |
1140 Cmd("git status -s -b -uno", "## some_branch\n"), | 999 Cmd("git status -s -b -uno", "## some_branch\n"), |
1141 Cmd("git fetch", ""), | 1000 Cmd("git fetch", ""), |
1142 Cmd("git svn fetch", ""), | |
1143 URL("https://v8-status.appspot.com/current?format=json", | 1001 URL("https://v8-status.appspot.com/current?format=json", |
1144 "{\"message\": \"Tree is throttled (no push)\"}"), | 1002 "{\"message\": \"Tree is throttled (no push)\"}"), |
1145 ]) | 1003 ]) |
1146 | 1004 |
1147 def RunAutoPush(): | 1005 def RunAutoPush(): |
1148 auto_push.AutoPush(TEST_CONFIG, self).Run(AUTO_PUSH_ARGS) | 1006 auto_push.AutoPush(TEST_CONFIG, self).Run(AUTO_PUSH_ARGS) |
1149 self.assertRaises(Exception, RunAutoPush) | 1007 self.assertRaises(Exception, RunAutoPush) |
1150 | 1008 |
1151 def testAutoRollExistingRoll(self): | 1009 def testAutoRollExistingRoll(self): |
1152 self.Expect([ | 1010 self.Expect([ |
(...skipping 20 matching lines...) Expand all Loading... |
1173 """ | 1031 """ |
1174 | 1032 |
1175 def testAutoRollUpToDate(self): | 1033 def testAutoRollUpToDate(self): |
1176 TEST_CONFIG["CHROMIUM"] = self.MakeEmptyTempDirectory() | 1034 TEST_CONFIG["CHROMIUM"] = self.MakeEmptyTempDirectory() |
1177 TextToFile(self.FAKE_DEPS, os.path.join(TEST_CONFIG["CHROMIUM"], "DEPS")) | 1035 TextToFile(self.FAKE_DEPS, os.path.join(TEST_CONFIG["CHROMIUM"], "DEPS")) |
1178 self.Expect([ | 1036 self.Expect([ |
1179 URL("https://codereview.chromium.org/search", | 1037 URL("https://codereview.chromium.org/search", |
1180 "owner=author%40chromium.org&limit=30&closed=3&format=json", | 1038 "owner=author%40chromium.org&limit=30&closed=3&format=json", |
1181 ("{\"results\": [{\"subject\": \"different\"}]}")), | 1039 ("{\"results\": [{\"subject\": \"different\"}]}")), |
1182 Cmd("git fetch", ""), | 1040 Cmd("git fetch", ""), |
1183 Cmd("git svn fetch", ""), | |
1184 Cmd(("git log -1 --format=%H --grep=" | 1041 Cmd(("git log -1 --format=%H --grep=" |
1185 "\"^Version [[:digit:]]*\.[[:digit:]]*\.[[:digit:]]*\" " | 1042 "\"^Version [[:digit:]]*\.[[:digit:]]*\.[[:digit:]]*\" " |
1186 "origin/candidates"), "push_hash\n"), | 1043 "origin/candidates"), "push_hash\n"), |
1187 Cmd("git log -1 --format=%B push_hash", self.C_V8_22624_LOG), | 1044 Cmd("git log -1 --format=%B push_hash", self.C_V8_22624_LOG), |
1188 Cmd("git log -1 --format=%B abcd123455", self.C_V8_123455_LOG), | 1045 Cmd("git log -1 --format=%B abcd123455", self.C_V8_123455_LOG), |
1189 ]) | 1046 ]) |
1190 | 1047 |
1191 result = auto_roll.AutoRoll(TEST_CONFIG, self).Run( | 1048 result = auto_roll.AutoRoll(TEST_CONFIG, self).Run( |
1192 AUTO_PUSH_ARGS + ["-c", TEST_CONFIG["CHROMIUM"]]) | 1049 AUTO_PUSH_ARGS + ["-c", TEST_CONFIG["CHROMIUM"]]) |
1193 self.assertEquals(0, result) | 1050 self.assertEquals(0, result) |
1194 | 1051 |
1195 def testAutoRoll(self): | 1052 def testAutoRoll(self): |
1196 TEST_CONFIG["CHROMIUM"] = self.MakeEmptyTempDirectory() | 1053 TEST_CONFIG["CHROMIUM"] = self.MakeEmptyTempDirectory() |
1197 TextToFile(self.FAKE_DEPS, os.path.join(TEST_CONFIG["CHROMIUM"], "DEPS")) | 1054 TextToFile(self.FAKE_DEPS, os.path.join(TEST_CONFIG["CHROMIUM"], "DEPS")) |
1198 TEST_CONFIG["CLUSTERFUZZ_API_KEY_FILE"] = self.MakeEmptyTempFile() | 1055 TEST_CONFIG["CLUSTERFUZZ_API_KEY_FILE"] = self.MakeEmptyTempFile() |
1199 TextToFile("fake key", TEST_CONFIG["CLUSTERFUZZ_API_KEY_FILE"]) | 1056 TextToFile("fake key", TEST_CONFIG["CLUSTERFUZZ_API_KEY_FILE"]) |
1200 | 1057 |
1201 self.Expect([ | 1058 self.Expect([ |
1202 URL("https://codereview.chromium.org/search", | 1059 URL("https://codereview.chromium.org/search", |
1203 "owner=author%40chromium.org&limit=30&closed=3&format=json", | 1060 "owner=author%40chromium.org&limit=30&closed=3&format=json", |
1204 ("{\"results\": [{\"subject\": \"different\"}]}")), | 1061 ("{\"results\": [{\"subject\": \"different\"}]}")), |
1205 Cmd("git fetch", ""), | 1062 Cmd("git fetch", ""), |
1206 Cmd("git svn fetch", ""), | |
1207 Cmd(("git log -1 --format=%H --grep=" | 1063 Cmd(("git log -1 --format=%H --grep=" |
1208 "\"^Version [[:digit:]]*\.[[:digit:]]*\.[[:digit:]]*\" " | 1064 "\"^Version [[:digit:]]*\.[[:digit:]]*\.[[:digit:]]*\" " |
1209 "origin/candidates"), "push_hash\n"), | 1065 "origin/candidates"), "push_hash\n"), |
1210 Cmd("git log -1 --format=%B push_hash", self.C_V8_123456_LOG), | 1066 Cmd("git log -1 --format=%B push_hash", self.C_V8_123456_LOG), |
1211 Cmd("git log -1 --format=%B abcd123455", self.C_V8_123455_LOG), | 1067 Cmd("git log -1 --format=%B abcd123455", self.C_V8_123455_LOG), |
1212 ]) | 1068 ]) |
1213 | 1069 |
1214 result = auto_roll.AutoRoll(TEST_CONFIG, self).Run( | 1070 result = auto_roll.AutoRoll(TEST_CONFIG, self).Run( |
1215 AUTO_PUSH_ARGS + ["-c", TEST_CONFIG["CHROMIUM"], "--roll"]) | 1071 AUTO_PUSH_ARGS + ["-c", TEST_CONFIG["CHROMIUM"], "--roll"]) |
1216 self.assertEquals(0, result) | 1072 self.assertEquals(0, result) |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1255 os.path.join(TEST_CONFIG["DEFAULT_CWD"], VERSION_FILE)) | 1111 os.path.join(TEST_CONFIG["DEFAULT_CWD"], VERSION_FILE)) |
1256 self.assertTrue(re.search(r"#define MINOR_VERSION\s+22", version)) | 1112 self.assertTrue(re.search(r"#define MINOR_VERSION\s+22", version)) |
1257 self.assertTrue(re.search(r"#define BUILD_NUMBER\s+5", version)) | 1113 self.assertTrue(re.search(r"#define BUILD_NUMBER\s+5", version)) |
1258 self.assertTrue(re.search(r"#define PATCH_LEVEL\s+1", version)) | 1114 self.assertTrue(re.search(r"#define PATCH_LEVEL\s+1", version)) |
1259 self.assertTrue(re.search(r"#define IS_CANDIDATE_VERSION\s+0", version)) | 1115 self.assertTrue(re.search(r"#define IS_CANDIDATE_VERSION\s+0", version)) |
1260 | 1116 |
1261 self.Expect([ | 1117 self.Expect([ |
1262 Cmd("git status -s -uno", ""), | 1118 Cmd("git status -s -uno", ""), |
1263 Cmd("git status -s -b -uno", "## some_branch\n"), | 1119 Cmd("git status -s -b -uno", "## some_branch\n"), |
1264 Cmd("git fetch", ""), | 1120 Cmd("git fetch", ""), |
1265 Cmd("git svn fetch", ""), | |
1266 Cmd("git branch", " branch1\n* branch2\n"), | 1121 Cmd("git branch", " branch1\n* branch2\n"), |
1267 Cmd("git new-branch %s --upstream origin/candidates" % | 1122 Cmd("git new-branch %s --upstream origin/candidates" % |
1268 TEST_CONFIG["BRANCHNAME"], ""), | 1123 TEST_CONFIG["BRANCHNAME"], ""), |
1269 Cmd(("git log --format=%H --grep=\"Port ab12345\" " | 1124 Cmd(("git log --format=%H --grep=\"Port ab12345\" " |
1270 "--reverse origin/master"), | 1125 "--reverse origin/master"), |
1271 "ab45678\nab23456"), | 1126 "ab45678\nab23456"), |
1272 Cmd("git log -1 --format=%s ab45678", "Title1"), | 1127 Cmd("git log -1 --format=%s ab45678", "Title1"), |
1273 Cmd("git log -1 --format=%s ab23456", "Title2"), | 1128 Cmd("git log -1 --format=%s ab23456", "Title2"), |
1274 Cmd(("git log --format=%H --grep=\"Port ab23456\" " | 1129 Cmd(("git log --format=%H --grep=\"Port ab23456\" " |
1275 "--reverse origin/master"), | 1130 "--reverse origin/master"), |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1314 "", cb=VerifyPatch("patch5\n")), | 1169 "", cb=VerifyPatch("patch5\n")), |
1315 Cmd("git apply --index --reject \"%s\"" % extra_patch, ""), | 1170 Cmd("git apply --index --reject \"%s\"" % extra_patch, ""), |
1316 RL("Y"), # Automatically increment patch level? | 1171 RL("Y"), # Automatically increment patch level? |
1317 Cmd("git commit -aF \"%s\"" % TEST_CONFIG["COMMITMSG_FILE"], ""), | 1172 Cmd("git commit -aF \"%s\"" % TEST_CONFIG["COMMITMSG_FILE"], ""), |
1318 RL("reviewer@chromium.org"), # V8 reviewer. | 1173 RL("reviewer@chromium.org"), # V8 reviewer. |
1319 Cmd("git cl upload --send-mail -r \"reviewer@chromium.org\" " | 1174 Cmd("git cl upload --send-mail -r \"reviewer@chromium.org\" " |
1320 "--bypass-hooks --cc \"ulan@chromium.org\"", ""), | 1175 "--bypass-hooks --cc \"ulan@chromium.org\"", ""), |
1321 Cmd("git checkout -f %s" % TEST_CONFIG["BRANCHNAME"], ""), | 1176 Cmd("git checkout -f %s" % TEST_CONFIG["BRANCHNAME"], ""), |
1322 RL("LGTM"), # Enter LGTM for V8 CL. | 1177 RL("LGTM"), # Enter LGTM for V8 CL. |
1323 Cmd("git cl presubmit", "Presubmit successfull\n"), | 1178 Cmd("git cl presubmit", "Presubmit successfull\n"), |
1324 Cmd("git cl dcommit -f --bypass-hooks", "Closing issue\n", | 1179 Cmd("git cl land -f --bypass-hooks", "Closing issue\n", |
1325 cb=VerifySVNCommit), | 1180 cb=VerifySVNCommit), |
1326 Cmd("git fetch", ""), | 1181 Cmd("git fetch", ""), |
1327 Cmd("git log -1 --format=%H --grep=\"" | 1182 Cmd("git log -1 --format=%H --grep=\"" |
1328 "Version 3.22.5.1 (cherry-pick)" | 1183 "Version 3.22.5.1 (cherry-pick)" |
1329 "\" origin/candidates", | 1184 "\" origin/candidates", |
1330 ""), | 1185 ""), |
1331 Cmd("git fetch", ""), | 1186 Cmd("git fetch", ""), |
1332 Cmd("git log -1 --format=%H --grep=\"" | 1187 Cmd("git log -1 --format=%H --grep=\"" |
1333 "Version 3.22.5.1 (cherry-pick)" | 1188 "Version 3.22.5.1 (cherry-pick)" |
1334 "\" origin/candidates", | 1189 "\" origin/candidates", |
(...skipping 11 matching lines...) Expand all Loading... |
1346 | 1201 |
1347 # The first run of the script stops because of git being down. | 1202 # The first run of the script stops because of git being down. |
1348 self.assertRaises(GitFailedException, | 1203 self.assertRaises(GitFailedException, |
1349 lambda: MergeToBranch(TEST_CONFIG, self).Run(args)) | 1204 lambda: MergeToBranch(TEST_CONFIG, self).Run(args)) |
1350 | 1205 |
1351 # Test that state recovery after restarting the script works. | 1206 # Test that state recovery after restarting the script works. |
1352 args += ["-s", "4"] | 1207 args += ["-s", "4"] |
1353 MergeToBranch(TEST_CONFIG, self).Run(args) | 1208 MergeToBranch(TEST_CONFIG, self).Run(args) |
1354 | 1209 |
1355 def testReleases(self): | 1210 def testReleases(self): |
1356 tag_response_text = """ | |
1357 ------------------------------------------------------------------------ | |
1358 r22631 | author1@chromium.org | 2014-07-28 02:05:29 +0200 (Mon, 28 Jul 2014) | |
1359 Changed paths: | |
1360 A /tags/3.28.43 (from /trunk:22630) | |
1361 | |
1362 Tagging version 3.28.43 | |
1363 ------------------------------------------------------------------------ | |
1364 r22629 | author2@chromium.org | 2014-07-26 05:09:29 +0200 (Sat, 26 Jul 2014) | |
1365 Changed paths: | |
1366 A /tags/3.28.41 (from /branches/bleeding_edge:22626) | |
1367 | |
1368 Tagging version 3.28.41 | |
1369 ------------------------------------------------------------------------ | |
1370 r22556 | author3@chromium.org | 2014-07-23 13:31:59 +0200 (Wed, 23 Jul 2014) | |
1371 Changed paths: | |
1372 A /tags/3.27.34.7 (from /branches/3.27:22555) | |
1373 | |
1374 Tagging version 3.27.34.7 | |
1375 ------------------------------------------------------------------------ | |
1376 r22627 | author4@chromium.org | 2014-07-26 01:39:15 +0200 (Sat, 26 Jul 2014) | |
1377 Changed paths: | |
1378 A /tags/3.28.40 (from /branches/bleeding_edge:22624) | |
1379 | |
1380 Tagging version 3.28.40 | |
1381 ------------------------------------------------------------------------ | |
1382 """ | |
1383 c_hash2_commit_log = """Revert something. | 1211 c_hash2_commit_log = """Revert something. |
1384 | 1212 |
1385 BUG=12345 | 1213 BUG=12345 |
1386 | 1214 |
1387 Reason: | 1215 Reason: |
1388 > Some reason. | 1216 > Some reason. |
1389 > Cr-Commit-Position: refs/heads/master@{#12345} | 1217 > Cr-Commit-Position: refs/heads/master@{#12345} |
1390 > git-svn-id: svn://svn.chromium.org/chrome/trunk/src@12345 003-1c4 | 1218 > git-svn-id: svn://svn.chromium.org/chrome/trunk/src@12345 003-1c4 |
1391 | 1219 |
1392 Review URL: https://codereview.chromium.org/12345 | 1220 Review URL: https://codereview.chromium.org/12345 |
1393 | 1221 |
1394 Cr-Commit-Position: refs/heads/master@{#4567} | 1222 Cr-Commit-Position: refs/heads/master@{#4567} |
1395 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@4567 0039-1c4b | 1223 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@4567 0039-1c4b |
1396 | 1224 |
1397 """ | 1225 """ |
1398 c_hash3_commit_log = """Simple. | 1226 c_hash3_commit_log = """Simple. |
1399 | 1227 |
1400 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@3456 0039-1c4b | 1228 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@3456 0039-1c4b |
1401 | 1229 |
1402 """ | 1230 """ |
| 1231 c_hash_234_commit_log = """Version 3.3.1.1 (cherry-pick). |
| 1232 |
| 1233 Merged abc12. |
| 1234 |
| 1235 Review URL: fake.com |
| 1236 |
| 1237 Cr-Commit-Position: refs/heads/candidates@{#234} |
| 1238 """ |
| 1239 c_hash_123_commit_log = """Version 3.3.1.0 |
| 1240 |
| 1241 git-svn-id: googlecode@123 0039-1c4b |
| 1242 """ |
| 1243 c_hash_345_commit_log = """Version 3.4.0. |
| 1244 |
| 1245 Cr-Commit-Position: refs/heads/candidates@{#345} |
| 1246 """ |
| 1247 |
1403 json_output = self.MakeEmptyTempFile() | 1248 json_output = self.MakeEmptyTempFile() |
1404 csv_output = self.MakeEmptyTempFile() | 1249 csv_output = self.MakeEmptyTempFile() |
1405 self.WriteFakeVersionFile() | 1250 self.WriteFakeVersionFile() |
1406 | 1251 |
1407 TEST_CONFIG["CHROMIUM"] = self.MakeEmptyTempDirectory() | 1252 TEST_CONFIG["CHROMIUM"] = self.MakeEmptyTempDirectory() |
1408 chrome_dir = TEST_CONFIG["CHROMIUM"] | 1253 chrome_dir = TEST_CONFIG["CHROMIUM"] |
1409 chrome_v8_dir = os.path.join(chrome_dir, "v8") | 1254 chrome_v8_dir = os.path.join(chrome_dir, "v8") |
1410 os.makedirs(chrome_v8_dir) | 1255 os.makedirs(chrome_v8_dir) |
1411 def WriteDEPS(revision): | 1256 def WriteDEPS(revision): |
1412 TextToFile("Line\n \"v8_revision\": \"%s\",\n line\n" % revision, | 1257 TextToFile("Line\n \"v8_revision\": \"%s\",\n line\n" % revision, |
1413 os.path.join(chrome_dir, "DEPS")) | 1258 os.path.join(chrome_dir, "DEPS")) |
1414 WriteDEPS(567) | 1259 WriteDEPS(567) |
1415 | 1260 |
1416 def ResetVersion(minor, build, patch=0): | 1261 def ResetVersion(minor, build, patch=0): |
1417 return lambda: self.WriteFakeVersionFile(minor=minor, | 1262 return lambda: self.WriteFakeVersionFile(minor=minor, |
1418 build=build, | 1263 build=build, |
1419 patch=patch) | 1264 patch=patch) |
1420 | 1265 |
1421 def ResetDEPS(revision): | 1266 def ResetDEPS(revision): |
1422 return lambda: WriteDEPS(revision) | 1267 return lambda: WriteDEPS(revision) |
1423 | 1268 |
1424 self.Expect([ | 1269 self.Expect([ |
1425 Cmd("git status -s -uno", ""), | 1270 Cmd("git status -s -uno", ""), |
1426 Cmd("git status -s -b -uno", "## some_branch\n"), | 1271 Cmd("git status -s -b -uno", "## some_branch\n"), |
1427 Cmd("git fetch", ""), | 1272 Cmd("git fetch", ""), |
1428 Cmd("git svn fetch", ""), | |
1429 Cmd("git branch", " branch1\n* branch2\n"), | 1273 Cmd("git branch", " branch1\n* branch2\n"), |
1430 Cmd("git new-branch %s" % TEST_CONFIG["BRANCHNAME"], ""), | 1274 Cmd("git new-branch %s" % TEST_CONFIG["BRANCHNAME"], ""), |
1431 Cmd("git branch -r", " branch-heads/3.21\n branch-heads/3.3\n"), | 1275 Cmd("git branch -r", " branch-heads/3.21\n branch-heads/3.3\n"), |
1432 Cmd("git reset --hard branch-heads/3.3", ""), | 1276 Cmd("git reset --hard branch-heads/3.3", ""), |
1433 Cmd("git log --format=%H", "hash1\nhash_234"), | 1277 Cmd("git log --format=%H", "hash1\nhash_234"), |
1434 Cmd("git diff --name-only hash1 hash1^", ""), | 1278 Cmd("git diff --name-only hash1 hash1^", ""), |
1435 Cmd("git diff --name-only hash_234 hash_234^", VERSION_FILE), | 1279 Cmd("git diff --name-only hash_234 hash_234^", VERSION_FILE), |
1436 Cmd("git checkout -f hash_234 -- %s" % VERSION_FILE, "", | 1280 Cmd("git checkout -f hash_234 -- %s" % VERSION_FILE, "", |
1437 cb=ResetVersion(3, 1, 1)), | 1281 cb=ResetVersion(3, 1, 1)), |
1438 Cmd("git log -1 --format=%B hash_234", | 1282 Cmd("git log -1 --format=%B hash_234", c_hash_234_commit_log), |
1439 "Version 3.3.1.1 (cherry-pick).\n\n" | |
1440 "Merged abc12.\n\n" | |
1441 "Review URL: fake.com\n"), | |
1442 Cmd("git log -1 --format=%s hash_234", ""), | 1283 Cmd("git log -1 --format=%s hash_234", ""), |
1443 Cmd("git svn find-rev hash_234", "234"), | 1284 Cmd("git log -1 --format=%B hash_234", c_hash_234_commit_log), |
1444 Cmd("git log -1 --format=%ci hash_234", "18:15"), | 1285 Cmd("git log -1 --format=%ci hash_234", "18:15"), |
1445 Cmd("git checkout -f HEAD -- %s" % VERSION_FILE, "", | 1286 Cmd("git checkout -f HEAD -- %s" % VERSION_FILE, "", |
1446 cb=ResetVersion(22, 5)), | 1287 cb=ResetVersion(22, 5)), |
1447 Cmd("git reset --hard branch-heads/3.21", ""), | 1288 Cmd("git reset --hard branch-heads/3.21", ""), |
1448 Cmd("git log --format=%H", "hash_123\nhash4\nhash5\n"), | 1289 Cmd("git log --format=%H", "hash_123\nhash4\nhash5\n"), |
1449 Cmd("git diff --name-only hash_123 hash_123^", VERSION_FILE), | 1290 Cmd("git diff --name-only hash_123 hash_123^", VERSION_FILE), |
1450 Cmd("git checkout -f hash_123 -- %s" % VERSION_FILE, "", | 1291 Cmd("git checkout -f hash_123 -- %s" % VERSION_FILE, "", |
1451 cb=ResetVersion(21, 2)), | 1292 cb=ResetVersion(21, 2)), |
1452 Cmd("git log -1 --format=%B hash_123", ""), | 1293 Cmd("git log -1 --format=%B hash_123", c_hash_123_commit_log), |
1453 Cmd("git log -1 --format=%s hash_123", ""), | 1294 Cmd("git log -1 --format=%s hash_123", ""), |
1454 Cmd("git svn find-rev hash_123", "123"), | 1295 Cmd("git log -1 --format=%B hash_123", c_hash_123_commit_log), |
1455 Cmd("git log -1 --format=%ci hash_123", "03:15"), | 1296 Cmd("git log -1 --format=%ci hash_123", "03:15"), |
1456 Cmd("git checkout -f HEAD -- %s" % VERSION_FILE, "", | 1297 Cmd("git checkout -f HEAD -- %s" % VERSION_FILE, "", |
1457 cb=ResetVersion(22, 5)), | 1298 cb=ResetVersion(22, 5)), |
1458 Cmd("git reset --hard origin/candidates", ""), | 1299 Cmd("git reset --hard origin/candidates", ""), |
1459 Cmd("git log --format=%H", "hash_345\n"), | 1300 Cmd("git log --format=%H", "hash_345\n"), |
1460 Cmd("git diff --name-only hash_345 hash_345^", VERSION_FILE), | 1301 Cmd("git diff --name-only hash_345 hash_345^", VERSION_FILE), |
1461 Cmd("git checkout -f hash_345 -- %s" % VERSION_FILE, "", | 1302 Cmd("git checkout -f hash_345 -- %s" % VERSION_FILE, "", |
1462 cb=ResetVersion(22, 3)), | 1303 cb=ResetVersion(22, 3)), |
1463 Cmd("git log -1 --format=%B hash_345", ""), | 1304 Cmd("git log -1 --format=%B hash_345", c_hash_345_commit_log), |
1464 Cmd("git log -1 --format=%s hash_345", ""), | 1305 Cmd("git log -1 --format=%s hash_345", ""), |
1465 Cmd("git svn find-rev hash_345", "345"), | 1306 Cmd("git log -1 --format=%B hash_345", c_hash_345_commit_log), |
1466 Cmd("git log -1 --format=%ci hash_345", ""), | 1307 Cmd("git log -1 --format=%ci hash_345", ""), |
1467 Cmd("git checkout -f HEAD -- %s" % VERSION_FILE, "", | 1308 Cmd("git checkout -f HEAD -- %s" % VERSION_FILE, "", |
1468 cb=ResetVersion(22, 5)), | 1309 cb=ResetVersion(22, 5)), |
1469 Cmd("git reset --hard origin/master", ""), | 1310 Cmd("git reset --hard origin/master", ""), |
1470 Cmd("svn log https://v8.googlecode.com/svn/tags -v --limit 20", | |
1471 tag_response_text), | |
1472 Cmd("git svn find-rev r22626", "hash_22626"), | |
1473 Cmd("git svn find-rev hash_22626", "22626"), | |
1474 Cmd("git log -1 --format=%ci hash_22626", "01:23"), | |
1475 Cmd("git svn find-rev r22624", "hash_22624"), | |
1476 Cmd("git svn find-rev hash_22624", "22624"), | |
1477 Cmd("git log -1 --format=%ci hash_22624", "02:34"), | |
1478 Cmd("git status -s -uno", "", cwd=chrome_dir), | 1311 Cmd("git status -s -uno", "", cwd=chrome_dir), |
1479 Cmd("git checkout -f master", "", cwd=chrome_dir), | 1312 Cmd("git checkout -f master", "", cwd=chrome_dir), |
1480 Cmd("git pull", "", cwd=chrome_dir), | 1313 Cmd("git pull", "", cwd=chrome_dir), |
1481 Cmd("git new-branch %s" % TEST_CONFIG["BRANCHNAME"], "", | 1314 Cmd("git new-branch %s" % TEST_CONFIG["BRANCHNAME"], "", |
1482 cwd=chrome_dir), | 1315 cwd=chrome_dir), |
1483 Cmd("git fetch origin", "", cwd=chrome_v8_dir), | 1316 Cmd("git fetch origin", "", cwd=chrome_v8_dir), |
1484 Cmd("git log --format=%H --grep=\"V8\"", "c_hash1\nc_hash2\nc_hash3\n", | 1317 Cmd("git log --format=%H --grep=\"V8\"", "c_hash1\nc_hash2\nc_hash3\n", |
1485 cwd=chrome_dir), | 1318 cwd=chrome_dir), |
1486 Cmd("git diff --name-only c_hash1 c_hash1^", "", cwd=chrome_dir), | 1319 Cmd("git diff --name-only c_hash1 c_hash1^", "", cwd=chrome_dir), |
1487 Cmd("git diff --name-only c_hash2 c_hash2^", "DEPS", cwd=chrome_dir), | 1320 Cmd("git diff --name-only c_hash2 c_hash2^", "DEPS", cwd=chrome_dir), |
(...skipping 18 matching lines...) Expand all Loading... |
1506 cwd=chrome_dir), | 1339 cwd=chrome_dir), |
1507 Cmd("git checkout -f HEAD -- DEPS", "", cb=ResetDEPS(567), | 1340 Cmd("git checkout -f HEAD -- DEPS", "", cb=ResetDEPS(567), |
1508 cwd=chrome_dir), | 1341 cwd=chrome_dir), |
1509 Cmd("git checkout -f master", "", cwd=chrome_dir), | 1342 Cmd("git checkout -f master", "", cwd=chrome_dir), |
1510 Cmd("git branch -D %s" % TEST_CONFIG["BRANCHNAME"], "", cwd=chrome_dir), | 1343 Cmd("git branch -D %s" % TEST_CONFIG["BRANCHNAME"], "", cwd=chrome_dir), |
1511 Cmd("git checkout -f some_branch", ""), | 1344 Cmd("git checkout -f some_branch", ""), |
1512 Cmd("git branch -D %s" % TEST_CONFIG["BRANCHNAME"], ""), | 1345 Cmd("git branch -D %s" % TEST_CONFIG["BRANCHNAME"], ""), |
1513 ]) | 1346 ]) |
1514 | 1347 |
1515 args = ["-c", TEST_CONFIG["CHROMIUM"], | 1348 args = ["-c", TEST_CONFIG["CHROMIUM"], |
1516 "--vc-interface", "git_read_svn_write", | |
1517 "--json", json_output, | 1349 "--json", json_output, |
1518 "--csv", csv_output, | 1350 "--csv", csv_output, |
1519 "--max-releases", "1"] | 1351 "--max-releases", "1"] |
1520 Releases(TEST_CONFIG, self).Run(args) | 1352 Releases(TEST_CONFIG, self).Run(args) |
1521 | 1353 |
1522 # Check expected output. | 1354 # Check expected output. |
1523 csv = ("3.28.41,master,22626,,\r\n" | 1355 csv = ("3.22.3,candidates,345,3456:4566,\r\n" |
1524 "3.28.40,master,22624,4567,\r\n" | |
1525 "3.22.3,candidates,345,3456:4566,\r\n" | |
1526 "3.21.2,3.21,123,,\r\n" | 1356 "3.21.2,3.21,123,,\r\n" |
1527 "3.3.1.1,3.3,234,,abc12\r\n") | 1357 "3.3.1.1,3.3,234,,abc12\r\n") |
1528 self.assertEquals(csv, FileToText(csv_output)) | 1358 self.assertEquals(csv, FileToText(csv_output)) |
1529 | 1359 |
1530 expected_json = [ | 1360 expected_json = [ |
1531 { | 1361 { |
1532 "revision": "22626", | |
1533 "revision_git": "hash_22626", | |
1534 "bleeding_edge": "22626", | |
1535 "bleeding_edge_git": "hash_22626", | |
1536 "patches_merged": "", | |
1537 "version": "3.28.41", | |
1538 "chromium_revision": "", | |
1539 "branch": "master", | |
1540 "review_link": "", | |
1541 "date": "01:23", | |
1542 "chromium_branch": "", | |
1543 "revision_link": "https://code.google.com/p/v8/source/detail?r=22626", | |
1544 }, | |
1545 { | |
1546 "revision": "22624", | |
1547 "revision_git": "hash_22624", | |
1548 "bleeding_edge": "22624", | |
1549 "bleeding_edge_git": "hash_22624", | |
1550 "patches_merged": "", | |
1551 "version": "3.28.40", | |
1552 "chromium_revision": "4567", | |
1553 "branch": "master", | |
1554 "review_link": "", | |
1555 "date": "02:34", | |
1556 "chromium_branch": "", | |
1557 "revision_link": "https://code.google.com/p/v8/source/detail?r=22624", | |
1558 }, | |
1559 { | |
1560 "revision": "345", | 1362 "revision": "345", |
1561 "revision_git": "hash_345", | 1363 "revision_git": "hash_345", |
1562 "bleeding_edge": "", | 1364 "bleeding_edge": "", |
1563 "bleeding_edge_git": "", | 1365 "bleeding_edge_git": "", |
1564 "patches_merged": "", | 1366 "patches_merged": "", |
1565 "version": "3.22.3", | 1367 "version": "3.22.3", |
1566 "chromium_revision": "3456:4566", | 1368 "chromium_revision": "3456:4566", |
1567 "branch": "candidates", | 1369 "branch": "candidates", |
1568 "review_link": "", | 1370 "review_link": "", |
1569 "date": "", | 1371 "date": "", |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1637 Cmd("git commit -am \"[Auto-roll] Bump up version to 3.11.6.0\n\n" | 1439 Cmd("git commit -am \"[Auto-roll] Bump up version to 3.11.6.0\n\n" |
1638 "TBR=author@chromium.org\" " | 1440 "TBR=author@chromium.org\" " |
1639 "--author \"author@chromium.org <author@chromium.org>\"", ""), | 1441 "--author \"author@chromium.org <author@chromium.org>\"", ""), |
1640 ] | 1442 ] |
1641 | 1443 |
1642 def testBumpUpVersionGit(self): | 1444 def testBumpUpVersionGit(self): |
1643 expectations = self._bumpUpVersion() | 1445 expectations = self._bumpUpVersion() |
1644 expectations += [ | 1446 expectations += [ |
1645 Cmd("git cl upload --send-mail --email \"author@chromium.org\" -f " | 1447 Cmd("git cl upload --send-mail --email \"author@chromium.org\" -f " |
1646 "--bypass-hooks", ""), | 1448 "--bypass-hooks", ""), |
1647 Cmd("git cl dcommit -f --bypass-hooks", ""), | 1449 Cmd("git cl land -f --bypass-hooks", ""), |
1648 Cmd("git checkout -f master", ""), | 1450 Cmd("git checkout -f master", ""), |
1649 Cmd("git branch", "auto-bump-up-version\n* master"), | 1451 Cmd("git branch", "auto-bump-up-version\n* master"), |
1650 Cmd("git branch -D auto-bump-up-version", ""), | 1452 Cmd("git branch -D auto-bump-up-version", ""), |
1651 ] | 1453 ] |
1652 self.Expect(expectations) | 1454 self.Expect(expectations) |
1653 | 1455 |
1654 BumpUpVersion(TEST_CONFIG, self).Run(["-a", "author@chromium.org"]) | 1456 BumpUpVersion(TEST_CONFIG, self).Run(["-a", "author@chromium.org"]) |
1655 | 1457 |
1656 def testBumpUpVersionSvn(self): | |
1657 svn_root = self.MakeEmptyTempDirectory() | |
1658 expectations = self._bumpUpVersion() | |
1659 expectations += [ | |
1660 Cmd("git diff HEAD^ HEAD", "patch content"), | |
1661 Cmd("svn update", "", cwd=svn_root), | |
1662 Cmd("svn status", "", cwd=svn_root), | |
1663 Cmd("patch -d branches/bleeding_edge -p1 -i %s" % | |
1664 TEST_CONFIG["PATCH_FILE"], "Applied patch...", cwd=svn_root), | |
1665 Cmd("svn status", "M src/version.cc", cwd=svn_root), | |
1666 Cmd("svn commit --non-interactive --username=author@chromium.org " | |
1667 "--config-dir=[CONFIG_DIR] " | |
1668 "-m \"[Auto-roll] Bump up version to 3.11.6.0\"", | |
1669 "", cwd=svn_root), | |
1670 Cmd("git checkout -f master", ""), | |
1671 Cmd("git branch", "auto-bump-up-version\n* master"), | |
1672 Cmd("git branch -D auto-bump-up-version", ""), | |
1673 ] | |
1674 self.Expect(expectations) | |
1675 | |
1676 BumpUpVersion(TEST_CONFIG, self).Run( | |
1677 ["-a", "author@chromium.org", | |
1678 "--svn", svn_root, | |
1679 "--svn-config", "[CONFIG_DIR]"]) | |
1680 | 1458 |
1681 # Test that we bail out if the last change was a version change. | 1459 # Test that we bail out if the last change was a version change. |
1682 def testBumpUpVersionBailout1(self): | 1460 def testBumpUpVersionBailout1(self): |
1683 self._state["latest"] = "latest_hash" | 1461 self._state["latest"] = "latest_hash" |
1684 | 1462 |
1685 self.Expect([ | 1463 self.Expect([ |
1686 Cmd("git diff --name-only latest_hash latest_hash^", VERSION_FILE), | 1464 Cmd("git diff --name-only latest_hash latest_hash^", VERSION_FILE), |
1687 ]) | 1465 ]) |
1688 | 1466 |
1689 self.assertEquals(0, | 1467 self.assertEquals(0, |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1732 | 1510 |
1733 Review URL: https://codereview.chromium.org/83173002 | 1511 Review URL: https://codereview.chromium.org/83173002 |
1734 | 1512 |
1735 ------------------------------------------------------------------------""") | 1513 ------------------------------------------------------------------------""") |
1736 self.assertEquals( | 1514 self.assertEquals( |
1737 """Prepare push to trunk. Now working on version 3.23.11. | 1515 """Prepare push to trunk. Now working on version 3.23.11. |
1738 | 1516 |
1739 R=danno@chromium.org | 1517 R=danno@chromium.org |
1740 | 1518 |
1741 Committed: https://code.google.com/p/v8/source/detail?r=17997""", body) | 1519 Committed: https://code.google.com/p/v8/source/detail?r=17997""", body) |
OLD | NEW |