#!/bin/bash # Script that will count the number of unique contributors to mediawiki # projects in a specified month. # Pass in the command you use to ssh into gerrit, the first day you want to # include in the calculation, and the last day you want to include. SSH=$1 EOM=$2 SOM=$3 FILTERS="age:$EOM -age:$SOM status:merged project:^mediawiki.* -owner:L10n-bot" REMOTECOMM="gerrit query" TMPFILE=`mktemp` TTMPFILE=`mktemp` CURLEN=500 RSK="" N=0 while [ $CURLEN -eq 500 ]; do let N=$N+1 LFILT=$FILTERS if [ "$RSK" != "" ]; then LFILT="$FILTERS resume_sortkey:$RSK" fi FRCOMM="$REMOTECOMM '$LFILT'" echo "Getting $N" $SSH "$REMOTECOMM '$LFILT'" > $TTMPFILE echo "Got it." CURLEN=`grep ' name:' < $TTMPFILE | wc -l` cat $TMPFILE >> $TTMPFILE grep ' name:' < $TTMPFILE | sort -u > $TMPFILE echo "Currently have" `wc -l < $TMPFILE` echo "$CURLEN results in that fetch." RSK=`grep sortKey $TTMPFILE | tail -c 17` echo "Next sort starts at $RSK." done TOTAL=`wc -l < $TMPFILE` echo "$TOTAL total unique contributors."