Skip to content

ENH: Automate updates of CHANGES #2440

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

Merged
merged 5 commits into from
Feb 20, 2018
Merged
Show file tree
Hide file tree
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
3 changes: 0 additions & 3 deletions CHANGES
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
Upcoming release
================

1.0.0 (January 24, 2018)
========================

Expand Down
40 changes: 40 additions & 0 deletions tools/update_changes.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
#!/bin/bash
#
# Collects the pull-requests since the latest release and
# aranges them in the CHANGES.txt file.
#
# This is a script to be run before releasing a new version.
#
# Usage /bin/bash update_changes.sh 1.0.1
#

# Setting # $ help set
set -u # Treat unset variables as an error when substituting.
set -x # Print command traces before executing command.

# Check whether the Upcoming release header is present
head -1 CHANGES | grep -q Upcoming
UPCOMING=$?

# Elaborate today's release header
HEADER="$1 ($(date '+%B %d, %Y'))"
echo $HEADER >> newchanges
echo $( printf "%${#HEADER}s" | tr " " "=" ) >> newchanges
echo "" >> newchanges

# Search for PRs since previous release
git log --grep="Merge pull request" `git describe --tags --abbrev=0`..HEAD --pretty='format: * %b %s' | sed 's+Merge pull request \#\([^\d]*\)\ from\ .*+(https://github.com/nipy/nipype/pull/\1)+' >> newchanges
echo "" >> newchanges
echo "" >> newchanges

# Append old CHANGES
if [[ "$UPCOMING" == "0" ]]; then
# Drop the Upcoming title if present
tail -n+4 CHANGES >> newchanges
else
cat CHANGES >> newchanges
fi

# Replace old CHANGES with new file
mv newchanges CHANGES