view tests/test-ssh @ 2439:e8c4f3d3df8c

extend network protocol to stop clients from locking servers now all repositories have capabilities slot, tuple with list of names. if 'unbundle' capability present, repo supports push where client does not need to lock server. repository classes that have unbundle capability also have unbundle method. implemented for ssh now, will be base for push over http. unbundle protocol acts this way. server tells client what heads it has during normal negotiate step. client starts unbundle by repeat server's heads back to it. if server has new heads, abort immediately. otherwise, transfer changes to server. once data transferred, server locks and checks heads again. if heads same, changes can be added. else someone else added heads, and server aborts. if client wants to force server to add heads, sends special heads list of 'force'.
author Vadim Gelfer <vadim.gelfer@gmail.com>
date Thu, 15 Jun 2006 16:37:23 -0700
parents 70ba0c86da8b
children ffb895f16925
line wrap: on
line source

#!/bin/sh

# This test tries to exercise the ssh functionality with a dummy script

cat <<'EOF' > dummyssh
#!/bin/sh
# this attempts to deal with relative pathnames
cd `dirname $0`

# check for proper args
if [ $1 != "user@dummy" ] ; then
	exit -1
fi

# check that we're in the right directory
if [ ! -x dummyssh ] ; then
	exit -1
fi

echo Got arguments 1:$1 2:$2 3:$3 4:$4 5:$5 >> dummylog
$2
EOF
chmod +x dummyssh

echo "# creating 'remote'"
hg init remote
cd remote
echo this > foo
hg ci -A -m "init" -d "1000000 0" foo

cd ..

echo "# clone remote"
hg clone -e ./dummyssh ssh://user@dummy/remote local

echo "# verify"
cd local
hg verify

echo "# empty default pull"
hg paths
hg pull -e ../dummyssh

echo "# local change"
echo bleah > foo
hg ci -m "add" -d "1000000 0"

echo "# updating rc"
echo "default-push = ssh://user@dummy/remote" >> .hg/hgrc
echo "[ui]" >> .hg/hgrc
echo "ssh = ../dummyssh" >> .hg/hgrc

echo "# find outgoing"
hg out ssh://user@dummy/remote

echo "# find incoming on the remote side"
hg incoming -R ../remote -e ../dummyssh ssh://user@dummy/local

echo "# push"
hg push

cd ../remote

echo "# check remote tip"
hg tip
hg verify
hg cat foo

echo z > z
hg ci -A -m z -d '1000001 0' z

cd ../local
echo r > r
hg ci -A -m z -d '1000002 0' r

echo "# push should fail"
hg push

echo "# push should succeed"
hg push -f

cd ..
cat dummylog