Skip to content

Commit

Permalink
Add perforce support to showrev.sh
Browse files Browse the repository at this point in the history
In order to generate meaningful output from SDL_GetRevision()
  • Loading branch information
slouken committed Apr 8, 2020
1 parent 3180ba8 commit 9cd06ac
Showing 1 changed file with 21 additions and 1 deletion.
22 changes: 21 additions & 1 deletion build-scripts/showrev.sh
Expand Up @@ -2,4 +2,24 @@
#
# Print the current source revision, if available

hg parents --template 'hg-{rev}:{node|short}' || (echo "hg-0:baadf00d"; exit 1)
SDL_ROOT=$(dirname $0)/..
cd $SDL_ROOT

if [ -x "$(command -v hg)" ]; then
rev="$(hg parents --template 'hg-{rev}:{node|short}' 2>/dev/null)"
if [ "$?" == 0 ]; then
echo $rev
exit 0
fi
fi

if [ -x "$(command -v p4)" ]; then
rev="$(p4 changes -m1 ./...\#have 2>/dev/null| awk '{print $2}')"
if [ "$?" == 0 ]; then
echo $rev
exit 0
fi
fi

echo "hg-0:baadf00d"
exit 1

0 comments on commit 9cd06ac

Please sign in to comment.