#!/bin/sh PT_URL="https://prod.practitest.com" PT_API_KEY="you account key" PT_API_SECRET_KEY="your account secret key" PT_PREFIX="#" #the prefix for the issue ID, so in your comment you can write something like 'fixed #928' TS=`date +%s` SIGNATURE=`md5 -q -s $PT_API_KEY$PT_API_SECRET_KEY$TS` REPOS="$1" REV="$2" SVNLOOK=/usr/bin/svnlook XMLSTARLET=/usr/bin/xmlstarlet SVN_MESSAGE=`$SVNLOOK log --revision "$REV" "$REPOS"` SVN_AUTHOR=`$SVNLOOK author --revision "$REV" "$REPOS"` SVN_FILES=`$SVNLOOK changed --revision "$REV" "$REPOS"` ISSUE_IDS=`echo -n "$SVN_MESSAGE" | grep -oE "$PT_PREFIX[[:digit:]]{1,}" | tr "\n" "," | sed "s/$PT_PREFIX//g" | sed "s/,\$//g"` SVN_MESSAGE=`echo -n "$SVN_MESSAGE" | $XMLSTARLET esc` PT_REQUEST="$PT_API_KEY$PT_API_SECRET_KEY$SVN_AUTHOR$VALIDATES_ASSIGNED$ISSUE_IDS$REV$SVN_FILES$SVN_MESSAGE" PT_RESPONSE=`echo -n $PT_REQUEST | curl -s -X POST -H 'Content-type: text/xml' -d @- "$PT_URL/change_sets.xml?api_key=$PT_API_KEY&ts=$TS&signature=$SIGNATURE"` if [ $? -ne 0 ]; then echo "Failed to communicate with PractiTest server $PT_URL!" >&2 exit 1 fi if [ "$PT_RESPONSE" = "OK" ]; then exit 0 else echo "Please make sure you have at least one PractiTest issue ID in the comment (${PT_PREFIX}XXX) and that it is assigned to you " >&2 exit 1 fi