setlocalversion: sync with HEAD of kernel git
Outputs correct svn revision (latest change, not repo version).
This commit is contained in:
parent
87736033ab
commit
8bc48ee108
@ -9,15 +9,19 @@ usage() {
|
|||||||
cd "${1:-.}" || usage
|
cd "${1:-.}" || usage
|
||||||
|
|
||||||
# Check for git and a git repo.
|
# Check for git and a git repo.
|
||||||
if head=`git rev-parse --verify HEAD 2>/dev/null`; then
|
if head=`git rev-parse --verify --short HEAD 2>/dev/null`; then
|
||||||
# Do we have an untagged version?
|
# Do we have an untagged version?
|
||||||
if git name-rev --tags HEAD | grep -E '^HEAD[[:space:]]+(.*~[0-9]*|undefined)$' > /dev/null; then
|
if git name-rev --tags HEAD | grep -E '^HEAD[[:space:]]+(.*~[0-9]*|undefined)$' > /dev/null; then
|
||||||
git describe 2>/dev/null | awk -F- '{printf("-%05d-%s", $(NF-1),$(NF))}'
|
if tag=`git describe 2>/dev/null`; then
|
||||||
|
echo $tag | awk -F- '{printf("-%05d-%s", $(NF-1),$(NF))}'
|
||||||
|
else
|
||||||
|
printf '%s%s' -g $head
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Is this git on svn?
|
# Is this git on svn?
|
||||||
if git config --get svn-remote.svn.url >/dev/null; then
|
if git config --get svn-remote.svn.url >/dev/null; then
|
||||||
printf -- '-svn%s' "`git svn find-rev $head`"
|
printf -- '-svn%s' "`git-svn find-rev $head`"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Are there uncommitted changes?
|
# Are there uncommitted changes?
|
||||||
@ -52,13 +56,13 @@ if hgid=`hg id 2>/dev/null`; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# Check for svn and a svn repo.
|
# 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}'`
|
rev=`echo $rev | awk '{print $NF}'`
|
||||||
changes=`svn status 2>/dev/null | grep '^[AMD]' | wc -l`
|
changes=`svn status 2>/dev/null | grep '^[AMD]' | wc -l`
|
||||||
|
|
||||||
# Are there uncommitted changes?
|
# Are there uncommitted changes?
|
||||||
if [ $changes != 0 ]; then
|
if [ $changes != 0 ]; then
|
||||||
printf -- '-svn%s%s%s' "$rev" -dirty "$changes"
|
printf -- '-svn%s%s' "$rev" -dirty
|
||||||
else
|
else
|
||||||
printf -- '-svn%s' "$rev"
|
printf -- '-svn%s' "$rev"
|
||||||
fi
|
fi
|
||||||
|
Loading…
Reference in New Issue
Block a user