| 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 451 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 462     self.assertEqual("        too little\n" | 462     self.assertEqual("        too little\n" | 
| 463                      "        tab        tab\n" | 463                      "        tab        tab\n" | 
| 464                      "        too much\n" | 464                      "        too much\n" | 
| 465                      "        trailing", cl) | 465                      "        trailing", cl) | 
| 466 | 466 | 
| 467     self.assertEqual("//\n#define BUILD_NUMBER  3\n", | 467     self.assertEqual("//\n#define BUILD_NUMBER  3\n", | 
| 468                      MSub(r"(?<=#define BUILD_NUMBER)(?P<space>\s+)\d*$", | 468                      MSub(r"(?<=#define BUILD_NUMBER)(?P<space>\s+)\d*$", | 
| 469                           r"\g<space>3", | 469                           r"\g<space>3", | 
| 470                           "//\n#define BUILD_NUMBER  321\n")) | 470                           "//\n#define BUILD_NUMBER  321\n")) | 
| 471 | 471 | 
|  | 472   def testPreparePushRevision(self): | 
|  | 473     # Tests the default push hash used when the --revision option is not set. | 
|  | 474     self.ExpectGit([ | 
|  | 475       Git("log -1 --format=%H HEAD", "push_hash") | 
|  | 476     ]) | 
|  | 477 | 
|  | 478     self.RunStep(PushToTrunk, PreparePushRevision) | 
|  | 479     self.assertEquals("push_hash", self._state["push_hash"]) | 
|  | 480 | 
| 472   def testPrepareChangeLog(self): | 481   def testPrepareChangeLog(self): | 
| 473     TEST_CONFIG[VERSION_FILE] = self.MakeEmptyTempFile() | 482     TEST_CONFIG[VERSION_FILE] = self.MakeEmptyTempFile() | 
| 474     self.WriteFakeVersionFile() | 483     self.WriteFakeVersionFile() | 
| 475     TEST_CONFIG[CHANGELOG_ENTRY_FILE] = self.MakeEmptyTempFile() | 484     TEST_CONFIG[CHANGELOG_ENTRY_FILE] = self.MakeEmptyTempFile() | 
| 476 | 485 | 
| 477     self.ExpectGit([ | 486     self.ExpectGit([ | 
| 478       Git("log --format=%H 1234..HEAD", "rev1\nrev2\nrev3\nrev4"), | 487       Git("log --format=%H 1234..push_hash", "rev1\nrev2\nrev3\nrev4"), | 
| 479       Git("log -1 --format=%s rev1", "Title text 1"), | 488       Git("log -1 --format=%s rev1", "Title text 1"), | 
| 480       Git("log -1 --format=%B rev1", "Title\n\nBUG=\nLOG=y\n"), | 489       Git("log -1 --format=%B rev1", "Title\n\nBUG=\nLOG=y\n"), | 
| 481       Git("log -1 --format=%an rev1", "author1@chromium.org"), | 490       Git("log -1 --format=%an rev1", "author1@chromium.org"), | 
| 482       Git("log -1 --format=%s rev2", "Title text 2."), | 491       Git("log -1 --format=%s rev2", "Title text 2."), | 
| 483       Git("log -1 --format=%B rev2", "Title\n\nBUG=123\nLOG= \n"), | 492       Git("log -1 --format=%B rev2", "Title\n\nBUG=123\nLOG= \n"), | 
| 484       Git("log -1 --format=%an rev2", "author2@chromium.org"), | 493       Git("log -1 --format=%an rev2", "author2@chromium.org"), | 
| 485       Git("log -1 --format=%s rev3", "Title text 3"), | 494       Git("log -1 --format=%s rev3", "Title text 3"), | 
| 486       Git("log -1 --format=%B rev3", "Title\n\nBUG=321\nLOG=true\n"), | 495       Git("log -1 --format=%B rev3", "Title\n\nBUG=321\nLOG=true\n"), | 
| 487       Git("log -1 --format=%an rev3", "author3@chromium.org"), | 496       Git("log -1 --format=%an rev3", "author3@chromium.org"), | 
| 488       Git("log -1 --format=%s rev4", "Title text 4"), | 497       Git("log -1 --format=%s rev4", "Title text 4"), | 
| 489       Git("log -1 --format=%B rev4", | 498       Git("log -1 --format=%B rev4", | 
| 490        ("Title\n\nBUG=456\nLOG=Y\n\n" | 499        ("Title\n\nBUG=456\nLOG=Y\n\n" | 
| 491         "Review URL: https://codereview.chromium.org/9876543210\n")), | 500         "Review URL: https://codereview.chromium.org/9876543210\n")), | 
| 492       Git("log -1 --format=%an rev4", "author4@chromium.org"), | 501       Git("log -1 --format=%an rev4", "author4@chromium.org"), | 
| 493     ]) | 502     ]) | 
| 494 | 503 | 
| 495     # The cl for rev4 on rietveld has an updated LOG flag. | 504     # The cl for rev4 on rietveld has an updated LOG flag. | 
| 496     self.ExpectReadURL([ | 505     self.ExpectReadURL([ | 
| 497       URL("https://codereview.chromium.org/9876543210/description", | 506       URL("https://codereview.chromium.org/9876543210/description", | 
| 498           "Title\n\nBUG=456\nLOG=N\n\n"), | 507           "Title\n\nBUG=456\nLOG=N\n\n"), | 
| 499     ]) | 508     ]) | 
| 500 | 509 | 
| 501     self._state["last_push_bleeding_edge"] = "1234" | 510     self._state["last_push_bleeding_edge"] = "1234" | 
|  | 511     self._state["push_hash"] = "push_hash" | 
| 502     self._state["version"] = "3.22.5" | 512     self._state["version"] = "3.22.5" | 
| 503     self.RunStep(PushToTrunk, PrepareChangeLog) | 513     self.RunStep(PushToTrunk, PrepareChangeLog) | 
| 504 | 514 | 
| 505     actual_cl = FileToText(TEST_CONFIG[CHANGELOG_ENTRY_FILE]) | 515     actual_cl = FileToText(TEST_CONFIG[CHANGELOG_ENTRY_FILE]) | 
| 506 | 516 | 
| 507     expected_cl = """1999-07-31: Version 3.22.5 | 517     expected_cl = """1999-07-31: Version 3.22.5 | 
| 508 | 518 | 
| 509         Title text 1. | 519         Title text 1. | 
| 510 | 520 | 
| 511         Title text 3 (Chromium issue 321). | 521         Title text 3 (Chromium issue 321). | 
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 629     TEST_CONFIG[CHANGELOG_ENTRY_FILE] = self.MakeEmptyTempFile() | 639     TEST_CONFIG[CHANGELOG_ENTRY_FILE] = self.MakeEmptyTempFile() | 
| 630     TEST_CONFIG[CHANGELOG_FILE] = self.MakeEmptyTempFile() | 640     TEST_CONFIG[CHANGELOG_FILE] = self.MakeEmptyTempFile() | 
| 631     if not os.path.exists(TEST_CONFIG[CHROMIUM]): | 641     if not os.path.exists(TEST_CONFIG[CHROMIUM]): | 
| 632       os.makedirs(TEST_CONFIG[CHROMIUM]) | 642       os.makedirs(TEST_CONFIG[CHROMIUM]) | 
| 633     bleeding_edge_change_log = "2014-03-17: Sentinel\n" | 643     bleeding_edge_change_log = "2014-03-17: Sentinel\n" | 
| 634     TextToFile(bleeding_edge_change_log, TEST_CONFIG[CHANGELOG_FILE]) | 644     TextToFile(bleeding_edge_change_log, TEST_CONFIG[CHANGELOG_FILE]) | 
| 635     TextToFile("Some line\n   \"v8_revision\": \"123444\",\n  some line", | 645     TextToFile("Some line\n   \"v8_revision\": \"123444\",\n  some line", | 
| 636                  TEST_CONFIG[DEPS_FILE]) | 646                  TEST_CONFIG[DEPS_FILE]) | 
| 637     os.environ["EDITOR"] = "vi" | 647     os.environ["EDITOR"] = "vi" | 
| 638 | 648 | 
| 639     def CheckPreparePush(): |  | 
| 640       self.assertEquals(bleeding_edge_change_log, |  | 
| 641                         FileToText(TEST_CONFIG[CHANGELOG_FILE])) |  | 
| 642 |  | 
| 643       version = FileToText(TEST_CONFIG[VERSION_FILE]) |  | 
| 644       self.assertTrue(re.search(r"#define BUILD_NUMBER\s+6", version)) |  | 
| 645 |  | 
| 646     def ResetChangeLog(): | 649     def ResetChangeLog(): | 
| 647       """On 'git co -b new_branch svn/trunk', and 'git checkout -- ChangeLog', | 650       """On 'git co -b new_branch svn/trunk', and 'git checkout -- ChangeLog', | 
| 648       the ChangLog will be reset to its content on trunk.""" | 651       the ChangLog will be reset to its content on trunk.""" | 
| 649       trunk_change_log = """1999-04-05: Version 3.22.4 | 652       trunk_change_log = """1999-04-05: Version 3.22.4 | 
| 650 | 653 | 
| 651         Performance and stability improvements on all platforms.\n""" | 654         Performance and stability improvements on all platforms.\n""" | 
| 652       TextToFile(trunk_change_log, TEST_CONFIG[CHANGELOG_FILE]) | 655       TextToFile(trunk_change_log, TEST_CONFIG[CHANGELOG_FILE]) | 
| 653 | 656 | 
| 654     def ResetToTrunk(): | 657     def ResetToTrunk(): | 
| 655       ResetChangeLog() | 658       ResetChangeLog() | 
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 689     review_suffix = "\n\nTBR=reviewer@chromium.org" if not manual else "" | 692     review_suffix = "\n\nTBR=reviewer@chromium.org" if not manual else "" | 
| 690     self.ExpectGit([ | 693     self.ExpectGit([ | 
| 691       Git("status -s -uno", ""), | 694       Git("status -s -uno", ""), | 
| 692       Git("status -s -b -uno", "## some_branch\n"), | 695       Git("status -s -b -uno", "## some_branch\n"), | 
| 693       Git("svn fetch", ""), | 696       Git("svn fetch", ""), | 
| 694       Git("branch", "  branch1\n* branch2\n"), | 697       Git("branch", "  branch1\n* branch2\n"), | 
| 695       Git("checkout -b %s" % TEST_CONFIG[TEMP_BRANCH], ""), | 698       Git("checkout -b %s" % TEST_CONFIG[TEMP_BRANCH], ""), | 
| 696       Git("branch", "  branch1\n* branch2\n"), | 699       Git("branch", "  branch1\n* branch2\n"), | 
| 697       Git("branch", "  branch1\n* branch2\n"), | 700       Git("branch", "  branch1\n* branch2\n"), | 
| 698       Git("checkout -b %s svn/bleeding_edge" % TEST_CONFIG[BRANCHNAME], ""), | 701       Git("checkout -b %s svn/bleeding_edge" % TEST_CONFIG[BRANCHNAME], ""), | 
|  | 702       Git("svn find-rev r123455", "push_hash\n"), | 
| 699       Git(("log -1 --format=%H --grep=" | 703       Git(("log -1 --format=%H --grep=" | 
| 700            "\"^Version [[:digit:]]*\.[[:digit:]]*\.[[:digit:]]* (based\" " | 704            "\"^Version [[:digit:]]*\.[[:digit:]]*\.[[:digit:]]* (based\" " | 
| 701            "svn/trunk"), "hash2\n"), | 705            "svn/trunk"), "hash2\n"), | 
| 702       Git("log -1 hash2", "Log message\n"), | 706       Git("log -1 hash2", "Log message\n"), | 
| 703       Git("log -1 --format=%s hash2", | 707       Git("log -1 --format=%s hash2", | 
| 704        "Version 3.4.5 (based on bleeding_edge revision r1234)\n"), | 708        "Version 3.4.5 (based on bleeding_edge revision r1234)\n"), | 
| 705       Git("svn find-rev r1234", "hash3\n"), | 709       Git("svn find-rev r1234", "hash3\n"), | 
| 706       Git("checkout -f hash2 -- %s" % TEST_CONFIG[VERSION_FILE], "", | 710       Git("checkout -f hash2 -- %s" % TEST_CONFIG[VERSION_FILE], "", | 
| 707           cb=self.WriteFakeVersionFile), | 711           cb=self.WriteFakeVersionFile), | 
| 708       Git("log --format=%H hash3..HEAD", "rev1\n"), | 712       Git("log --format=%H hash3..push_hash", "rev1\n"), | 
| 709       Git("log -1 --format=%s rev1", "Log text 1.\n"), | 713       Git("log -1 --format=%s rev1", "Log text 1.\n"), | 
| 710       Git("log -1 --format=%B rev1", "Text\nLOG=YES\nBUG=v8:321\nText\n"), | 714       Git("log -1 --format=%B rev1", "Text\nLOG=YES\nBUG=v8:321\nText\n"), | 
| 711       Git("log -1 --format=%an rev1", "author1@chromium.org\n"), | 715       Git("log -1 --format=%an rev1", "author1@chromium.org\n"), | 
| 712       Git("svn fetch", "fetch result\n"), | 716       Git("svn fetch", "fetch result\n"), | 
| 713       Git("checkout -f svn/bleeding_edge", ""), | 717       Git("checkout -f svn/bleeding_edge", ""), | 
| 714       Git("log -1 --format=%H HEAD", "push_hash\n"), |  | 
| 715       Git("diff svn/trunk push_hash", "patch content\n"), | 718       Git("diff svn/trunk push_hash", "patch content\n"), | 
| 716       Git("svn find-rev push_hash", "123455\n"), | 719       Git("svn find-rev push_hash", "123455\n"), | 
| 717       Git("checkout -b %s svn/trunk" % TEST_CONFIG[TRUNKBRANCH], "", | 720       Git("checkout -b %s svn/trunk" % TEST_CONFIG[TRUNKBRANCH], "", | 
| 718           cb=ResetToTrunk), | 721           cb=ResetToTrunk), | 
| 719       Git("apply --index --reject \"%s\"" % TEST_CONFIG[PATCH_FILE], ""), | 722       Git("apply --index --reject \"%s\"" % TEST_CONFIG[PATCH_FILE], ""), | 
| 720       Git("checkout -f svn/trunk -- %s" % TEST_CONFIG[CHANGELOG_FILE], "", | 723       Git("checkout -f svn/trunk -- %s" % TEST_CONFIG[CHANGELOG_FILE], "", | 
| 721           cb=ResetChangeLog), | 724           cb=ResetChangeLog), | 
| 722       Git("checkout -f svn/trunk -- %s" % TEST_CONFIG[VERSION_FILE], "", | 725       Git("checkout -f svn/trunk -- %s" % TEST_CONFIG[VERSION_FILE], "", | 
| 723           cb=self.WriteFakeVersionFile), | 726           cb=self.WriteFakeVersionFile), | 
| 724       Git("commit -aF \"%s\"" % TEST_CONFIG[COMMITMSG_FILE], "", | 727       Git("commit -aF \"%s\"" % TEST_CONFIG[COMMITMSG_FILE], "", | 
| (...skipping 23 matching lines...) Expand all  Loading... | 
| 748         RL(""),  # Open editor. | 751         RL(""),  # Open editor. | 
| 749         RL("Y"),  # Increment build number. | 752         RL("Y"),  # Increment build number. | 
| 750         RL("Y"),  # Sanity check. | 753         RL("Y"),  # Sanity check. | 
| 751         RL("reviewer@chromium.org"),  # Chromium reviewer. | 754         RL("reviewer@chromium.org"),  # Chromium reviewer. | 
| 752       ]) | 755       ]) | 
| 753 | 756 | 
| 754     # Expected keyboard input in semi-automatic mode and forced mode: | 757     # Expected keyboard input in semi-automatic mode and forced mode: | 
| 755     if not manual: | 758     if not manual: | 
| 756       self.ExpectReadline([]) | 759       self.ExpectReadline([]) | 
| 757 | 760 | 
| 758     args = ["-a", "author@chromium.org", "-c", TEST_CONFIG[CHROMIUM]] | 761     args = ["-a", "author@chromium.org", "-c", TEST_CONFIG[CHROMIUM], | 
|  | 762             "--revision", "123455"] | 
| 759     if force: args.append("-f") | 763     if force: args.append("-f") | 
| 760     if manual: args.append("-m") | 764     if manual: args.append("-m") | 
| 761     else: args += ["-r", "reviewer@chromium.org"] | 765     else: args += ["-r", "reviewer@chromium.org"] | 
| 762     PushToTrunk(TEST_CONFIG, self).Run(args) | 766     PushToTrunk(TEST_CONFIG, self).Run(args) | 
| 763 | 767 | 
| 764     deps = FileToText(TEST_CONFIG[DEPS_FILE]) | 768     deps = FileToText(TEST_CONFIG[DEPS_FILE]) | 
| 765     self.assertTrue(re.search("\"v8_revision\": \"123456\"", deps)) | 769     self.assertTrue(re.search("\"v8_revision\": \"123456\"", deps)) | 
| 766 | 770 | 
| 767     cl = FileToText(TEST_CONFIG[CHANGELOG_FILE]) | 771     cl = FileToText(TEST_CONFIG[CHANGELOG_FILE]) | 
| 768     self.assertTrue(re.search(r"^\d\d\d\d\-\d+\-\d+: Version 3\.22\.5", cl)) | 772     self.assertTrue(re.search(r"^\d\d\d\d\-\d+\-\d+: Version 3\.22\.5", cl)) | 
| (...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 1011 | 1015 | 
| 1012 Review URL: https://codereview.chromium.org/83173002 | 1016 Review URL: https://codereview.chromium.org/83173002 | 
| 1013 | 1017 | 
| 1014 ------------------------------------------------------------------------""") | 1018 ------------------------------------------------------------------------""") | 
| 1015     self.assertEquals( | 1019     self.assertEquals( | 
| 1016 """Prepare push to trunk.  Now working on version 3.23.11. | 1020 """Prepare push to trunk.  Now working on version 3.23.11. | 
| 1017 | 1021 | 
| 1018 R=danno@chromium.org | 1022 R=danno@chromium.org | 
| 1019 | 1023 | 
| 1020 Committed: https://code.google.com/p/v8/source/detail?r=17997""", body) | 1024 Committed: https://code.google.com/p/v8/source/detail?r=17997""", body) | 
| OLD | NEW | 
|---|