view tests/test-ssh-clone-r @ 5429:77cafe8f89e0

findcopies: fix rename bug We've fiddled with this line several times, and an old bug has reappeared from it. Let's take a peek at the history. The original "or" (rev 3674, in 0.9.2 and 0.9.3): http://www.selenic.com/hg/rev/9103dab96093 Then I changed it to an "and" to fix a bug (rev 4304): http://www.selenic.com/hg/rev/4787e2b0dd03 Then for reasons now lost in the mists of time, I dropped half (rev 4399): http://www.selenic.com/hg/rev/93652499bed3 Then we added back the "or" (rev 4416, in 0.9.4): http://www.selenic.com/hg/rev/bb1800a7d7e1 So it seems it ought to be "and".
author Matt Mackall <mpm@selenic.com>
date Mon, 08 Oct 2007 18:47:22 -0500
parents 6b1e1b9da853
children
line wrap: on
line source

#!/bin/sh

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

cat <<EOF > dummyssh
import sys
import os

os.chdir(os.path.dirname(sys.argv[0]))
if sys.argv[1] != "user@dummy":
    sys.exit(-1)

if not os.path.exists("dummyssh"):
    sys.exit(-1)

os.environ["SSH_CLIENT"] = "127.0.0.1 1 2"

log = open("dummylog", "ab")
log.write("Got arguments")
for i, arg in enumerate(sys.argv[1:]):
    log.write(" %d:%s" % (i+1, arg))
log.write("\n")
log.close()
r = os.system(sys.argv[2])
sys.exit(bool(r))
EOF

hg init remote
cd remote
echo "# creating 'remote'"
cat >>afile <<EOF
0
EOF
hg add afile
hg commit -m "0.0"
cat >>afile <<EOF
1
EOF
hg commit -m "0.1"
cat >>afile <<EOF
2
EOF
hg commit -m "0.2"
cat >>afile <<EOF
3
EOF
hg commit -m "0.3"
hg update -C 0
cat >>afile <<EOF
1
EOF
hg commit -m "1.1"
cat >>afile <<EOF
2
EOF
hg commit -m "1.2"
cat >fred <<EOF
a line
EOF
cat >>afile <<EOF
3
EOF
hg add fred
hg commit -m "1.3"
hg mv afile adifferentfile
hg commit -m "1.3m"
hg update -C 3
hg mv afile anotherfile
hg commit -m "0.3m"
hg debugindex .hg/store/data/afile.i
hg debugindex .hg/store/data/adifferentfile.i
hg debugindex .hg/store/data/anotherfile.i
hg debugindex .hg/store/data/fred.i
hg debugindex .hg/store/00manifest.i
hg verify
cd ..

echo "# clone remote via stream"
for i in 0 1 2 3 4 5 6 7 8; do
   hg clone -e "python ./dummyssh" --uncompressed -r "$i" ssh://user@dummy/remote test-"$i" 2>&1
   if cd test-"$i"; then
      hg verify
      cd ..
   fi
done
cd test-8
hg pull ../test-7
hg verify
cd ..
cd test-1
hg pull -e "python ../dummyssh" -r 4 ssh://user@dummy/remote 2>&1
hg verify
hg pull -e "python ../dummyssh" ssh://user@dummy/remote 2>&1
cd ..
cd test-2
hg pull -e "python ../dummyssh" -r 5 ssh://user@dummy/remote 2>&1
hg verify
hg pull -e "python ../dummyssh" ssh://user@dummy/remote 2>&1
hg verify
cd ..