From 7e9c926d156db966e0b1fab5b828fd24212a090a Mon Sep 17 00:00:00 2001 From: "Ryan C. Gordon" Date: Sun, 28 Feb 2010 02:07:40 -0500 Subject: [PATCH] Changed revision details to be a string (an hg changeset) instead of an int. --- build-scripts/showrev.sh | 13 +++---------- build-scripts/updaterev.sh | 2 +- include/SDL_version.h | 5 ++++- src/SDL.c | 2 +- test/testver.c | 4 ++-- 5 files changed, 11 insertions(+), 15 deletions(-) diff --git a/build-scripts/showrev.sh b/build-scripts/showrev.sh index a33ac7c79..4607d6422 100755 --- a/build-scripts/showrev.sh +++ b/build-scripts/showrev.sh @@ -2,14 +2,7 @@ # # Print the current source revision, if available -srcdir=`dirname $0`/.. +# FIXME: this prints the tip, which isn't useful if you're on a different +# branch, or just not sync'd to the tip. +hg tip --template 'hg-{rev}:{node|short}' -if [ -d $srcdir/.svn ]; then - cd $srcdir - (svnversion -c 2>/dev/null || svnversion .) | \ - sed -e 's,\([0-9]*\)[A-Z]*,\1,' \ - -e 's,[0-9]*:\([0-9]*\)[A-Z]*,\1,' -else - cd $srcdir - git svn info | grep Revision | awk '{ print $2 }' -fi diff --git a/build-scripts/updaterev.sh b/build-scripts/updaterev.sh index 15ffb9574..1ee11e0c0 100755 --- a/build-scripts/updaterev.sh +++ b/build-scripts/updaterev.sh @@ -8,7 +8,7 @@ header=$srcdir/include/SDL_revision.h rev=`sh showrev.sh` if [ "$rev" != "" ]; then - echo "#define SDL_REVISION $rev" >$header.new + echo "#define SDL_REVISION \"$rev\"" >$header.new if diff $header $header.new >/dev/null 2>&1; then rm $header.new else diff --git a/include/SDL_version.h b/include/SDL_version.h index c2e4f9279..a2ab71c2a 100644 --- a/include/SDL_version.h +++ b/include/SDL_version.h @@ -139,8 +139,11 @@ extern DECLSPEC void SDLCALL SDL_GetVersion(SDL_version * ver); /** * \brief Get the code revision of SDL that is linked against your program. + * + * This is an arbitrary string (a hash value, actually), and is only useful + * in comparing against other revisions. It is NOT an incrementing number. */ -extern DECLSPEC int SDLCALL SDL_GetRevision(void); +extern DECLSPEC const char *SDLCALL SDL_GetRevision(void); /* Ends C function definitions when using C++ */ #ifdef __cplusplus diff --git a/src/SDL.c b/src/SDL.c index c423ccd32..52f141578 100644 --- a/src/SDL.c +++ b/src/SDL.c @@ -271,7 +271,7 @@ SDL_GetVersion(SDL_version * ver) } /* Get the library source revision */ -int +const char * SDL_GetRevision(void) { return SDL_REVISION; diff --git a/test/testver.c b/test/testver.c index 018b58e2e..65f4f9c74 100644 --- a/test/testver.c +++ b/test/testver.c @@ -20,10 +20,10 @@ main(int argc, char *argv[]) printf("Compiled with SDL older than 1.3\n"); #endif SDL_VERSION(&compiled); - printf("Compiled version: %d.%d.%d-%d\n", + printf("Compiled version: %d.%d.%d (%s)\n", compiled.major, compiled.minor, compiled.patch, SDL_REVISION); SDL_GetVersion(&linked); - printf("Linked version: %d.%d.%d-%d\n", + printf("Linked version: %d.%d.%d (%s)\n", linked.major, linked.minor, linked.patch, SDL_GetRevision()); SDL_Quit(); return (0);