-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathchangelog.sh
42 lines (32 loc) · 923 Bytes
/
changelog.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#!/bin/sh
export Changelog=$PWD/Changelog.txt
if [ -z $CHGLOGDUR ];
then
CHGLOGDUR="10"
fi
if [ $CHGLOGDUR -gt 30 ];
then
echo "Duration greater than 30 is not allowed, resetting to 10"
CHGLOGDUR="10"
fi
if [ -f $Changelog ];
then
rm -f $Changelog
fi
touch $Changelog
echo "Generating changelog..."
for i in $(seq $CHGLOGDUR);
do
export After_Date=`date --date="$i days ago" +%m-%d-%Y`
k=$(expr $i - 1)
export Until_Date=`date --date="$k days ago" +%m-%d-%Y`
# Line with after --- until was too long for a small ListView
echo '=======================' >> $Changelog;
echo " "$Until_Date >> $Changelog;
echo '=======================' >> $Changelog;
echo >> $Changelog;
# Cycle through every repo to find commits between 2 dates
repo forall -pc 'git log --oneline --after=$After_Date --until=$Until_Date' >> $Changelog
echo >> $Changelog;
done
sed -i 's/project/ */g' $Changelog