Skip to content

Instantly share code, notes, and snippets.

@KhasMek
Created February 2, 2013 21:17
Show Gist options
  • Select an option

  • Save KhasMek/4699293 to your computer and use it in GitHub Desktop.

Select an option

Save KhasMek/4699293 to your computer and use it in GitHub Desktop.
#!/bin/bash
#
# For Android Police
# From KhasMek
# I love you guys
#
# To run chmod a+x, move to the topdir of and AOSP build tree and execute
# ./tag_changelog_gen.sh "old tag label" "new tag label"
# example: ./tag_changelog_gen.sh android-4.1.2_r1 android-4.2_r1
cdate=`date +"%m_%d_%Y"`
rdir=`pwd`
old_tag="$1"
new_tag="$2"
# Find the directories to log
find $rdir -name .git | sed 's/\/.git//g' | sed 'N;$!P;$!D;$d' | while read line
do
cd $line
# Test to see if the repo needs to have a changelog written.
log=$(git log --pretty="%an - %s" --no-merges "$old_tag".."$new_tag")
project=$(git remote -v | head -n1 | awk '{print $2}' | sed 's~http[s]*://android.googlesource.com~~g')
if [ -z "$log" ]; then
echo "Nothing updated on $project, skipping"
else
# Write the changelog
echo "Project name: $project" >> "$rdir"/Changelog_"$old_tag"_"$new_tag".txt
echo "$log" | while read line
do
echo " •$line" >> "$rdir"/Changelog_"$old_tag"_"$new_tag".txt
done
echo "" >> "$rdir"/Changelog_"$old_tag"_"$new_tag".txt
fi
done
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment