Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 261
Expand file tree
/
Copy pathpre-commit
More file actions
Latest commit
executable file
·30 lines (25 loc) · 1022 Bytes
/
Copy pathpre-commit
File metadata and controls
executable file
·30 lines (25 loc) · 1022 Bytes
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
26
27
28
29
30
#!/usr/local/bin/python3
importpathlib
importsubprocess
PACKAGE="ehforwarderbot"
ROOT_PATH=subprocess.check_output("git rev-parse --show-toplevel".split())\
.decode().strip()
VERSION_FILE=str(pathlib.Path(ROOT_PATH) /PACKAGE/"__version__.py")
# commit_msg_path = sys.argv[1]
stashed=subprocess.run("git diff --cached --name-only".split(),
capture_output=True).stdout.decode().splitlines()
# Ignore Crowdin sync commits
ifany(i.endswith('.po') foriinstashed):
print("Discovered pofile stashed, do not bump up version.")
exit(0)
# Ignore commits with version change
ifany("__version__.py"iniforiinstashed):
print("Discovered version file stashed, do not bump up version.")
exit(0)
# Bump version by a "dev".
bump_py=str(pathlib.Path(ROOT_PATH) /"bump.py")
subprocess.run((bump_py, '--allow-dirty', '--no-commit', 'dev'),
capture_output=False)
subprocess.run(("git", "add", VERSION_FILE),
capture_output=True)
exit(0)