~dricottone/huttese-apk

e22186f7300ff084161f402698c07d18c4608cd6 — Drew DeVault 5 years ago af85ab7
Add hg support to `pkgkit pkgver`
1 files changed, 17 insertions(+), 5 deletions(-)

M pkgkit
M pkgkit => pkgkit +17 -5
@@ 139,12 139,24 @@ print_pkgver() {
		usage
		exit 1
	fi
	pkgver=$(git describe --abbrev=0)
	if ! git describe --exact-match HEAD >/dev/null 2>&1
	if [ -d .git ]
	then
		cdate=$(git show -s -1 --format='%ci' HEAD)
		cdate=$(echo "$cdate" | cut -d' ' -f1 | sed -e 's/-//g')
		pkgver="${pkgver}_git${cdate}"
		pkgver=$(git describe --abbrev=0)
		if ! git describe --exact-match HEAD >/dev/null 2>&1
		then
			cdate=$(git show -s -1 --format='%ci' HEAD)
			cdate=$(echo "$cdate" | cut -d' ' -f1 | sed -e 's/-//g')
			pkgver="${pkgver}_git${cdate}"
		fi
	elif [ -d .hg ]
	then
		pkgver=$(hg id -t)
		if [ "$pkgver" = "tip" ]
		then
			pkgver="$(hg id -T '{latesttag}_hg{sub("-", "", date|shortdate)}')"
		fi
	else
		pkgver=unknown_0000
	fi
	echo "$pkgver"
}