summaryrefslogtreecommitdiff
path: root/src/version.bash
blob: c2a70ac1f7813b789f5b8dc39cd029ee96e29a32 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#!/usr/bin/env bash
# Copyright 2010 The Go Authors. All rights reserved.
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.

# Check that we can use 'hg'
if ! hg version > /dev/null 2>&1; then
	echo 'hg not installed' 1>&2
	exit 2
fi

# Get numerical revision
VERSION="`hg identify -n`"

# Append tag if not 'tip'
TAG=$(hg identify -t | sed 's!/release!!')
if [[ "$TAG" != "tip" ]]; then
	VERSION="$VERSION $TAG"
fi

echo $VERSION