Skip to content

Instantly share code, notes, and snippets.

@mrdon
Created May 19, 2010 06:32
Show Gist options
  • Save mrdon/406037 to your computer and use it in GitHub Desktop.
Save mrdon/406037 to your computer and use it in GitHub Desktop.
Prints a changelog in wiki format from git assuming an svn backend
#!/bin/bash
if [ "$1" == "--help" -o $# -lt 3 ]; then
echo "Usage: cl.sh STUDIO_PROJECT_KEY TAG_OLD TAG_NEW"
echo ""
echo "This command is meant to be ran in a git repository pointing at a remote svn repo"
exit 1
fi
oldtag=$2
newtag=$3
studioProjectKey=$1
git log --date=short --format=tformat:"subject:%s%nbody:%b" tags/$oldtag..tags/$newtag | \
sed -n "
/^subject:/ {
/^subject:\[maven\-/ !{
s/subject://
s/\([^\n]\{1,180\}\).*/* \1/
s|\($studioProjectKey\-[0-9]\+\)|[\1\|http://studio.atlassian.com/browse/\1]|
p
}
}
/git-svn-id:/ {
s|.*@\([0-9]\+\) .*| [more\|http://studio.atlassian.com/source/changelog/$studioProjectKey?cs=\1]|
p
} " | \
sed -n '
/^ \[more/!{
h
n
H
x
s/\n//
p
}'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment