4 [ -n "$TOPDIR" ] && cd $TOPDIR
9 [ -f version ] || return 1
15 git rev-parse --git-dir >/dev/null 2>&1 || return 1
17 [ -n "$GET_REV" ] || GET_REV="HEAD"
21 GET_REV="$(echo $GET_REV | tr -d 'r')"
22 BASE_REV="$(git rev-list reboot..HEAD --count)"
23 REV="$(git rev-parse HEAD~$((BASE_REV - GET_REV)))"
26 UPSTREAM_BASE="$(git merge-base $GET_REV origin/master)"
27 UPSTREAM_REV="$(git rev-list reboot..$UPSTREAM_BASE --count)"
28 REV="$(git rev-list reboot..$GET_REV --count)"
29 if [ -n "$REV" -a -n "$UPSTREAM_REV" -a "$REV" -gt "$UPSTREAM_REV" ]; then
30 REV="r${UPSTREAM_REV}+$((REV - UPSTREAM_REV))"
41 [ -d .hg ] || return 1
42 REV="$(hg log -r-1 --template '{desc}' | awk '{print $2}' | sed 's/\].*//')"
47 try_version || try_git || try_hg || REV="unknown"