contrib/packagelib.sh
author Yuya Nishihara <yuya@tcha.org>
Sun, 27 Sep 2015 22:19:54 +0900
changeset 26398 70abba798098
parent 24972 56c64c91b429
child 26833 6474b64045fb
permissions -rw-r--r--
check-seclevel: wrap entry point by function This is intended to narrow scope of local variables. The global _verbose flag will be replaced later by ui.verbose.

gethgversion() {
    make clean
    make local || make local PURE=--pure
    HG="$PWD/hg"

    $HG version > /dev/null || { echo 'abort: hg version failed!'; exit 1 ; }

    hgversion=`$HG version | sed -ne 's/.*(version \(.*\))$/\1/p'`

    if echo $hgversion | grep -- '-' > /dev/null 2>&1; then
        # nightly build case, version is like 1.3.1+250-20b91f91f9ca
        version=`echo $hgversion | cut -d- -f1`
        release=`echo $hgversion | cut -d- -f2 | sed -e 's/+.*//'`
    else
        # official tag, version is like 1.3.1
        version=`echo $hgversion | sed -e 's/+.*//'`
        release='0'
    fi
}