tests/test-init
author Brendan Cully <brendan@kublai.com>
Wed, 30 Aug 2006 13:42:57 -0700
changeset 3056 6848528f7ebd
parent 2599 e4b5e48052c6
child 3037 3acb76f0124d
permissions -rwxr-xr-x
Remove temporary git patch files
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2599
e4b5e48052c6 Added tests for local and remote init.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
     1
#!/bin/sh
e4b5e48052c6 Added tests for local and remote init.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
     2
e4b5e48052c6 Added tests for local and remote init.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
     3
# This test tries to exercise the ssh functionality with a dummy script
e4b5e48052c6 Added tests for local and remote init.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
     4
e4b5e48052c6 Added tests for local and remote init.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
     5
cat <<'EOF' > dummyssh
e4b5e48052c6 Added tests for local and remote init.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
     6
#!/bin/sh
e4b5e48052c6 Added tests for local and remote init.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
     7
# this attempts to deal with relative pathnames
e4b5e48052c6 Added tests for local and remote init.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
     8
cd `dirname $0`
e4b5e48052c6 Added tests for local and remote init.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
     9
e4b5e48052c6 Added tests for local and remote init.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
    10
# check for proper args
e4b5e48052c6 Added tests for local and remote init.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
    11
if [ $1 != "user@dummy" ] ; then
e4b5e48052c6 Added tests for local and remote init.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
    12
	exit -1
e4b5e48052c6 Added tests for local and remote init.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
    13
fi
e4b5e48052c6 Added tests for local and remote init.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
    14
e4b5e48052c6 Added tests for local and remote init.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
    15
# check that we're in the right directory
e4b5e48052c6 Added tests for local and remote init.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
    16
if [ ! -x dummyssh ] ; then
e4b5e48052c6 Added tests for local and remote init.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
    17
	exit -1
e4b5e48052c6 Added tests for local and remote init.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
    18
fi
e4b5e48052c6 Added tests for local and remote init.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
    19
e4b5e48052c6 Added tests for local and remote init.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
    20
echo Got arguments 1:$1 2:$2 3:$3 4:$4 5:$5 >> dummylog
e4b5e48052c6 Added tests for local and remote init.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
    21
$2
e4b5e48052c6 Added tests for local and remote init.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
    22
EOF
e4b5e48052c6 Added tests for local and remote init.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
    23
chmod +x dummyssh
e4b5e48052c6 Added tests for local and remote init.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
    24
e4b5e48052c6 Added tests for local and remote init.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
    25
echo "# creating 'local'"
e4b5e48052c6 Added tests for local and remote init.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
    26
hg init local
e4b5e48052c6 Added tests for local and remote init.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
    27
echo this > local/foo
e4b5e48052c6 Added tests for local and remote init.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
    28
hg ci --cwd local -A -m "init" -d "1000000 0"
e4b5e48052c6 Added tests for local and remote init.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
    29
e4b5e48052c6 Added tests for local and remote init.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
    30
echo "# init+push to remote2"
e4b5e48052c6 Added tests for local and remote init.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
    31
hg init -e ./dummyssh ssh://user@dummy/remote2
e4b5e48052c6 Added tests for local and remote init.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
    32
hg incoming -R remote2 local
e4b5e48052c6 Added tests for local and remote init.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
    33
hg push -R local -e ./dummyssh ssh://user@dummy/remote2
e4b5e48052c6 Added tests for local and remote init.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
    34
e4b5e48052c6 Added tests for local and remote init.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
    35
echo "# clone to remote1"
e4b5e48052c6 Added tests for local and remote init.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
    36
hg clone -e ./dummyssh local ssh://user@dummy/remote1
e4b5e48052c6 Added tests for local and remote init.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
    37
e4b5e48052c6 Added tests for local and remote init.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
    38
echo "# output of dummyssh"
e4b5e48052c6 Added tests for local and remote init.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
    39
cat dummylog
e4b5e48052c6 Added tests for local and remote init.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
    40
e4b5e48052c6 Added tests for local and remote init.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
    41
echo "# comparing repositories"
e4b5e48052c6 Added tests for local and remote init.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
    42
hg tip -q -R local
e4b5e48052c6 Added tests for local and remote init.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
    43
hg tip -q -R remote1
e4b5e48052c6 Added tests for local and remote init.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
    44
hg tip -q -R remote2
e4b5e48052c6 Added tests for local and remote init.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
    45
e4b5e48052c6 Added tests for local and remote init.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
    46
echo "# check names for repositories (clashes with URL schemes, special chars)"
e4b5e48052c6 Added tests for local and remote init.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
    47
for i in bundle file hg http https old-http ssh static-http " " "with space"; do
e4b5e48052c6 Added tests for local and remote init.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
    48
  echo "# hg init \"$i\""
e4b5e48052c6 Added tests for local and remote init.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
    49
  hg init "$i"
e4b5e48052c6 Added tests for local and remote init.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
    50
  test -d "$i" -a -d "$i/.hg" -a -d "$i/.hg/data" && echo "ok" || echo "failed"
e4b5e48052c6 Added tests for local and remote init.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
    51
done
e4b5e48052c6 Added tests for local and remote init.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
    52