Hi,

We have been running Review Board along with Perforce Software Configuration
Management System for about 12 months now.

We wanted to add some kind of verification of a Review Done for that
Changelist, before any changelist is checked-in to Perforce. Perforce
provides pre-submit/pre-commit triggers to run custom scripts.

So i was planning to run a script to verify if every changelist that is
being submitted has been Reviewed by at least one Reviewer before the
Changelist is allowed to be checked-in to Perforce.

As of now i've written a small script to accomplish this. My approach is to
remotely query the mysql server for the "reviewrequest" table to verify if
that changelist has already been reviewed and "shipped" by atleast one
reviewer. I'm attaching the script below. I've verified the script on my
local machine and it works fine.

I wanted to get some review of this to know if this is the best solution to
accomplish this OR if there any tools out there which would accomplish the
same in a better way.

#!/bin/sh
resp=""
no_of_shipit=""

if [ $# -ne 1 ]
then
    echo "Usage pre_commit_reviewboard_script.sh <changenumber>"
    exit 1
fi

#echo "Changelist Number for Validation: $1"

resp=`mysql -u<MYSQL_USERNAME> -p<MYSQL_PASSWORD> -h <REVIEWBOARD_IPADDRESS>
-P <PORT> --database reviewboard  -e "select shipit_count from
reviews_reviewrequest where changenum='$1';"`
if [ ! -n "$resp" ]
then
    echo "No Response For the query. Probably there is no such review done"
    exit 2
fi

#echo "Response from the MySql Server: $resp"

no_of_shipit=`echo $resp | cut -f2 -d' '`
if [ ! -n "$no_of_shipit" ]
then
    echo "Wrong Format for reponse. Generic Error"
    exit 3
fi
#echo "No of reviewers who have clicked on ship it: $no_of_shipit"

if [ "$no_of_shipit" -eq "0" ]
then
    echo "None of the Reviewers have shipped it"
    exit 4
fi

echo "Successfully validated the Changelist number for Review. Allow
Perforce Submission"
exit 0


Thanks,
Roshan Pius

-- 
Want to help the Review Board project? Donate today at 
http://www.reviewboard.org/donate/
Happy user? Let us know at http://www.reviewboard.org/users/
-~----------~----~----~----~------~----~------~--~---
To unsubscribe from this group, send email to 
reviewboard+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/reviewboard?hl=en

Reply via email to