-
Notifications
You must be signed in to change notification settings - Fork 6
/
non-mongo-commits.sh
executable file
·56 lines (37 loc) · 1.54 KB
/
non-mongo-commits.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
43
44
45
46
47
48
49
50
51
52
53
54
55
#!/bin/bash
if [ "$2" == "" ]; then
echo "Usage: ./non-mongo-commits.sh {mongodb rev} {psmdb rev}"
exit 1;
fi
mongodb_rev=$1
psmdb_rev=$2
if [ ! -d 'percona-server-mongodb' ]; then
git clone https://github.com/percona/percona-server-mongodb.git
fi
cd percona-server-mongodb
git fetch origin
if ! git remote -v 2>/dev/null | grep -q '\/mongodb\/'; then
git remote add upstream https://github.com/mongodb/mongo.git
fi
git fetch upstream
title=$(echo -n "Differences between upstream MongoDB: ${mongodb_rev} and Percona PSMDB: ${psmdb_rev}")
# commits
echo ${title} > ../commits.txt
echo -e "Commits not in upstream\n" >> ../commits.txt
git cherry -v ${mongodb_rev} ${psmdb_rev} | awk '{print $2}' | xargs -n1 -i{} git show {} --name-status >> ../commits.txt
# authors
echo -e "${title}\n" > ../authors.txt
echo "commits author" >> ../authors.txt
echo "------- ----------------------------------------------------------------" >> ../authors.txt
grep '^Author: ' ../commits.txt | sed 's/^Author: //' | sort | uniq -c | sort -nr >> ../authors.txt
# files
echo -e "${title}\n" > ../files.txt
echo "Files Added:" >> ../files.txt
echo "------------" >> ../files.txt
grep -E '^A\s' ../commits.txt | sed 's/^.\s//' | sort | uniq >> ../files.txt
echo -e "\nFiles Modified:" >> ../files.txt
echo "---------------" >> ../files.txt
grep -E '^M\s' ../commits.txt | sed 's/^.\s//' | sort | uniq >> ../files.txt
echo -e "\nFiles Deleted:" >> ../files.txt
echo "---------------" >> ../files.txt
grep -E '^D\s' ../commits.txt | sed 's/^.\s//' | sort | uniq >> ../files.txt