changeset 4419:5e7e1f1a4056

Changed revision details to be a string (an hg changeset) instead of an int.
author Ryan C. Gordon <icculus@icculus.org>
date Sun, 28 Feb 2010 02:07:40 -0500
parents be1929ccaa3d
children 2e140f18aba7
files build-scripts/showrev.sh build-scripts/updaterev.sh include/SDL_version.h src/SDL.c test/testver.c
diffstat 5 files changed, 11 insertions(+), 15 deletions(-) [+]
line wrap: on
line diff
--- a/build-scripts/showrev.sh	Sun Feb 28 02:06:47 2010 -0500
+++ b/build-scripts/showrev.sh	Sun Feb 28 02:07:40 2010 -0500
@@ -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
--- a/build-scripts/updaterev.sh	Sun Feb 28 02:06:47 2010 -0500
+++ b/build-scripts/updaterev.sh	Sun Feb 28 02:07:40 2010 -0500
@@ -8,7 +8,7 @@
 
 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
--- a/include/SDL_version.h	Sun Feb 28 02:06:47 2010 -0500
+++ b/include/SDL_version.h	Sun Feb 28 02:07:40 2010 -0500
@@ -139,8 +139,11 @@
 
 /**
  *  \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
--- a/src/SDL.c	Sun Feb 28 02:06:47 2010 -0500
+++ b/src/SDL.c	Sun Feb 28 02:07:40 2010 -0500
@@ -271,7 +271,7 @@
 }
 
 /* Get the library source revision */
-int
+const char *
 SDL_GetRevision(void)
 {
     return SDL_REVISION;
--- a/test/testver.c	Sun Feb 28 02:06:47 2010 -0500
+++ b/test/testver.c	Sun Feb 28 02:07:40 2010 -0500
@@ -20,10 +20,10 @@
     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);