diff --git a/tests/test-clone b/tests/test-clone new file mode 100755 --- /dev/null +++ b/tests/test-clone @@ -0,0 +1,28 @@ +#!/bin/bash + +set -x +mkdir a +cd a +hg init +echo a > a +hg add a +hg commit -t test -u test -d '0 0' + +# Default operation +hg clone . ../b +cd ../b +cat a +hg verify + +# No update +hg clone -U . ../c +cd ../c +cat a +hg verify + +# Default destination +mkdir ../d +cd ../d +hg clone ../a +cd a +hg cat a diff --git a/tests/test-clone-failure b/tests/test-clone-failure new file mode 100755 --- /dev/null +++ b/tests/test-clone-failure @@ -0,0 +1,43 @@ +#!/bin/bash + +set -x + +# No local source +hg clone a b +echo $? + +# No remote source +hg clone http://127.0.0.1:3121/a b +echo $? +rm -rf b # work around bug with http clone + +# Inaccessible source +mkdir a +chmod 000 a +hg clone a b +echo $? + +# Inaccessible destination +mkdir b +cd b +hg init +hg clone . ../a +echo $? +cd .. +chmod 700 a +rm -rf a b + +# Source of wrong type +mkfifo a +hg clone a b +echo $? +rm a + +# Default destination, same directory +mkdir q +cd q +hg init +cd .. +hg clone q + +true diff --git a/tests/test-clone-failure.out b/tests/test-clone-failure.out new file mode 100644 --- /dev/null +++ b/tests/test-clone-failure.out @@ -0,0 +1,44 @@ ++ hg clone a b +abort: No such file or directory: a ++ echo 255 +255 ++ hg clone http://127.0.0.1:3121/a b +requesting all changes +adding changesets +abort: error 111: Connection refused +transaction abort! +rollback completed ++ echo 255 +255 ++ rm -rf b ++ mkdir a ++ chmod 000 a ++ hg clone a b +cp: cannot stat `a/.hg': Permission denied +abort: cp exited with status 1 ++ echo 255 +255 ++ mkdir b ++ cd b ++ hg init ++ hg clone . ../a +abort: destination '../a' already exists ++ echo 1 +1 ++ cd .. ++ chmod 700 a ++ rm -rf a b ++ mkfifo a ++ hg clone a b +cp: cannot stat `a/.hg': Not a directory +abort: cp exited with status 1 ++ echo 255 +255 ++ rm a ++ mkdir q ++ cd q ++ hg init ++ cd .. ++ hg clone q +abort: destination 'q' already exists ++ true diff --git a/tests/test-clone.out b/tests/test-clone.out new file mode 100644 --- /dev/null +++ b/tests/test-clone.out @@ -0,0 +1,32 @@ ++ mkdir a ++ cd a ++ hg init ++ echo a ++ hg add a ++ hg commit -t test -u test -d '0 0' ++ hg clone . ../b ++ cd ../b ++ cat a +a ++ hg verify +checking changesets +checking manifests +crosschecking files in changesets and manifests +checking files +1 files, 1 changesets, 1 total revisions ++ hg clone -U . ../c ++ cd ../c ++ cat a +cat: a: No such file or directory ++ hg verify +checking changesets +checking manifests +crosschecking files in changesets and manifests +checking files +1 files, 1 changesets, 1 total revisions ++ mkdir ../d ++ cd ../d ++ hg clone ../a ++ cd a ++ hg cat a +a