#!/bin/sh

set -e
set -u

OLDVERSION=$(/bin/grep "__version__ = " setup.py | \
             sed -E "s/^.*__version__ = '(.*)'/\1/g")
echo "Current version is $OLDVERSION. Please enter the new version"
read NEWVERSION

sed -i -E "s/__version__ = '$OLDVERSION'/__version__ = '$NEWVERSION'/g" setup.py

sed -i -E "s/__version__ = '$OLDVERSION'/__version__ = '$NEWVERSION'/g" tailsgreeter/__init__.py

gbp dch --auto --release --new-version="$NEWVERSION" --spawn-editor=always

git commit debian/changelog setup.py tailsgreeter/__init__.py \
    -m "$(dpkg-parsechangelog -SSource) ($(dpkg-parsechangelog -SVersion))

Gbp-Dch: Ignore
"
git show
