Deprecate SDL_GetRevisionNumber and update things for git instead of hg. Fixes #4063
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170
diff --git a/build-scripts/update-copyright.sh b/build-scripts/update-copyright.sh
index 5955b09..ea1f798 100755
--- a/build-scripts/update-copyright.sh
+++ b/build-scripts/update-copyright.sh
@@ -1,7 +1,7 @@
#!/bin/sh
find . -type f -exec grep -Il "Copyright" {} \; \
-| grep -v \.hg \
+| grep -v \.git \
| while read file; \
do \
LC_ALL=C sed -b -i "s/\(.*Copyright.*\)[0-9]\{4\}\( *Sam Lantinga\)/\1`date +%Y`\2/" "$file"; \
diff --git a/configure b/configure
index 8b1c1c2..0b3079c 100755
--- a/configure
+++ b/configure
@@ -16000,9 +16000,9 @@ esac
if test x$srcdir != x.; then
INCLUDE="-Iinclude $INCLUDE"
-elif test -d .hg; then
+elif test -d .git; then
as_fn_error $? "
-*** When building from Mercurial you should configure and build in a
+*** When building from a git clone you should configure and build in a
separate directory so you don't clobber SDL_config.h, SDL_revision.h
" "$LINENO" 5
fi
diff --git a/configure.ac b/configure.ac
index 7d119ad..950a488 100644
--- a/configure.ac
+++ b/configure.ac
@@ -82,9 +82,9 @@ esac
if test x$srcdir != x.; then
INCLUDE="-Iinclude $INCLUDE"
-elif test -d .hg; then
+elif test -d .git; then
AC_MSG_ERROR([
-*** When building from Mercurial you should configure and build in a
+*** When building from a git clone you should configure and build in a
separate directory so you don't clobber SDL_config.h, SDL_revision.h
])
fi
diff --git a/docs/README-hg.md b/docs/README-hg.md
index 6562bcb..4e35683 100644
--- a/docs/README-hg.md
+++ b/docs/README-hg.md
@@ -1,6 +1,4 @@
-We are no longer hosted in Mercurial. The official repo is now:
-
- https://github.com/libsdl-org/SDL
+We are no longer hosted in Mercurial. Please see README-git.md for details.
Thanks!
diff --git a/docs/README-linux.md b/docs/README-linux.md
index c3685fb..3136851 100644
--- a/docs/README-linux.md
+++ b/docs/README-linux.md
@@ -15,7 +15,7 @@ Build Dependencies
Ubuntu 20.04, all available features enabled:
-sudo apt-get install build-essential mercurial make cmake autoconf automake \
+sudo apt-get install build-essential git make cmake autoconf automake \
libtool libasound2-dev libpulse-dev libaudio-dev libx11-dev libxext-dev \
libxrandr-dev libxcursor-dev libxi-dev libxinerama-dev libxxf86vm-dev \
libxss-dev libgl1-mesa-dev libdbus-1-dev libudev-dev libgles2-mesa-dev \
diff --git a/docs/README.md b/docs/README.md
index 7e2c151..68071ef 100644
--- a/docs/README.md
+++ b/docs/README.md
@@ -35,7 +35,7 @@ More documentation and FAQs are available online at [the wiki](http://wiki.libsd
- [DynAPI](README-dynapi.md)
- [Emscripten](README-emscripten.md)
- [Gesture](README-gesture.md)
-- [Mercurial](README-hg.md)
+- [Git](README-git.md)
- [iOS](README-ios.md)
- [Linux](README-linux.md)
- [OS X](README-macosx.md)
diff --git a/include/SDL_version.h b/include/SDL_version.h
index a2b63e1..a78ac72 100644
--- a/include/SDL_version.h
+++ b/include/SDL_version.h
@@ -142,13 +142,15 @@ extern DECLSPEC void SDLCALL SDL_GetVersion(SDL_version * ver);
extern DECLSPEC const char *SDLCALL SDL_GetRevision(void);
/**
- * \brief Get the revision number of SDL that is linked against your program.
+ * \brief Obsolete function, do not use.
*
- * Returns a number uniquely identifying the exact revision of the SDL
- * library in use. It is an incrementing number based on commits to
- * hg.libsdl.org.
+ * When SDL was hosted in a Mercurial repository, and was built carefully,
+ * this would return the revision number that the build was created from.
+ * This number was not reliable for several reasons, but more importantly,
+ * SDL is now hosted in a git repository, which does not offer numbers at
+ * all, only hashes. This function only ever returns zero now. Don't use it.
*/
-extern DECLSPEC int SDLCALL SDL_GetRevisionNumber(void);
+extern SDL_DEPRECATED DECLSPEC int SDLCALL SDL_GetRevisionNumber(void);
/* Ends C function definitions when using C++ */
diff --git a/src/SDL.c b/src/SDL.c
index cf6d7d7..124acee 100644
--- a/src/SDL.c
+++ b/src/SDL.c
@@ -468,7 +468,7 @@ SDL_GetRevision(void)
int
SDL_GetRevisionNumber(void)
{
- return SDL_REVISION_NUMBER;
+ return 0; /* doesn't make sense without Mercurial. */
}
/* Get the name of the platform */
diff --git a/src/dynapi/gendynapi.pl b/src/dynapi/gendynapi.pl
index 42a5ece..beb4a35 100755
--- a/src/dynapi/gendynapi.pl
+++ b/src/dynapi/gendynapi.pl
@@ -21,7 +21,7 @@
# WHAT IS THIS?
# When you add a public API to SDL, please run this script, make sure the
-# output looks sane (hg diff, it adds to existing files), and commit it.
+# output looks sane (git diff, it adds to existing files), and commit it.
# It keeps the dynamic API jump table operating correctly.
# If you wanted this to be readable, you shouldn't have used perl.
diff --git a/test/testautomation_platform.c b/test/testautomation_platform.c
index 7cc732a..d4a68ca 100644
--- a/test/testautomation_platform.c
+++ b/test/testautomation_platform.c
@@ -141,9 +141,6 @@ int platform_testGetFunctions (void *arg)
SDLTest_AssertPass("SDL_GetRevision()");
SDLTest_AssertCheck(revision != NULL, "SDL_GetRevision() != NULL");
- ret = SDL_GetRevisionNumber();
- SDLTest_AssertPass("SDL_GetRevisionNumber()");
-
return TEST_COMPLETED;
}
diff --git a/test/testver.c b/test/testver.c
index d8c937e..b31363c 100644
--- a/test/testver.c
+++ b/test/testver.c
@@ -35,13 +35,13 @@ main(int argc, char *argv[])
SDL_Log("Compiled with SDL older than 2.0\n");
#endif
SDL_VERSION(&compiled);
- SDL_Log("Compiled version: %d.%d.%d.%d (%s)\n",
+ SDL_Log("Compiled version: %d.%d.%d (%s)\n",
compiled.major, compiled.minor, compiled.patch,
- SDL_REVISION_NUMBER, SDL_REVISION);
+ SDL_REVISION);
SDL_GetVersion(&linked);
- SDL_Log("Linked version: %d.%d.%d.%d (%s)\n",
+ SDL_Log("Linked version: %d.%d.%d (%s)\n",
linked.major, linked.minor, linked.patch,
- SDL_GetRevisionNumber(), SDL_GetRevision());
+ SDL_GetRevision());
SDL_Quit();
return (0);
}