#!/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"