]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
kbuild: support mercurial in setlocalversion
authorAron Griffis <aron@hp.com>
Wed, 28 Nov 2007 21:55:44 +0000 (16:55 -0500)
committerSam Ravnborg <sam@ravnborg.org>
Mon, 28 Jan 2008 22:14:36 +0000 (23:14 +0100)
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>
scripts/setlocalversion

index 82e4993f0a7368797989b2acd169fe203766fb7a..a80d6ea8a5bfbce21a8b08b664784886345f6d5f 100644 (file)
@@ -19,4 +19,27 @@ if head=`git rev-parse --verify HEAD 2>/dev/null`; then
        if git diff-index HEAD | read dummy; then
                printf '%s' -dirty
        fi
+
+       # All done with git
+       exit
+fi
+
+# Check for mercurial and a mercurial repo.
+if hgid=`hg id 2>/dev/null`; then
+       tag=`printf '%s' "$hgid" | cut -d' ' -f2`
+
+       # Do we have an untagged version?
+       if [ -z "$tag" -o "$tag" = tip ]; then
+               id=`printf '%s' "$hgid" | sed 's/[+ ].*//'`
+               printf '%s%s' -hg "$id"
+       fi
+
+       # Are there uncommitted changes?
+       # These are represented by + after the changeset id.
+       case "$hgid" in
+               *+|*+\ *) printf '%s' -dirty ;;
+       esac
+
+       # All done with mercurial
+       exit
 fi