Skip to content

Commit ba3d05f

Browse files
Bryan Wusravnborg
authored andcommitted
kbuild: 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> Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
1 parent fa95eb1 commit ba3d05f

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

‎scripts/setlocalversion‎

100644100755
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,3 +45,19 @@ if hgid=`hg id 2>/dev/null`; then
4545
# All done with mercurial
4646
exit
4747
fi
48+
49+
# Check for svn and a svn repo.
50+
if rev=`svn info 2>/dev/null | grep '^Revision'`; then
51+
rev=`echo $rev | awk '{print $NF}'`
52+
changes=`svn status 2>/dev/null | grep '^[AMD]' | wc -l`
53+
54+
# Are there uncommitted changes?
55+
if [ $changes != 0 ]; then
56+
printf -- '-svn%s%s%s' "$rev" -dirty "$changes"
57+
else
58+
printf -- '-svn%s' "$rev"
59+
fi
60+
61+
# All done with svn
62+
exit
63+
fi

0 commit comments

Comments
 (0)