| OLD | NEW |
| 1 # Copyright 2016 The Chromium Authors. All rights reserved. | 1 # Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
| 4 | 4 |
| 5 import unittest | 5 import unittest |
| 6 | 6 |
| 7 from webkitpy.common.host_mock import MockHost | 7 from webkitpy.common.host_mock import MockHost |
| 8 from webkitpy.common.system.executive_mock import MockExecutive | 8 from webkitpy.common.system.executive_mock import MockExecutive |
| 9 from webkitpy.w3c.chromium_commit import ChromiumCommit | 9 from webkitpy.w3c.chromium_commit import ChromiumCommit |
| 10 from webkitpy.w3c.test_exporter import TestExporter | 10 from webkitpy.w3c.test_exporter import TestExporter |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 'format-patch': 'hey I\'m a patch', | 91 'format-patch': 'hey I\'m a patch', |
| 92 'footers': 'cr-rev-position', | 92 'footers': 'cr-rev-position', |
| 93 }) | 93 }) |
| 94 test_exporter = TestExporter(self.host, self.wpt_github) | 94 test_exporter = TestExporter(self.host, self.wpt_github) |
| 95 | 95 |
| 96 commits = test_exporter.exportable_commits_since('beefcafe') | 96 commits = test_exporter.exportable_commits_since('beefcafe') |
| 97 self.assertEqual(len(commits), 1) | 97 self.assertEqual(len(commits), 1) |
| 98 self.assertIsInstance(commits[0], ChromiumCommit) | 98 self.assertIsInstance(commits[0], ChromiumCommit) |
| 99 self.assertEqual(self.host.executive.calls, [ | 99 self.assertEqual(self.host.executive.calls, [ |
| 100 ['git', 'clone', 'https://chromium.googlesource.com/external/w3c/web
-platform-tests.git', '/tmp/wpt'], | 100 ['git', 'clone', 'https://chromium.googlesource.com/external/w3c/web
-platform-tests.git', '/tmp/wpt'], |
| 101 ['git', 'remote'], |
| 102 ['git', 'remote', 'add', 'github', 'git@github.com:w3c/web-platform-
tests.git'], |
| 101 ['git', 'rev-parse', '--show-toplevel'], | 103 ['git', 'rev-parse', '--show-toplevel'], |
| 102 ['git', 'rev-list', 'beefcafe..HEAD', '--reverse', '--', 'badbeef8/t
hird_party/WebKit/LayoutTests/imported/wpt/'], | 104 ['git', 'rev-list', 'beefcafe..HEAD', '--reverse', '--', 'badbeef8/t
hird_party/WebKit/LayoutTests/imported/wpt/'], |
| 103 ['git', 'diff-tree', '--name-only', '--no-commit-id', '-r', 'badbeef
8', '--', | 105 ['git', 'diff-tree', '--name-only', '--no-commit-id', '-r', 'badbeef
8', '--', |
| 104 '/mock-checkout/third_party/WebKit/LayoutTests/imported/wpt'], | 106 '/mock-checkout/third_party/WebKit/LayoutTests/imported/wpt'], |
| 105 ['git', 'format-patch', '-1', '--stdout', 'badbeef8', '--', 'some',
'files'], | 107 ['git', 'format-patch', '-1', '--stdout', 'badbeef8', '--', 'some',
'files'], |
| 106 ['git', 'reset', '--hard', 'HEAD'], | 108 ['git', 'reset', '--hard', 'HEAD'], |
| 107 ['git', 'clean', '-fdx'], | 109 ['git', 'clean', '-fdx'], |
| 108 ['git', 'checkout', 'origin/master'], | 110 ['git', 'checkout', 'origin/master'], |
| 109 ['git', 'branch', '-a'], | 111 ['git', 'branch', '-a'], |
| 110 ['git', 'apply', '-'], | 112 ['git', 'apply', '-'], |
| (...skipping 12 matching lines...) Expand all Loading... |
| 123 'rev-list': 'badbeef8', | 125 'rev-list': 'badbeef8', |
| 124 'rev-parse': 'badbeef8', | 126 'rev-parse': 'badbeef8', |
| 125 'footers': 'cr-rev-position', | 127 'footers': 'cr-rev-position', |
| 126 }) | 128 }) |
| 127 test_exporter = TestExporter(self.host, self.wpt_github) | 129 test_exporter = TestExporter(self.host, self.wpt_github) |
| 128 | 130 |
| 129 commits = test_exporter.exportable_commits_since('beefcafe') | 131 commits = test_exporter.exportable_commits_since('beefcafe') |
| 130 self.assertEqual(len(commits), 0) | 132 self.assertEqual(len(commits), 0) |
| 131 self.assertEqual(self.host.executive.calls, [ | 133 self.assertEqual(self.host.executive.calls, [ |
| 132 ['git', 'clone', 'https://chromium.googlesource.com/external/w3c/web
-platform-tests.git', '/tmp/wpt'], | 134 ['git', 'clone', 'https://chromium.googlesource.com/external/w3c/web
-platform-tests.git', '/tmp/wpt'], |
| 135 ['git', 'remote'], |
| 136 ['git', 'remote', 'add', 'github', 'git@github.com:w3c/web-platform-
tests.git'], |
| 133 ['git', 'rev-parse', '--show-toplevel'], | 137 ['git', 'rev-parse', '--show-toplevel'], |
| 134 ['git', 'rev-list', 'beefcafe..HEAD', '--reverse', '--', | 138 ['git', 'rev-list', 'beefcafe..HEAD', '--reverse', '--', |
| 135 'badbeef8/third_party/WebKit/LayoutTests/imported/wpt/'], | 139 'badbeef8/third_party/WebKit/LayoutTests/imported/wpt/'], |
| 136 ['git', 'diff-tree', '--name-only', '--no-commit-id', '-r', 'badbeef
8', '--', | 140 ['git', 'diff-tree', '--name-only', '--no-commit-id', '-r', 'badbeef
8', '--', |
| 137 '/mock-checkout/third_party/WebKit/LayoutTests/imported/wpt']]) | 141 '/mock-checkout/third_party/WebKit/LayoutTests/imported/wpt']]) |
| 138 | 142 |
| 139 def test_ignores_reverted_commits_with_noexport_true(self): | 143 def test_ignores_reverted_commits_with_noexport_true(self): |
| 140 self.host.executive = mock_command_exec({ | 144 self.host.executive = mock_command_exec({ |
| 141 'show': 'Commit message\n> NOEXPORT=true', | 145 'show': 'Commit message\n> NOEXPORT=true', |
| 142 'rev-list': 'badbeef8', | 146 'rev-list': 'badbeef8', |
| 143 'rev-parse': 'badbeef8', | 147 'rev-parse': 'badbeef8', |
| 144 'footers': 'cr-rev-position', | 148 'footers': 'cr-rev-position', |
| 145 }) | 149 }) |
| 146 wpt_github = MockWPTGitHub(pull_requests=[]) | 150 wpt_github = MockWPTGitHub(pull_requests=[]) |
| 147 test_exporter = TestExporter(self.host, wpt_github) | 151 test_exporter = TestExporter(self.host, wpt_github) |
| 148 | 152 |
| 149 commits = test_exporter.exportable_commits_since('beefcafe') | 153 commits = test_exporter.exportable_commits_since('beefcafe') |
| 150 self.assertEqual(len(commits), 0) | 154 self.assertEqual(len(commits), 0) |
| 151 self.assertEqual(self.host.executive.calls, [ | 155 self.assertEqual(self.host.executive.calls, [ |
| 152 ['git', 'clone', 'https://chromium.googlesource.com/external/w3c/web
-platform-tests.git', '/tmp/wpt'], | 156 ['git', 'clone', 'https://chromium.googlesource.com/external/w3c/web
-platform-tests.git', '/tmp/wpt'], |
| 157 ['git', 'remote'], |
| 158 ['git', 'remote', 'add', 'github', 'git@github.com:w3c/web-platform-
tests.git'], |
| 153 ['git', 'rev-parse', '--show-toplevel'], | 159 ['git', 'rev-parse', '--show-toplevel'], |
| 154 ['git', 'rev-list', 'beefcafe..HEAD', '--reverse', '--', | 160 ['git', 'rev-list', 'beefcafe..HEAD', '--reverse', '--', |
| 155 'badbeef8/third_party/WebKit/LayoutTests/imported/wpt/'], | 161 'badbeef8/third_party/WebKit/LayoutTests/imported/wpt/'], |
| 156 ['git', 'diff-tree', '--name-only', '--no-commit-id', '-r', 'badbeef
8', '--', | 162 ['git', 'diff-tree', '--name-only', '--no-commit-id', '-r', 'badbeef
8', '--', |
| 157 '/mock-checkout/third_party/WebKit/LayoutTests/imported/wpt']]) | 163 '/mock-checkout/third_party/WebKit/LayoutTests/imported/wpt']]) |
| 158 | 164 |
| 159 def test_ignores_commits_that_start_with_import(self): | 165 def test_ignores_commits_that_start_with_import(self): |
| 160 self.host.executive = mock_command_exec({ | 166 self.host.executive = mock_command_exec({ |
| 161 'show': 'Import rutabaga@deadbeef', | 167 'show': 'Import rutabaga@deadbeef', |
| 162 'rev-list': 'badbeef8', | 168 'rev-list': 'badbeef8', |
| 163 'rev-parse': 'badbeef8', | 169 'rev-parse': 'badbeef8', |
| 164 'footers': 'cr-rev-position', | 170 'footers': 'cr-rev-position', |
| 165 }) | 171 }) |
| 166 wpt_github = MockWPTGitHub(pull_requests=[]) | 172 wpt_github = MockWPTGitHub(pull_requests=[]) |
| 167 test_exporter = TestExporter(self.host, wpt_github) | 173 test_exporter = TestExporter(self.host, wpt_github) |
| 168 | 174 |
| 169 commits = test_exporter.exportable_commits_since('beefcafe') | 175 commits = test_exporter.exportable_commits_since('beefcafe') |
| 170 self.assertEqual(len(commits), 0) | 176 self.assertEqual(len(commits), 0) |
| 171 self.assertEqual(self.host.executive.calls, [ | 177 self.assertEqual(self.host.executive.calls, [ |
| 172 ['git', 'clone', 'https://chromium.googlesource.com/external/w3c/web
-platform-tests.git', '/tmp/wpt'], | 178 ['git', 'clone', 'https://chromium.googlesource.com/external/w3c/web
-platform-tests.git', '/tmp/wpt'], |
| 179 ['git', 'remote'], |
| 180 ['git', 'remote', 'add', 'github', 'git@github.com:w3c/web-platform-
tests.git'], |
| 173 ['git', 'rev-parse', '--show-toplevel'], | 181 ['git', 'rev-parse', '--show-toplevel'], |
| 174 ['git', 'rev-list', 'beefcafe..HEAD', '--reverse', '--', | 182 ['git', 'rev-list', 'beefcafe..HEAD', '--reverse', '--', |
| 175 'badbeef8/third_party/WebKit/LayoutTests/imported/wpt/'], | 183 'badbeef8/third_party/WebKit/LayoutTests/imported/wpt/'], |
| 176 ['git', 'diff-tree', '--name-only', '--no-commit-id', '-r', 'badbeef
8', '--', | 184 ['git', 'diff-tree', '--name-only', '--no-commit-id', '-r', 'badbeef
8', '--', |
| 177 '/mock-checkout/third_party/WebKit/LayoutTests/imported/wpt']]) | 185 '/mock-checkout/third_party/WebKit/LayoutTests/imported/wpt']]) |
| OLD | NEW |