mirror of
https://github.com/servo/servo.git
synced 2025-06-21 23:59:00 +01:00
Check for merge commits with tidy
This commit is contained in:
parent
effdf7e995
commit
e2c7e3d1e2
1 changed files with 9 additions and 3 deletions
|
@ -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
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue