3 # determine-version -- report a useful version for releases
5 # Copyright 2008, Aron Griffis <agriffis@n01se.net>
6 # Copyright 2008, Oracle
7 # Released under the GNU GPLv2
12 if [ -d .hg ] && [ $? == 0 ]; then
13 last=$(hg tags | grep -m1 -o '^v[0-9.]\+')
15 # now check if the repo has commits since then...
16 if [[ $(hg id -t) == $last || \
17 $(hg di -r "$last:." | awk '/^diff/{print $NF}' | sort -u) == .hgtags ]]
20 if [[ $(hg id | cut -d' ' -f1) == *+ ]]; then
31 echo "#ifndef __BUILD_VERSION" > .build-version.h
32 echo "#define __BUILD_VERSION" >> .build-version.h
33 echo "#define BTRFS_BUILD_VERSION \"Btrfs $v\"" >> .build-version.h
34 echo "#endif" >> .build-version.h
36 diff -q version.h .build-version.h >& /dev/null
43 mv .build-version.h version.h