Home | History | Annotate | Download | only in scripts
      1 #!/bin/sh
      2 #
      3 # Dumb script for making a ChangeLog.
      4 #
      5 # Invoke like:
      6 #
      7 # scripts/git2changelog.sh --after="2010-02-01" --until="2010-02-31"
      8 #
      9 
     10 set -e
     11 
     12 tmp_changelog=$(mktemp /tmp/changelog.XXXXXX)
     13 
     14 trap "[ -f '$tmp_changelog' ] && rm -f '$tmp_changelog'; [ -f '$changelog~' ] && mv '$changelog~' '$changelog'" 0 2 15
     15 
     16 changelog="${0%/*}/../ChangeLog"
     17 
     18 git log --format="%nCommit: %H%nDate:   %aD%n%n%s%n%b%nChanged Files:" \
     19 	--name-only "$@" > "$tmp_changelog"
     20 
     21 cat "$changelog" >> "$tmp_changelog"
     22 
     23 mv "$changelog" "$changelog~"
     24 
     25 # This may take a while...
     26 mv "$tmp_changelog" "$changelog"
     27 
     28 rm -f "$changelog~"
     29