Created
November 9, 2017 10:03
-
-
Save mlebkowski/675c191923bf0e399dca7ad4260dffbe to your computer and use it in GitHub Desktop.
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 | |
export_diff() { | |
declare project=$1 period=$2 hash=$3 | |
local person="$(git -C "$project" show --format="%an" -s "$hash")" | |
local target="output/$period/$person/${project#projects/}/$hash.html" | |
mkdir -p "$(dirname "$target")" | |
git -C "$project" show "$hash" | ./node_modules/.bin/diff2html --input stdin --file "$target" | |
} | |
export_project_for_period() { | |
declare project=$1 sice=$2 until=$3 | |
echo " -> period $since -- $until" | |
git -C "$project" log --format='%H' --since "$since" --until "$until" | while read hash ; do | |
export_diff "$project" "$since" "$hash" | |
done | |
} | |
export_project() { | |
declare project=$1 | |
echo "Exporting $project" | |
while read since until; do | |
export_project_for_period "$project" "$since" "$until" | |
done <<-EOF | |
2015-09-01 2015-09-30 | |
2016-09-01 2016-09-30 | |
2017-09-01 2017-09-30 | |
EOF | |
} | |
main() { | |
for name in projects/*; do | |
export_project "$name" | |
done | |
} | |
main "$@" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment