@@ 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"
}