Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add script for changelog from subdirectory inforormation #96

Merged
merged 1 commit into from
Jul 15, 2014
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 51 additions & 0 deletions create_changelog.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
#!/bin/bash

# default arguments
SUB_DIRECTORIES="build/hrpsys-base-source"
TARGET_DIRECTORY=`rospack find hrpsys`; # for rosbuild
if [ ! -d $TARGET_DIRECTORY/$SUB_DIRECTORIES ]; # for catkin
then
TARGET_DIRECTORY=${TARGET_DIRECTORY/$(cd $(echo $CMAKE_PREFIX_PATH|cut -d\: -f1)/../src && pwd)/$(cd $(echo $CMAKE_PREFIX_PATH|cut -d\: -f1)/../build/ && pwd)/}
fi;
OUTPUT=/tmp/create_changelog.rst

function print-usage {
echo "Usage $0 : (options)"
echo " --sub-directories : sub directories for git source tree (default : \"$SUB_DIRECTORIES\")"
echo " --target-directory : target directory including CHANGELOG.rst (default : $TARGET_DIRECTORY)"
echo " --output : output file name (default : $OUTPUT)"
echo " --help : print this message"
}

while [ $# -gt 0 ]
do
case $1 in
-h|--help)
print-usage; exit 0;;
-s|--sub-directories)
SUB_DIRECTORIES=$2;shift;;
-t|--target-directory)
TARGET_DIRECTORY=$2;shift;;
-o|--output)
OUTPUT=$2;shift;;
*) break;;
esac
shift
done

LATEST_DATE=$(grep -m1 .\\.*\\. $TARGET_DIRECTORY/CHANGELOG.rst | cut -d\( -f2 | cut -d\) -f1)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@snozawa, this line will not work on catkin environment, use rospack find hrpsys/CHANGELOG.rst, or
remove SUB_DIRECTORIES, but use something like TARGET_DIRECTORY and SOURCE_DIRECTORY

# LATEST_DATE="2014-05-30" # for debug

echo "generate changelog"
echo " TARGET DIR : $TARGET_DIRECTORY"
echo " SUB_PACKAGE : $SUB_DIRECTORIES"
echo " LATEST DATE in CHANGELOG.rst : $LATEST_DATE"
echo " OUTPUT : $OUTPUT"
rm -f $OUTPUT $OUTPUT.*
for dir in $SUB_DIRECTORIES;
do
cd $TARGET_DIRECTORY/$dir;
rep_name=$(git remote -v |head -n1 | cut -d/ -f5|cut -d\ -f1); # Get repository name
git log --oneline --after=$LATEST_DATE --no-merges --date=short --pretty=format:"* %ad %h ($rep_name) %s" >> $OUTPUT.$$;
done;
sort $OUTPUT.$$ -r > $OUTPUT