#!/bin/bash

vcsname="$(./vcs-name)"

if [ "$vcsname" == "git" ]
then
git log --first-parent --pretty=oneline | wc -l | tr -d ' '
exit 0
fi

if [ "$vcsname" == "hg" ]
then
hg log --follow-first --template='{node}\n' | wc -l | tr -d ' '
exit 0
fi

if [ "$vcsname" == "bzr" ]
then
bzr revno | tr -d ' '
exit 0
fi

if [ "$(pwd | grep unetbootin-source-[0-9])" != "" ]
then
pwd | tr '/' '\n' | grep 'unetbootin-source-' | sed "s/unetbootin-source-//" | tr -d ' '
exit 0
fi

if [ "$(pwd | grep unetbootin-[0-9])" != "" ]
then
pwd | tr '/' '\n' | grep 'unetbootin-' | sed "s/unetbootin-//" | tr -d ' '
exit 0
fi

date "+%Y%m%d"

