| 1 |
#!/bin/sh |
| 2 |
|
| 3 |
die() { |
| 4 |
echo "(pre-commit) $@" >&2 |
| 5 |
exit 1 |
| 6 |
} |
| 7 |
|
| 8 |
# Mistakes I commonly make: |
| 9 |
# - Not bumping *all* versions |
| 10 |
|
| 11 |
# Gesundheit |
| 12 |
versions=$(git show :setup.py :hpilo.py :docs/conf.py | sed -ne "s/^ *_*\(version\|release\)_* *= *['\"]\([0-9.]*\)['\"].*/\2/p"; sed -ne 's/Version: \(.*\)/\1/p' devtools/python-hpilo.spec) |
| 13 |
if [ $(echo $versions | wc -w) != 5 ]; then |
| 14 |
die "Yikes. Can't find the versions! (Found: $versions)" |
| 15 |
fi |
| 16 |
if [ $(echo $versions | xargs -n1 echo | uniq | wc -w) != 1 ]; then |
| 17 |
die "Inconsistent version numbers in setup.py / hpilo.py / docs/conf.py / python-hpilo.spec" |
| 18 |
fi |