Permalink
Find file
Fetching contributors…
Cannot retrieve contributors at this time
executable file 74 lines (66 sloc) 1.74 KB
#!/bin/bash
# Usage: smoke-parrots, smoke-parrots-win, smoke-parrots-msvc
branches="master"
# plus all rurban/* and smoke-me/* remote branches
#plus_egrep_branches="(rurban|smoke-me)/"
# all branches
plus_egrep_branches="origin/"
parrotdir=/usr/src/p6
smokedir=$parrotdir/smoke
if [ ! -d $smokedir ]; then
smokedir=$parrotdir/master
fi
cd $smokedir || exit 1
base=$(basename $0)
cmd=smoke-parrot
if [ "$base" != "smoke-parrots" ]; then
# see smoke-parrot-win for customizations
trycmd=`echo $base|sed 's,smoke-parrots-,smoke-parrot-,'`
dir=$(dirname $0)
test -e $dir/$trycmd && cmd=$trycmd
fi
# stash changes if dirty or detached head
if git symbolic-ref -q HEAD >/dev/null
then
if git status|grep " Changes " 2>/dev/null
then
stashname="smoke `date +%F` `git name-rev --name-only HEAD`"
git stash save $stashname
git clean -q -dxf || git clean -d -x
git reset --hard
fi
fi
for s in `git branch -r | egrep "$plus_egrep_branches" | egrep -v '(->|HEAD|gh-pages)'`
do
s="`echo $s|sed 's,^origin/,,g'`"
if [ -n $s ]; then
branches="$branches $s"
fi
done
curbranch=`git name-rev --name-only HEAD`
for b in $branches
do
fbranch="`echo $b|sed -e's,/,_,g'`"
if [ -d $parrotdir/smoked ]; then
log=$parrotdir/smoked/smoked.$fbranch.log
else
log=$parrotdir/smoked.$fbranch.log
fi
tmplog=$log.tmp
$cmd $b 2>&1 >> $tmplog
if grep "no changes for " $tmplog >/dev/null; then
rm $tmplog
else
if [ -s $tmplog ]; then
mv $log $log.bak
mv $tmplog $log
echo $cmd $b
echo $log
head $log
tail -n 15 $log
fi
fi
done
git co -q $curbranch
git reset -q --hard
#test -n $stashname && git stash pop $stashname 2>/dev/null >/dev/null