aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAron Griffis <aron@hp.com>2007-11-28 16:55:44 -0500
committerSam Ravnborg <sam@ravnborg.org>2008-01-28 17:14:36 -0500
commit3dce174cfcba11026b028d33bed0438b80e37124 (patch)
tree175ed5a8a882409a2ccbb6a60a66ae556730740f
parent2f4b489b77c68b9cba1bd9dec5a1bbf0ab3c47f8 (diff)
kbuild: support mercurial in setlocalversion
This represents mercurial changesets similarly to git. For untagged revisions, append the changeset id. If there are uncommitted changes, append -dirty. For example, -hgc60016ba6237-dirty Signed-off-by: Aron Griffis <aron@hp.com> Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
-rw-r--r--scripts/setlocalversion23
1 files changed, 23 insertions, 0 deletions
diff --git a/scripts/setlocalversion b/scripts/setlocalversion
index 82e4993f0a73..a80d6ea8a5bf 100644
--- a/scripts/setlocalversion
+++ b/scripts/setlocalversion
@@ -19,4 +19,27 @@ if head=`git rev-parse --verify HEAD 2>/dev/null`; then
19 if git diff-index HEAD | read dummy; then 19 if git diff-index HEAD | read dummy; then
20 printf '%s' -dirty 20 printf '%s' -dirty
21 fi 21 fi
22
23 # All done with git
24 exit
25fi
26
27# Check for mercurial and a mercurial repo.
28if hgid=`hg id 2>/dev/null`; then
29 tag=`printf '%s' "$hgid" | cut -d' ' -f2`
30
31 # Do we have an untagged version?
32 if [ -z "$tag" -o "$tag" = tip ]; then
33 id=`printf '%s' "$hgid" | sed 's/[+ ].*//'`
34 printf '%s%s' -hg "$id"
35 fi
36
37 # Are there uncommitted changes?
38 # These are represented by + after the changeset id.
39 case "$hgid" in
40 *+|*+\ *) printf '%s' -dirty ;;
41 esac
42
43 # All done with mercurial
44 exit
22fi 45fi