ptrace: arch_has_single_step
[linux-2.6/linux-acpi-2.6/ibm-acpi-2.6.git] / scripts / setlocalversion
blob52f032e409a38b9c9eef8f5b340038d66805eb40
1 #!/bin/sh
2 # Print additional version information for non-release trees.
4 usage() {
5 echo "Usage: $0 [srctree]" >&2
6 exit 1
9 cd "${1:-.}" || usage
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" \
21 | read dummy; then
22 printf '%s' -dirty
25 # All done with git
26 exit
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.
41 case "$hgid" in
42 *+|*+\ *) printf '%s' -dirty ;;
43 esac
45 # All done with mercurial
46 exit