1
0
mirror of https://github.com/balkian/pre-commit-hooks.git synced 2024-11-14 04:02:29 +00:00

More descriptive logging

This commit is contained in:
J. Fernando Sánchez 2017-02-02 04:41:06 +01:00
parent 72c30a8849
commit 2c30892457

View File

@ -15,11 +15,16 @@ def main(argv=None):
prevcontent = check_output(['git', 'show', 'HEAD:{}'.format(fn)]).strip().decode() prevcontent = check_output(['git', 'show', 'HEAD:{}'.format(fn)]).strip().decode()
current = semver.parse_version_info(currentcontent) current = semver.parse_version_info(currentcontent)
print('Checking versions: {} -> {}'.format(prevcontent, currentcontent)) print('Checking versions: {} -> {}'.format(prevcontent, currentcontent))
if (branch_name == 'master' and current.prerelease) or\ if branch_name == 'master' and current.prerelease:
(semver.compare(currentcontent, prevcontent)<1): print('Trying to push a pre-release version to a master branch')
return 1
elif semver.compare(currentcontent, prevcontent)<1:
print('The new version should be newer than the old one')
return 1 return 1
else: else:
error = 0 error = 0
if error:
print('VERSION files should be bumped in every commit')
return error return error
if __name__ == '__main__': if __name__ == '__main__':