#!/bin/sh
set -ev

test $DARCS || DARCS=$PWD/../darcs

rm -rf temp1 temp2 temp3
mkdir -p temp1 temp2 temp3
cd temp1
$DARCS init
cd ../temp2
$DARCS init
cd ../temp3
$DARCS init

touch foo
$DARCS add foo
$DARCS record -a -A author -m add
$DARCS push -a ../temp2
$DARCS push -a ../temp1

echo A > foo
$DARCS record -a -A author -m A
cd ../temp2
echo B > foo
$DARCS record -a -A author -m B
cd ../temp1
echo C > foo
$DARCS record -a -A author -m C

$DARCS pull -a ../temp2
$DARCS pull -a ../temp3

cd ../temp2
$DARCS pull -a ../temp3
$DARCS pull -a ../temp1
rm -rf temp1 temp2 temp3
