-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathpullrep
More file actions
executable file
·36 lines (27 loc) · 1.01 KB
/
pullrep
File metadata and controls
executable file
·36 lines (27 loc) · 1.01 KB
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
#!/bin/bash
# Get a report on who has merged my pull requests.
# Only looks at local data -- whatever you have pulled from upstream.
# You can provide someone else's name as first argument!
if [ -z $1 ]; then
GH_USER=$(git remote -v | grep '^origin' | head -n 1 | sed 's/.\+:\(.\+\)\/.\+/\1/')
else
GH_USER="$1"
fi
if [ -z "$GH_USER" ]; then
echo 'Could not locate your origin repo; are you in a repo with remote "origin?"';
exit 1;
fi
PRS=$(git log | grep -B 3 "Merge pull request #[0-9]\+ from $GH_USER\|Landing pull request [0-9]\+ from $GH_USER")
ALL_PULLERS=$(echo "$PRS" | grep '^Author' | sed 's/^Author: //' | sort | uniq -c | sort -nr)
echo
echo "-- Pull report for $GH_USER --"
TOTAL_PULLS=0
while read -d ' ' C; do
TOTAL_PULLS=$(( $TOTAL_PULLS + $C ))
done <<< $(echo "$ALL_PULLERS" | awk '{print $1}')
echo "Total pulls: $TOTAL_PULLS"
echo "All pullers:"
echo "$ALL_PULLERS"
LAST_FIVE=$(echo "$PRS" | grep '^Author\|^Date' | head -n 10 | sed 's/^Author: \|^Date: //')
echo "Last five pullers:"
echo "$LAST_FIVE"