#!/bin/bash # Make Changelog original made by izdubar for Mercurial # Update for GIT by Caio99BR (cat << EOF) > /tmp/DETAILED_CHANGELOG Automatically Generated by make_changelog.sh. DO NOT EDIT ----------------------------------------------------------------------------- Copyright 2009-2010, Ifcaro & jimmikaelkael Licenced under Academic Free License version 3.0 Review Open PS2 Loader README & LICENSE files for further details. ----------------------------------------------------------------------------- Open PS2 Loader Detailed ChangeLog: EOF while true do # Check if it have .git folder if ! [ -d .git ] then echo "No .git folder found, exiting..." break fi # Store author, commit and date on temp file git log --pretty=format:"%>(18,trunc)%ci%h - %<(18)%an %s" > /tmp/commit_summary if [ "${?}" != "0" ] then echo "Git command failed, exiting..." break fi # Hack for fix first commit not showed printf '\n' >> /tmp/commit_summary # Store number of commits old_number_commits=$(($(grep "rev" < OLD_DETAILED_CHANGELOG | head -1 | cut -d " " -f 1 | cut -c 4-))) number_commits=$(wc -l < /tmp/commit_summary) new_number_commits=$((number_commits - old_number_commits + 2)) # Echo it! echo "Current Revision ${number_commits} (Of BitBucket r${old_number_commits} + Of GIT r${new_number_commits})" # Store author, commit and date on temp file git log -${new_number_commits} --pretty=format:"%>(18,trunc)%ci%h - %<(32)%an %s" > /tmp/commit_summary if [ "${?}" != "0" ] then echo "Git command failed, exiting..." break fi # Hack for fix first commit not showed printf '\n' >> /tmp/commit_summary # Reverse commit history gawk '{ L[n++] = $0 } END { while(n--) print L[n] }' /tmp/commit_summary > /tmp/commit_summary_reverse # Store each commit in one variable[list] while read line_commit_summary do old_number_commits=$((old_number_commits + 1)) echo "rev${old_number_commits} - ${line_commit_summary}" >> /tmp/commit_summary_new done < /tmp/commit_summary_reverse # Reverse commmit history again gawk '{ L[n++] = $0 } END { while(n--) print L[n] }' /tmp/commit_summary_new > /tmp/commit_summary # Finish it cat /tmp/DETAILED_CHANGELOG /tmp/commit_summary > DETAILED_CHANGELOG # Clean it rm -fr /tmp/commit_summary* /tmp/DETAILED_CHANGELOG* # Echo it again! echo "Add ${new_number_commits} revisions of GIT to DETAILED_CHANGELOG created." # Exit break done