#!/bin/sh
set -ev

# Spoof $HOME to hide the real .mrconfig and .darcs
export HOME=`mktemp -dt with-temp-dir.XXXXXX`
# Also use it as a working area.
cd

# Create two "source" repos.
mkdir x y
darcs init --repodir x
darcs init --repodir y

# Create a "destination" repo.
darcs get x z
mr register z

# mr now associates x (source) with z (destination)
mr update

# This sets z/_darcs/prefs/defaultrepo, i.e.  the repo that "darcs
# pull" used when not called with any source repos as arguments.
darcs pull --repodir z $PWD/y

# This *SHOULD* still be pulling from x, not y.
mr update
