view tests/test-ssh-clone-r @ 5378:8a2915f57dfc

convert: add a mode where mercurial_sink skips empty revisions. The getchanges function of some converter_source classes can return some false positives. I.e. they sometimes claim that a file "foo" was changed in some revision, even though its contents are still the same. convert_svn is particularly bad, but I think this can also happen with convert_cvs and, at least in theory, with mercurial_source. For regular conversions this is not really a problem - as long as getfile returns the right contents, we'll get a converted revision with the right contents. But when we use --filemap, this could lead to superfluous revisions being converted. Instead of fixing every converter_source, I decided to change mercurial_sink to work around this problem. When --filemap is used, we're interested only in revisions that touch some specific files. If a revision doesn't change any of these files, then we're not interested in it (at least for revisions with a single parent; merges are special). For mercurial_sink, we abuse this property and rollback a commit if the manifest text hasn't changed. This avoids duplicating the logic from localrepo.filecommit to detect unchanged files.
author Alexis S. L. Carvalho <alexis@cecm.usp.br>
date Thu, 04 Oct 2007 23:21:37 -0300
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 ..