2012-07-24 10:38:23 +02:00
|
|
|
#!/bin/bash
|
|
|
|
SINCE=$1
|
|
|
|
UNTIL=$2
|
|
|
|
|
|
|
|
if [ "$SINCE" = "" ] || [ "$UNTIL" = "" ]
|
|
|
|
then
|
|
|
|
echo "Usage: $0 <since> <until>"
|
|
|
|
exit 3
|
|
|
|
fi
|
|
|
|
|
2012-07-24 13:56:25 +02:00
|
|
|
testname="merge check for `pwd|sed "s/.*\///"`"
|
2012-07-24 14:00:31 +02:00
|
|
|
echo "##teamcity[testStarted name='$testname' captureStandardOutput='true']"
|
2012-07-24 13:56:25 +02:00
|
|
|
|
2012-07-24 10:38:23 +02:00
|
|
|
command="git --no-pager log --no-color $SINCE..$UNTIL"
|
|
|
|
# TODO Why do I get whitespace in the beginning of the wc output?
|
|
|
|
change_count=`$command --oneline|wc -l|tr -d ' '`
|
|
|
|
|
|
|
|
if [ "$change_count" = "0" ]
|
|
|
|
then
|
|
|
|
echo "No unmerged commits"
|
2012-07-24 13:56:25 +02:00
|
|
|
else
|
|
|
|
command="$command --format=short"
|
|
|
|
message="There are $change_count commits that have not been merged from $UNTIL to $SINCE"
|
|
|
|
echo $message
|
|
|
|
echo ""
|
|
|
|
$command
|
|
|
|
details=`$command|perl -p -e 's/\n/|n/' | sed "s/['\|\[\]]/|\&/g"`
|
|
|
|
echo "##teamcity[testFailed name='$testname' message='$message' details='|n$details']"
|
2012-07-24 10:38:23 +02:00
|
|
|
fi
|
|
|
|
|
2012-07-24 13:56:25 +02:00
|
|
|
echo "##teamcity[testFinished name='$testname']"
|