-
Notifications
You must be signed in to change notification settings - Fork 56
/
pre-push
executable file
·26 lines (20 loc) · 1.09 KB
/
pre-push
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#!/usr/bin/python
from __future__ import print_function
from automation_tools import get_branchname, run_pylint, get_output
import subprocess, os, sys
if __name__ == "__main__":
passes = run_pylint(['./lint.py', '--noerrors']) # Can't push to origin if pylint finds any errors!
if int(passes) > 0:
sys.exit(1)
'''
output = get_output(['git', 'log', '--merges'])
output = [line for line in output.splitlines() if line.count(branchname) < 2 and 'into %s' % branchname in line]
with open('doc/%s_merge_log.txt' % branchname, 'w') as merge_log:
merge_log.write('\n'.join(output))
#fmt = '%C(bold blue)%h%C(reset) - %C(bold cyan)%aD%C(reset) %C(bold green)(%ar)%C(reset)%C(bold yellow)%d%C(reset)%n'' %C(white)%s%C(reset) %C(dim white)- %an%C(reset)'
lg1 = ['git', 'log', '--graph', '--abbrev-commit']#,
#'--decorate', '--format=format:'+fmt, '--all']
output = get_output(lg1)
output = [line for line in output.splitlines() if line.count(branchname) < 2 and 'into %s' % branchname in line]
print('\n'.join(output))
'''