diff --git a/python/tidy/servo_tidy/tidy.py b/python/tidy/servo_tidy/tidy.py index 36679cf9b1f..35efb60230f 100644 --- a/python/tidy/servo_tidy/tidy.py +++ b/python/tidy/servo_tidy/tidy.py @@ -1053,9 +1053,12 @@ def run_lint_scripts(only_changed_files=False, progress=True, stylo=False): def check_commits(path='.'): """Gets all commits since the last merge.""" - args = ['git', 'log', '-n1', '--merges', '--format=%H'] - last_merge = subprocess.check_output(args, cwd=path).strip() - args = ['git', 'log', '{}..HEAD'.format(last_merge), '--format=%s'] + args = ['git', 'log', '-n1', '--merges', '--format=%H %an'] + # last_merge stores both the commit hash and the author name + last_merge = subprocess.check_output(args, cwd=path).strip().split() + last_merge_hash = last_merge[0] + last_merge_author = last_merge[1] + args = ['git', 'log', '{}..HEAD'.format(last_merge_hash), '--format=%s'] commits = subprocess.check_output(args, cwd=path).lower().splitlines() for commit in commits: @@ -1063,6 +1066,9 @@ def check_commits(path='.'): if 'wip' in commit.split(): yield ('.', 0, 'no commits should contain WIP') + if last_merge_author != 'bors-servo': + yield ('.', 0, 'no merge commits allowed by authors other than bors-servo') + raise StopIteration