black: Reformat skipping string normalization.
This commit is contained in:
parent
5580c68ae5
commit
fba21bb00d
178 changed files with 6562 additions and 4469 deletions
11
tools/review
11
tools/review
|
@ -9,24 +9,29 @@ def exit(message: str) -> None:
|
|||
print(message)
|
||||
sys.exit(1)
|
||||
|
||||
|
||||
def run(command: str) -> None:
|
||||
print('\n>>> ' + command)
|
||||
subprocess.check_call(command.split())
|
||||
|
||||
|
||||
def check_output(command: str) -> str:
|
||||
return subprocess.check_output(command.split()).decode('ascii')
|
||||
|
||||
|
||||
def get_git_branch() -> str:
|
||||
command = 'git rev-parse --abbrev-ref HEAD'
|
||||
output = check_output(command)
|
||||
return output.strip()
|
||||
|
||||
|
||||
def check_git_pristine() -> None:
|
||||
command = 'git status --porcelain'
|
||||
output = check_output(command)
|
||||
if output.strip():
|
||||
exit('Git is not pristine:\n' + output)
|
||||
|
||||
|
||||
def ensure_on_clean_master() -> None:
|
||||
branch = get_git_branch()
|
||||
if branch != 'master':
|
||||
|
@ -35,6 +40,7 @@ def ensure_on_clean_master() -> None:
|
|||
run('git fetch upstream master')
|
||||
run('git rebase upstream/master')
|
||||
|
||||
|
||||
def create_pull_branch(pull_id: int) -> None:
|
||||
run('git fetch upstream pull/%d/head' % (pull_id,))
|
||||
run('git checkout -B review-%s FETCH_HEAD' % (pull_id,))
|
||||
|
@ -44,8 +50,8 @@ def create_pull_branch(pull_id: int) -> None:
|
|||
|
||||
print()
|
||||
print('PR: %d' % (pull_id,))
|
||||
print(subprocess.check_output(['git', 'log', 'HEAD~..',
|
||||
'--pretty=format:Author: %an']))
|
||||
print(subprocess.check_output(['git', 'log', 'HEAD~..', '--pretty=format:Author: %an']))
|
||||
|
||||
|
||||
def review_pr() -> None:
|
||||
try:
|
||||
|
@ -56,5 +62,6 @@ def review_pr() -> None:
|
|||
ensure_on_clean_master()
|
||||
create_pull_branch(pull_id)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
review_pr()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue