3 TOPDIR="${0%mkrevision.sh}"
5 [ -d "$TOPDIR/../build" ] || {
6 echo "Please execute as ./build/mkrevision.sh" >&2
12 if svn info >/dev/null 2>/dev/null; then
13 revision="svn-r$(LC_ALL=C svn info | sed -ne 's/^Revision: //p')"
14 elif git log -1 >/dev/null 2>/dev/null; then
15 revision="svn-r$(LC_ALL=C git log -1 | sed -ne 's/.*git-svn-id: .*@\([0-9]\+\) .*/\1/p')"
16 if [ "$revision" = "svn-r" ]; then
17 set -- $(git log -1 --format="%ct %h")
18 secs="$(($1 % 86400))"
19 yday="$(date --utc --date="@$1" "+%y.%j")"
20 revision="$(printf 'git-%s.%05d-%s' "$yday" "$secs" "$2")"