Commit 4a301c5f authored by Quinten Yearsley's avatar Quinten Yearsley Committed by Commit Bot

Remove the --allow-local-commits flag from wpt-import.

Change-Id: I4c54ce01d990dc8b2d6a6ffdb46f0774157faa71
Reviewed-on: https://chromium-review.googlesource.com/577722Reviewed-by: default avatarJeff Carpenter <jeffcarp@chromium.org>
Commit-Queue: Quinten Yearsley <qyearsley@chromium.org>
Cr-Commit-Position: refs/heads/master@{#487992}
parent 91f0c8a3
...@@ -52,7 +52,7 @@ class TestImporter(object): ...@@ -52,7 +52,7 @@ class TestImporter(object):
log_level = logging.DEBUG if self.verbose else logging.INFO log_level = logging.DEBUG if self.verbose else logging.INFO
logging.basicConfig(level=log_level, format='%(message)s') logging.basicConfig(level=log_level, format='%(message)s')
if not self.checkout_is_okay(options.allow_local_commits): if not self.checkout_is_okay():
return 1 return 1
credentials = read_credentials(self.host, options.credentials_json) credentials = read_credentials(self.host, options.credentials_json)
...@@ -202,9 +202,6 @@ class TestImporter(object): ...@@ -202,9 +202,6 @@ class TestImporter(object):
parser.add_argument( parser.add_argument(
'-v', '--verbose', action='store_true', '-v', '--verbose', action='store_true',
help='log extra details that may be helpful when debugging') help='log extra details that may be helpful when debugging')
parser.add_argument(
'--allow-local-commits', action='store_true',
help='allow script to run even if we have local commits')
parser.add_argument( parser.add_argument(
'--ignore-exportable-commits', action='store_true', '--ignore-exportable-commits', action='store_true',
help='do not check for exportable commits that would be clobbered') help='do not check for exportable commits that would be clobbered')
...@@ -223,17 +220,16 @@ class TestImporter(object): ...@@ -223,17 +220,16 @@ class TestImporter(object):
return parser.parse_args(argv) return parser.parse_args(argv)
def checkout_is_okay(self, allow_local_commits): def checkout_is_okay(self):
git_diff_retcode, _ = self.run(['git', 'diff', '--quiet', 'HEAD'], exit_on_failure=False) git_diff_retcode, _ = self.run(
['git', 'diff', '--quiet', 'HEAD'], exit_on_failure=False)
if git_diff_retcode: if git_diff_retcode:
_log.warning('Checkout is dirty; aborting.') _log.warning('Checkout is dirty; aborting.')
return False return False
_, local_commits = self.run(
local_commits = self.run(['git', 'log', '--oneline', 'origin/master..HEAD'])[1] ['git', 'log', '--oneline', 'origin/master..HEAD'])[1]
if local_commits and not allow_local_commits: if local_commits:
_log.warning('Checkout has local commits; aborting. Use --allow-local-commits to allow this.') _log.warning('Checkout has local commits before import.')
return False
return True return True
def exportable_but_not_exported_commits(self, local_wpt): def exportable_but_not_exported_commits(self, local_wpt):
......
...@@ -28,7 +28,7 @@ class TestImporterTest(LoggingTestCase): ...@@ -28,7 +28,7 @@ class TestImporterTest(LoggingTestCase):
importer.exportable_but_not_exported_commits = lambda _: [ importer.exportable_but_not_exported_commits = lambda _: [
MockChromiumCommit(host, change_id='Iba5eba11') MockChromiumCommit(host, change_id='Iba5eba11')
] ]
importer.checkout_is_okay = lambda _: True importer.checkout_is_okay = lambda: True
return_code = importer.main(['--credentials-json=/tmp/creds.json']) return_code = importer.main(['--credentials-json=/tmp/creds.json'])
self.assertEqual(return_code, 0) self.assertEqual(return_code, 0)
self.assertLog([ self.assertLog([
...@@ -52,7 +52,7 @@ class TestImporterTest(LoggingTestCase): ...@@ -52,7 +52,7 @@ class TestImporterTest(LoggingTestCase):
importer.exportable_but_not_exported_commits = lambda _: [ importer.exportable_but_not_exported_commits = lambda _: [
MockChromiumCommit(host, position='refs/heads/master@{#431}') MockChromiumCommit(host, position='refs/heads/master@{#431}')
] ]
importer.checkout_is_okay = lambda _: True importer.checkout_is_okay = lambda: True
return_code = importer.main(['--credentials-json=/tmp/creds.json']) return_code = importer.main(['--credentials-json=/tmp/creds.json'])
self.assertEqual(return_code, 0) self.assertEqual(return_code, 0)
self.assertLog([ self.assertLog([
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment