#!/bin/bash

CURRENT_BRANCH=$1
CURRENT_COMMIT=$2

published-commit(){
    curl -s http://docs.mongodb.org/meta-driver/$CURRENT_BRANCH/release.txt
}

CURRENT_PUBLISHED_BRANCH=`published-commit`

if [ $CURRENT_COMMIT = $CURRENT_PUBLISHED_BRANCH ]; then
    echo "[build]: Error. The published version of '$CURRENT_BRANCH' matches the last commit of this repo."
    echo "         Commit local changes before publishing."
    exit 1
else
    echo [buid]: Last commit on \'$CURRENT_BRANCH\' is different from the published version. Update, if needed, and deploy at will.
fi
