2 # Print additional version information for non-release trees.
5 echo "Usage: $0 [srctree]" >&2
11 # Check for git and a git repo.
12 if head=`git rev-parse --verify HEAD 2>/dev/null`; then
13 # Do we have an untagged version?
14 if git name-rev
--tags HEAD |
grep -E '^HEAD[[:space:]]+(.*~[0-9]*|undefined)$' > /dev
/null
; then
15 git describe |
awk -F- '{printf("-%05d-%s", $(NF-1),$(NF))}'
18 # Are there uncommitted changes?
19 git update-index
--refresh --unmerged > /dev
/null
20 if git diff-index
--name-only HEAD |
grep -v "^scripts/package" \
29 # Check for mercurial and a mercurial repo.
30 if hgid
=`hg id 2>/dev/null`; then
31 tag
=`printf '%s' "$hgid" | cut -d' ' -f2`
33 # Do we have an untagged version?
34 if [ -z "$tag" -o "$tag" = tip
]; then
35 id
=`printf '%s' "$hgid" | sed 's/[+ ].*//'`
36 printf '%s%s' -hg "$id"
39 # Are there uncommitted changes?
40 # These are represented by + after the changeset id.
42 *+|
*+\
*) printf '%s' -dirty ;;
45 # All done with mercurial