From 09e4be3761effabf638312e54aa3f48298d77157 Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Thu, 28 May 2009 07:34:57 +0000 Subject: [PATCH] improve the svn rev lookup process git-svn-id: https://urjtag.svn.sourceforge.net/svnroot/urjtag/trunk@1633 b68d4a1b-bc3d-0410-92ed-d4ac073336b7 --- urjtag/ChangeLog | 5 +++++ urjtag/configure.ac | 16 +++++++++------- 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/urjtag/ChangeLog b/urjtag/ChangeLog index 3f010d58..7a1f1ec9 100644 --- a/urjtag/ChangeLog +++ b/urjtag/ChangeLog @@ -1,3 +1,8 @@ +2009-05-28 Mike Frysinger + + * configure.ac: improve svn rev look up by ignoring errors, unifying + duplicated code, and support git-svn tree + 2009-05-24 Rutger Hofman * src/bus/avr32.c: fix uninitialized warning (Florian Fainelli) diff --git a/urjtag/configure.ac b/urjtag/configure.ac index b47590c9..f9adcec9 100644 --- a/urjtag/configure.ac +++ b/urjtag/configure.ac @@ -35,19 +35,21 @@ AC_MSG_CHECKING([code revision]) SVN=`which svn` SVN_REVISION=0 if test -n "$SVN" -a -x "$SVN"; then - SVN_REVISION=`LC_ALL=C svn info -R "$srcdir" | awk 'BEGIN { x=0 } /^Revision: / { if($2>x) x=$2; } END { printf "%d\n",x }'` - if test "$SVN_REVISION" -ne "0" ; then - AC_MSG_RESULT([from svn info: $SVN_REVISION]) - fi + SVN_REVISION=`LC_ALL=C svn info -R "$srcdir" 2>/dev/null | awk 'BEGIN { x=0 } /^Revision: / { if($2>x) x=$2; } END { printf "%d\n",x }'` + SVN_FROM="svn info" fi if test "$SVN_REVISION" -eq 0 -a -e "$srcdir/ChangeLog"; then SVN_REVISION=`awk 'BEGIN { x=0 } /Revision: / { if($2>x) x=$2; } END { printf "%d\n",x }' "$srcdir/ChangeLog"` - if test "$SVN_REVISION" -ne "0" ; then - AC_MSG_RESULT([from ChangeLog: $SVN_REVISION]) - fi + SVN_FROM="ChangeLog" +fi +if test "$SVN_REVISION" -eq 0; then + SVN_REVISION=`git log -n1 --pretty=format:%b 2>/dev/null | sed -n '/^git-svn-id:/{s:.*@::;s: .*::;p}'` + SVN_FROM="git-svn log" fi if test "$SVN_REVISION" -eq "0" ; then AC_MSG_RESULT([unknown, using 0]) +else + AC_MSG_RESULT([from $SVN_FROM: $SVN_REVISION]) fi AC_DEFINE_UNQUOTED([SVN_REVISION], "$SVN_REVISION", [subversion revision number]) AC_SUBST([SVN_REVISION])