|
@@ -19,4 +19,27 @@ if head=`git rev-parse --verify HEAD 2>/dev/null`; then
|
|
if git diff-index HEAD | read dummy; then
|
|
if git diff-index HEAD | read dummy; then
|
|
printf '%s' -dirty
|
|
printf '%s' -dirty
|
|
fi
|
|
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
|
|
fi
|