Last active
August 29, 2015 14:03
-
-
Save RickyCook/d74aa98873411f02dd7d to your computer and use it in GitHub Desktop.
Retrospectively tag releases from setup.py commits
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
for version_line in $(git log -G 'version=' setup.py | grep commit | awk '{print $2}' | \ | |
xargs git show --date=iso | \ | |
grep -E '^((\+\s*version=)|(commit )|Date:)' | \ | |
sed "s/\+\s*version='//" | sed "s/',$//" | \ | |
sed 's/commit //' | \ | |
sed 's/Date:\s*//' | \ | |
awk '{printf("%s%s", $0, (NR%3 ? "," : "\n"))}' | \ | |
sed 's/ /_/g'); do | |
c="$(echo $version_line | awk -F ',' '{print $1}')" | |
GIT_COMMITTER_DATE="$(echo $version_line | awk -F ',' '{print $2}' | sed 's/_/ /g' | sed 's/ \+\d+//')" | |
v="$(echo $version_line | awk -F ',' '{print $3}')" | |
GIT_COMMITTER_DATE="$GIT_COMMITTER_DATE" git tag -a "v$v" -m "Version $v (retrospectively tagged)" $c | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment