File: dump-ChangeLog.sh

package info (click to toggle)
ray 2.3.1-9
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 6,008 kB
  • sloc: cpp: 49,973; sh: 339; makefile: 281; python: 168
file content (62 lines) | stat: -rwxr-xr-x 1,676 bytes parent folder | download | duplicates (5)
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
56
57
58
59
60
61
62
#!/bin/bash
# Generate a ChangeLog with git and bash
# Author: Sébastien Boisvert

firstCommit=$(git log|grep ^commit|tail -n1|awk '{print $2}')

totalNumberOfCommits=$(git log --pretty=oneline|wc -l)


echo HEAD > sortedTags.txt

git log|grep Author|sort |uniq|sed 's/Author: //g' > authors.txt

numberOfAuthors=$(cat authors.txt|wc -l)

for gitTag in $(git tag|grep "\.")
do
	timeStamp=$(git log --pretty=format:%at -1 $gitTag)
	echo "$timeStamp $gitTag"
done|sort -n -r|awk '{print $2}' >> sortedTags.txt

numberOfTags=$(cat sortedTags.txt|wc -l)

echo "$numberOfTags tags, $totalNumberOfCommits commits"
echo ""

for i in $(seq 1 $numberOfTags)
do
	currentTag=$(head -n $i sortedTags.txt|tail -n1)
	tagDate=$(git show $currentTag|grep ^Date|head -n1|sed 's/Date:   //g')
	
	previousTag=$firstCommit
	if test $i -lt $numberOfTags
	then
		previousTag=$(head -n $(($i+1)) sortedTags.txt|tail -n1)
	fi

	currentCommit=$(git show $currentTag|grep ^commit|awk '{print $2}')
	previousCommit=$(git show $previousTag|grep ^commit|awk '{print $2}')

	numberOfCommits=$(git log --pretty=oneline $previousCommit..$currentCommit|wc -l)

	echo "$currentTag        $tagDate        $numberOfCommits commits"
	for author in $(seq 1 $numberOfAuthors)
	do
		authorName=$(head -n $author authors.txt|tail -n1)
		git log --author="$authorName" --pretty=format:"       %h %s" $previousCommit..$currentCommit > commits
		numberOfAuthorCommits=$(cat commits|awk '{print $1}'|wc -w)
		if test $numberOfAuthorCommits -gt 0
		then
			echo ""
			echo "  $authorName      $numberOfAuthorCommits commits"
			echo ""
			cat commits
			echo ""
		fi
	done
	echo ""
done

rm sortedTags.txt
rm authors.txt