#!/usr/bin/env bash
set -e
if [ -d ~/tmp/site_cinecast_V$1 ]; then
rm -fr ~/tmp/site_cinecast_V$1;
fi
#svn export file:///iridata/svn/site_cinecast/tags/V$1/web ~/tmp/site_cinecast_V$1
hg clone https://www.iri.centrepompidou.fr/dev/hg/cinecast.fr ~/tmp/site_cinecast_V$1_clone
hg archive -R ~/tmp/site_cinecast_V$1_clone -t files -r V$1 ~/tmp/site_cinecast_V$1
#text2unix ~/tmp/site_cinecast_V$1
if [ -d ~/tmp/site_cinecast_V$1 ]; then
cat <<EOT | rsync -Cvrlz --delete --filter=". -" ~/tmp/site_cinecast_V$1/web web.iri.centrepompidou.fr:/iridata/www/cinecast/
+ core
P google?.html
P .htpasswd
P .htaccess
P **/wp-config.php
P apps/***
P documents/***
P munin/***
P shotdetect/***
P wiki/***
EOT
fi
if [ -d ~/tmp/site_cinecast_V$1 ]; then
echo "Deleting temp export"
rm -fr ~/tmp/site_cinecast_V$1*;
fi