Let the test mapping updater handle newly-added files.
The previous commit to this file allowed it to create and upload a commit when a TEST_MAPPING file changed. But it did not handle the case where the TEST_MAPPING file did not previously exist. This fixes that. Test: Run script. Change-Id: Id7b9e778c2b084f7ea2e4005a173c1fedeccd6c7
This commit is contained in:
@@ -278,13 +278,17 @@ def main():
|
||||
test_mapping = TestMapping(env, bazel, path)
|
||||
test_mapping.create()
|
||||
changed = (subprocess.call(['git', 'diff', '--quiet']) == 1)
|
||||
if changed and args.branch_and_commit:
|
||||
untracked = (os.path.isfile('TEST_MAPPING') and
|
||||
(subprocess.run(['git', 'ls-files', '--error-unmatch', 'TEST_MAPPING'],
|
||||
stderr=subprocess.DEVNULL,
|
||||
stdout=subprocess.DEVNULL).returncode == 1))
|
||||
if args.branch_and_commit and (changed or untracked):
|
||||
subprocess.check_output(['repo', 'start',
|
||||
'tmp_auto_test_mapping', '.'])
|
||||
subprocess.check_output(['git', 'add', 'TEST_MAPPING'])
|
||||
subprocess.check_output(['git', 'commit', '-m',
|
||||
'Update TEST_MAPPING\n\nTest: None'])
|
||||
if changed and args.push_change:
|
||||
if args.push_change and (changed or untracked):
|
||||
date = datetime.today().strftime('%m-%d')
|
||||
subprocess.check_output(['git', 'push', 'aosp', 'HEAD:refs/for/master',
|
||||
'-o', 'topic=test-mapping-%s' % date])
|
||||
|
||||
Reference in New Issue
Block a user