codelines=`find . -type f -regex '\./.*\.h' -or -regex '\./.*\.c' |xargs cat|wc -l`
-svn_revision=`svn info | grep Revision | grep -o -E '[0-9]+'`
-if test "x$svn_revision" = "x" ; then
- svn_revision=`git log -n 1 --pretty="format:%h"`
- if test "x$svn_revision" = "x" ; then
- svn_revision="0"
+
+git_revision_id=`git rev-list -n 1 --pretty="format:%h" --header refs/heads/master | grep '^[0-9a-f]*$'`
+if test "x$git_revision_id" = "x" ; then
+ git_revision="0"
+ git_commitcount="0"
+ git_is_stable="1"
+ git_dev_rev=""
+else
+ git_commitcount=`git rev-list --oneline --first-parent refs/heads/master | wc -l | sed "s/[ \t]//g"`
+ git_revision="git-$git_revision_id"
+
+ git_real_revision_id=`git rev-list -n 1 --pretty="format:%h" --header HEAD | grep '^[0-9a-f]*$'`
+ if test "$git_revision_id" = "$git_real_revision_id" ; then
+ git_is_stable="1"
+ git_dev_rev=""
else
- git_commitcount=`git rev-list --all --no-merges | wc -l | sed "s/[ \t]//g"`
- svn_revision="git-$git_commitcount-$svn_revision"
+ git_is_stable="0"
+ git_dev_rev="git-$git_real_revision_id"
fi
-else
- svn_revision="svn-$svn_revision"
fi
/bin/cat > version.c <<!SUB!THIS!
+/* version.c - NeonServ v5.5
+ * Copyright (C) 2011-2012 Philipp Kreil (pk910)
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
//Auto generated file!
#include "version.h"
const char *compilation = "$compilation";
const char *creation = "$creation";
-const char *revision = "$svn_revision";
+const char *revision = "$git_revision";
const char *codelines = "$codelines";
+const int revision_master = $git_is_stable;
+const char *dev_revision = "$git_dev_rev";
+
+const int patchlevel = ($git_commitcount ? ($git_commitcount - VERSION_PATCHLEVEL) : 0);
+
+const char *get_compilation() {
+ return compilation;
+}
+
+const char *get_creation() {
+ return creation;
+}
+
+const char *get_revision() {
+ return revision;
+}
+
+const char *get_codelines() {
+ return codelines;
+}
+
+const int is_stable_revision() {
+ return revision_master;
+}
+
+const char *get_dev_revision() {
+ return dev_revision;
+}
+
+const int get_patchlevel() {
+ return patchlevel;
+}
!SUB!THIS!