From b12f24c5695d6818ddd017100f12ffba730da924 Mon Sep 17 00:00:00 2001 From: Aron Griffis Date: Wed, 28 Nov 2007 16:55:44 -0500 Subject: [PATCH] --- yaml --- r: 77946 b: refs/heads/master c: 3dce174cfcba11026b028d33bed0438b80e37124 h: refs/heads/master v: v3 --- [refs] | 2 +- trunk/scripts/setlocalversion | 23 +++++++++++++++++++++++ 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/[refs] b/[refs] index d1b708e10b84..c02f013d5e85 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 2f4b489b77c68b9cba1bd9dec5a1bbf0ab3c47f8 +refs/heads/master: 3dce174cfcba11026b028d33bed0438b80e37124 diff --git a/trunk/scripts/setlocalversion b/trunk/scripts/setlocalversion index 82e4993f0a73..a80d6ea8a5bf 100644 --- a/trunk/scripts/setlocalversion +++ b/trunk/scripts/setlocalversion @@ -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