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

project=Lazygal

HG=$(which hg)
AWK=$(which awk)

repo=$(dirname $0)/..

$HG log --template '{tags}|{date|shortdate}|{desc|firstline}\n' -R $repo |\
    $AWK -F'|'\
        '/^\|.*\|Added tag [0-9\_]+ for changeset /    { next }\
         /^\|/    { print "  * " $3 }\
         /^tip\|/ { print "\nLazygal ##DEVELOPMENT VERSION## (" $2 ")";\
                    print "  * " $3\
                  }
         /^[0-9]/ { gsub(/\_/,".",$1);\
                    print "\nLazygal " $1 " (" $2 ")";\
                    print "  * " $3\
                  }'\
    > $repo/ChangeLog-full
