mirror of https://github.com/coqui-ai/TTS.git
get git hash 2
This commit is contained in:
parent
ddd3b9bb6e
commit
a3f02b674a
|
@ -25,7 +25,10 @@ def load_config(config_path):
|
||||||
|
|
||||||
def get_commit_hash():
|
def get_commit_hash():
|
||||||
"""https://stackoverflow.com/questions/14989858/get-the-current-git-hash-in-a-python-script"""
|
"""https://stackoverflow.com/questions/14989858/get-the-current-git-hash-in-a-python-script"""
|
||||||
subprocess.check_output(['git', 'diff-index', '--quiet', 'HEAD']) # Verify client is clean
|
try:
|
||||||
|
subprocess.check_output(['git', 'diff-index', '--quiet', 'HEAD']) # Verify client is clean
|
||||||
|
except:
|
||||||
|
raise RuntimeError(" !! Commit before training to get the commit hash.")
|
||||||
commit = subprocess.check_output(['git', 'rev-parse', '--short', 'HEAD']).decode().strip()
|
commit = subprocess.check_output(['git', 'rev-parse', '--short', 'HEAD']).decode().strip()
|
||||||
print(' > Git Hash: {}'.format(commit))
|
print(' > Git Hash: {}'.format(commit))
|
||||||
return commit
|
return commit
|
||||||
|
|
Loading…
Reference in New Issue