Commit 3dce174c authored by Aron Griffis's avatar Aron Griffis Committed by Sam Ravnborg
Browse files

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: default avatarAron Griffis <>
Signed-off-by: default avatarSam Ravnborg <>
parent 2f4b489b
......@@ -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
# All done with git
# 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"
# Are there uncommitted changes?
# These are represented by + after the changeset id.
case "$hgid" in
*+|*+\ *) printf '%s' -dirty ;;
# All done with mercurial
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment