blob: afde8507431b0a04c3d4e241f7ccc35767b6d103 [file] [log] [blame]
#!/usr/bin/env bash
# Try to change to correct directory:
cd $(dirname "$0") || exit 1
FILE=main.py
test -r $FILE || { echo "Must be run from the directory containing $FILE!"; exit 1; }
# Find latest of plugin, endpoint and main.py revisions
SERVER_REV=$({
git log -1 --pretty='%ct %h' -- endpoints
git log -1 --pretty='%ct %h' -- plugins
git log -1 --pretty='%ct %h' -- main.py
} | sort -r | head -1 | cut -d' ' -f 2)
cat <<EOD >server_version.py
# This file is generated by server/update_version.sh
PONYMAIL_SERVER_VERSION = '$SERVER_REV'
EOD
# Has it changed?
git diff --exit-code -- server_version.py