From 5de075ee96dc6fc8b18e37a70af93fca66bbfa25 Mon Sep 17 00:00:00 2001 From: rmanfredi Date: Wed, 28 May 2008 11:16:28 +0000 Subject: Added automatic SVN revision computation in "revision.h". git-svn-id: https://dist.svn.sourceforge.net/svnroot/dist/trunk/dist@24 190e5f8e-a817-0410-acf6-e9863daed9af --- bin/svn-revision | 61 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ revision.h | 7 +++++++ 2 files changed, 68 insertions(+) create mode 100755 bin/svn-revision create mode 100644 revision.h diff --git a/bin/svn-revision b/bin/svn-revision new file mode 100755 index 0000000..0d88b3b --- /dev/null +++ b/bin/svn-revision @@ -0,0 +1,61 @@ +#!/bin/sh + +# +# $Id: svn-revision 12303 2006-11-11 08:11:46Z cbiere $ +# +# Copyright (c) 2006, Raphael Manfredi +# +# You may redistribute only under the terms of the Artistic Licence, +# as specified in the README file that comes with the distribution. +# You may reuse parts of this distribution only within the terms of +# that same Artistic Licence; a copy of which may be found at the root +# of the source tree for dist 4.0. +# +# Computes SVN current revision number, if possible, emitting it in +# the form of a #define for C perusal. +# + +LC_ALL=C +export LC_ALL + +TOP="$1" +FILE="$2" + +if [ "x$FILE" = x ]; then + FILE="&1" + oldrev='' +else + oldrev=`grep REVISION "$FILE" 2>/dev/null | head -n1 | cut -d' ' -f3` +fi + +if test -d "$TOP/.svn"; then + revnum=`svn info "$TOP" 2>/dev/null | grep '^Revision' | head -n1 | cut -d' ' -f2` +else + revnum="$oldrev" # keep as is +fi + +if [ "x$revnum" = "x$oldrev" ]; then + exit 0 +fi + +{ +stamp=`date +"%Y-%m-%d %H:%M:%d %z"` +cat < "$FILE" + diff --git a/revision.h b/revision.h new file mode 100644 index 0000000..20f4e73 --- /dev/null +++ b/revision.h @@ -0,0 +1,7 @@ +/* + * THIS FILE IS AUTOMATICALLY GENERATED -- DO NOT EDIT ME + * + * Generated by ./bin/svn-revision. + */ + +#define REVISION 17 -- cgit v1.2.3