[PATCH try#2 ] kbuild: add svn revision information to setlocalversion

Bryan Wu
2008-02-03T06:13:29Z

From 0a7a2c6f19d32a85ca1a7887382325170ef19a66 Mon Sep 17 00:00:00 2001
From: Bryan Wu <bryan.wu@analog.com>
Date: Sun, 3 Feb 2008 14:05:00 +0800
Subject: [PATCH] [Scripts] add svn revision information to setlocalversion

follow git and mercurial style, include uncommitted changes detect

Cc: Frans Pop <elendil@planet.nl>
Signed-off-by: Bryan Wu <bryan.wu@analog.com>
---
scripts/setlocalversion | 16 ++++++++++++++++
1 files changed, 16 insertions(+), 0 deletions(-)
mode change 100644 => 100755 scripts/setlocalversion

diff --git a/scripts/setlocalversion b/scripts/setlocalversion
old mode 100644
new mode 100755
index 52f032e..1c1bdaf
--- a/scripts/setlocalversion
+++ b/scripts/setlocalversion
@@ -45,3 +45,19 @@ if hgid=`hg id 2>/dev/null`; then
# All done with mercurial
exit
fi
+
+# Check for svn and a svn repo.
+if rev=`svn info 2>/dev/null | grep '^Revision'`; then
+ rev=`echo $rev | awk '{print $NF}'`
+ changes=`svn status 2>/dev/null | grep '^[AMD]' | wc -l`
+
+ # Are there uncommitted changes?
+ if [ $changes != 0 ]; then
+ printf -- '-svn%s%s%s' "$rev" -dirty "$changes"
+ else
+ printf -- '-svn%s' "$rev"
+ fi
+
+ # All done with svn
+ exit
+fi
--
1.5.3.4