Last active
October 3, 2017 16:07
-
-
Save astleychen/26ee4cc59e9b77ed8b923be899141cf9 to your computer and use it in GitHub Desktop.
A script to dump contributors standings in a period of time in a mercurial repo.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# == Arguments == | |
# $1 : date range, exp: "2016-07-01 to 2016-09-30" | |
# $2 ~ $n : bug mail list, exp: [email protected] | |
# | |
# == Output == | |
# Individual standings and sum of standings. | |
dateRange="$1" | |
shift | |
bugMails=($@) | |
totalBugsNum=0 | |
totalHGCommitsNum=0 | |
totalServoPRNum=0 | |
for i in "${bugMails[@]}" | |
do | |
rawCommits=$(hg log --date "$dateRange" -u $i --template '{desc|strip|firstline}\n') | |
uniqHGCommits=$(echo "$rawCommits" | sort | uniq | grep -v -i 'servo: ') | |
hgCommitsNum=$(echo "$uniqHGCommits" | wc -l) | |
uniqServoPRs=$(echo "$rawCommits" | sort | uniq | grep -i 'servo: ') | |
servoPRNum=$(echo "$uniqServoPRs" | wc -l) | |
bugsNum=$(echo "$uniqHGCommits" | cut -d' ' -f 2 | sort | uniq | wc -l) | |
totalBugsNum=$(($totalBugsNum + $bugsNum)) | |
totalHGCommitsNum=$(($totalHGCommitsNum + $hgCommitsNum)) | |
totalServoPRNum=$(($totalServoPRNum + $servoPRNum)) | |
printf "$i : Fixed $bugsNum bugs with $hgCommitsNum HG commits and $servoPRNum Servo PRs\n" | |
# printf "Mercurial Commits History :\n" | |
# echo -e "$uniqHGCommits\n\n" | |
done | |
printf "Team : $totalBugsNum bugs, $totalHGCommitsNum commits, $totalServoPRNum PRs\n" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment