2008-12-02 20:58:20

by Peter Korsgaard

[permalink] [raw]
Subject: [PATCH] setlocalversion: print correct subversion revision

Output svn revision of latest change, instead of repo revision as thats
what we're interested in (especially when working on a branch/tag).

Signed-off-by: Peter Korsgaard <[email protected]>
---
scripts/setlocalversion | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/scripts/setlocalversion b/scripts/setlocalversion
index 72d2335..81d984b 100755
--- a/scripts/setlocalversion
+++ b/scripts/setlocalversion
@@ -51,7 +51,7 @@ if hgid=`hg id 2>/dev/null`; then
fi

# Check for svn and a svn repo.
-if rev=`svn info 2>/dev/null | grep '^Revision'`; then
+if rev=`svn info 2>/dev/null | grep '^Last Changed Rev'`; then
rev=`echo $rev | awk '{print $NF}'`
changes=`svn status 2>/dev/null | grep '^[AMD]' | wc -l`

--
1.5.6.5


2008-12-02 20:58:35

by Peter Korsgaard

[permalink] [raw]
Subject: [PATCH] setlocalversion: add git-svn support

Print svn revision in addition to git info on git-svn repos.

Signed-off-by: Peter Korsgaard <[email protected]>
---
scripts/setlocalversion | 5 +++++
1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/scripts/setlocalversion b/scripts/setlocalversion
index 81d984b..f6946cf 100755
--- a/scripts/setlocalversion
+++ b/scripts/setlocalversion
@@ -19,6 +19,11 @@ if head=`git rev-parse --verify --short HEAD 2>/dev/null`; then
fi
fi

+ # Is this git on svn?
+ if git config --get svn-remote.svn.url >/dev/null; then
+ printf -- '-svn%s' "`git-svn find-rev $head`"
+ fi
+
# Are there uncommitted changes?
git update-index --refresh --unmerged > /dev/null
if git diff-index --name-only HEAD | grep -v "^scripts/package" \
--
1.5.6.5

2008-12-03 07:23:18

by Sam Ravnborg

[permalink] [raw]
Subject: Re: [PATCH] setlocalversion: print correct subversion revision

Hi Peter.
On Tue, Dec 02, 2008 at 09:58:05PM +0100, Peter Korsgaard wrote:
> Output svn revision of latest change, instead of repo revision as thats
> what we're interested in (especially when working on a branch/tag).

Looks good. I will apply when I get on top of kbuild stuff which
I expect to do this weekend.

Sam

2008-12-03 21:57:38

by Sam Ravnborg

[permalink] [raw]
Subject: Re: [PATCH] setlocalversion: print correct subversion revision

On Tue, Dec 02, 2008 at 09:58:05PM +0100, Peter Korsgaard wrote:
> Output svn revision of latest change, instead of repo revision as thats
> what we're interested in (especially when working on a branch/tag).
>
> Signed-off-by: Peter Korsgaard <[email protected]>

Applied both patches - thanks Peter.

Sam