-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathclog
executable file
·55 lines (50 loc) · 1.61 KB
/
clog
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
43
44
45
46
47
48
49
50
51
52
53
54
55
#!/bin/bash
sdate=${1}
cdate=`date +"%m_%d_%Y"`
rdir=`pwd`
logdir=$KYLIN_CHANGELOG_PATH
if ["$MK_CHANGELOG_PATH" = ""]; then
logdir=`pwd`
fi
#rm -rf Changelog_*
clear
# Check the date start range is set
if [ -z "$sdate" ]; then
echo""
echo "ATTENTION: Start date not defined ----------------------------------------------------"
echo""
echo " >>> Please define a start date in mm/dd/yyyy format ..."
echo""
echo "----------------------------------------------------------------------------------"
read sdate
fi
# Find the directories to log
echo"";echo"";echo""
echo "KyLin OS Changelog -------------------"
echo""
# Log starter
echo "KyLin OS Changelog from $sdate" - today >> "$logdir"/Changelog_$cdate.log
echo "---------------------------------------------------------------" >> "$logdir"/Changelog_$cdate.log
echo " " >> "$logdir"/Changelog_$cdate.log
find $rdir -name .git | sed 's/\/.git//g' | sed 'N;$!P;$!D;$d' | while read line
do
cd $line
# Test to see if the repo needs to have a changelog written.
log=$(git log --pretty="%an - %s" --no-merges --since=$sdate --date-order)
# Forgive my bad script :P
project=${line#*/}
project=${project#*/}
if [ ! -z "$log" ]; then
# Write the changelog
echo " >>> Changelog is updated and written for $project ..."
echo "Project: $project" >> "$logdir"/Changelog_$cdate.log
echo "$log" | while read line
do
echo " $line" >> "$logdir"/Changelog_$cdate.log
done
echo "" >> "$logdir"/Changelog_$cdate.log
fi
done
echo""
echo "-------------------------------------------------"
echo"";echo"";echo""