Skip to content

Commit 38951d9

Browse files
committed
MAINT: Update maintenance scripts
1 parent fbe1023 commit 38951d9

File tree

2 files changed

+21
-8
lines changed

2 files changed

+21
-8
lines changed

.maint/update_changes.sh

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@ set -u # Treat unset variables as an error when substituting.
1313
set -x # Print command traces before executing command.
1414

1515
# Check whether the Upcoming release header is present
16-
head -1 CHANGES.rst | grep -q Upcoming
16+
head -1 CHANGES.md | grep -q Upcoming
1717
UPCOMING=$?
1818
if [[ "$UPCOMING" == "0" ]]; then
19-
head -n3 CHANGES.rst >> newchanges
19+
head -n3 CHANGES.md >> newchanges
2020
fi
2121

2222
# Elaborate today's release header
@@ -26,15 +26,28 @@ echo $( printf "%${#HEADER}s" | tr " " "=" ) >> newchanges
2626
echo "" >> newchanges
2727

2828
# Search for PRs since previous release
29-
git log --grep="Merge pull request" `git describe --tags --abbrev=0`..HEAD --pretty='format: * %b %s' | sed 's/Merge pull request \#\([^\d]*\)\ from\ .*/(\#\1)/' >> newchanges
30-
echo "" >> newchanges
31-
echo "" >> newchanges
29+
MERGE_COMMITS=$( git log --grep="Merge pull request\|(#.*)$" `git describe --tags --abbrev=0`..HEAD --pretty='format:%h' )
30+
for COMMIT in ${MERGE_COMMITS//\n}; do
31+
SUB=$( git log -n 1 --pretty="format:%s" $COMMIT )
32+
if ( echo $SUB | grep "^Merge pull request" ); then
33+
# Merge commit
34+
PR=$( echo $SUB | sed -e "s/Merge pull request \#\([0-9]*\).*/\1/" )
35+
TITLE=$( git log -n 1 --pretty="format:%b" $COMMIT )
36+
else
37+
# Squashed merge
38+
PR=$( echo $SUB | sed -e "s/.*(\#\([0-9]*\))$/\1/" )
39+
TITLE=$( echo $SUB | sed -e "s/\(.*\) (\#[0-9]*)$/\1/" )
40+
fi
41+
echo " * $TITLE (#$PR)" >> newchanges
42+
done
43+
echo >> newchanges
44+
echo >> newchanges
3245

3346
# Add back the Upcoming header if it was present
3447
if [[ "$UPCOMING" == "0" ]]; then
35-
tail -n+4 CHANGES.rst >> newchanges
48+
tail -n+4 CHANGES.md >> newchanges
3649
else
37-
cat CHANGES.rst >> newchanges
50+
cat CHANGES.md >> newchanges
3851
fi
3952

4053
# Replace old CHANGES.md with new file

.maint/update_zenodo.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,4 +122,4 @@ def get_git_lines(fname='line-contributors.txt'):
122122
if isinstance(creator['affiliation'], list):
123123
creator['affiliation'] = creator['affiliation'][0]
124124

125-
zenodo_file.write_text('%s\n' % json.dumps(zenodo, indent=2))
125+
zenodo_file.write_text('%s\n' % json.dumps(zenodo, indent=2, ensure_ascii=False))

0 commit comments

Comments
 (0)