#!/bin/bash
# Small script to easily generate a ChangeLog from git log.

SCM=$(which git)
AWK=$(which awk)

repo=$(dirname $0)/..

$SCM log --format="%d|%cd|%s" --date=short -C $repo |\
    $AWK -F'|'\
        '/^\|/    { print "  * " $3 }\
         /^\ \(HEAD/ { print "\nLazygal ##DEVELOPMENT VERSION## (" $2 ")";\
                    print "  * " $3\
                  }
         /^\ \(tag\:\ / { \
                    gsub(/\ \(tag\:\ /,"",$1);\
                    gsub(/\)/,"",$1);\
                    print "\nLazygal " $1 " (" $2 ")";\
                    print "  * " $3\
                  }'\
    > $repo/ChangeLog-full
