##// END OF EJS Templates
tests: unify test-clone-failure
Matt Mackall -
r12411:5d3c28a3 default
parent child Browse files
Show More
@@ -1,68 +1,83 b''
1 #!/bin/sh
1 No local source
2
3 $ hg clone a b
4 abort: repository a not found!
5 [255]
2 6
3 # No local source
4 hg clone a b
5 echo $?
7 No remote source
6 8
7 # No remote source
8 hg clone http://127.0.0.1:3121/a b
9 echo $?
10 rm -rf b # work around bug with http clone
9 $ hg clone http://127.0.0.1:3121/a b
10 abort: error: Connection refused
11 [255]
12 $ rm -rf b # work around bug with http clone
13
14 Inaccessible source
11 15
12 # Inaccessible source
13 mkdir a
14 chmod 000 a
15 hg clone a b
16 echo $?
16 $ mkdir a
17 $ chmod 000 a
18 $ hg clone a b
19 abort: repository a not found!
20 [255]
21
22 Inaccessible destination
17 23
18 # Inaccessible destination
19 mkdir b
20 cd b
21 hg init
22 hg clone . ../a
23 echo $?
24 cd ..
25 chmod 700 a
26 rm -r a b
24 $ mkdir b
25 $ cd b
26 $ hg init
27 $ hg clone . ../a
28 abort: Permission denied: ../a
29 [255]
30 $ cd ..
31 $ chmod 700 a
32 $ rm -r a b
33
34 Source of wrong type
27 35
28 # Source of wrong type
29 if "$TESTDIR/hghave" -q fifo; then
30 mkfifo a
31 hg clone a b
32 echo $?
33 rm a
34 else
35 echo "abort: repository a not found!"
36 echo 255
37 fi
36 $ if "$TESTDIR/hghave" -q fifo; then
37 > mkfifo a
38 > hg clone a b
39 > rm a
40 > else
41 > echo "abort: repository a not found!"
42 > echo 255
43 > fi
44 abort: repository a not found!
38 45
39 # Default destination, same directory
40 mkdir q
41 cd q
42 hg init
43 cd ..
44 hg clone q
46 Default destination, same directory
47
48 $ mkdir q
49 $ cd q
50 $ hg init
51 $ cd ..
52 $ hg clone q
53 destination directory: q
54 abort: destination 'q' is not empty
55 [255]
56
57 destination directory not empty
45 58
46 # destination directory not empty
47 mkdir a
48 echo stuff > a/a
49 hg clone q a
50 echo $?
59 $ mkdir a
60 $ echo stuff > a/a
61 $ hg clone q a
62 abort: destination 'a' is not empty
63 [255]
64
65 leave existing directory in place after clone failure
51 66
52 # leave existing directory in place after clone failure
53 hg init c
54 cd c
55 echo c > c
56 hg commit -A -m test
57 chmod -rx .hg/store/data
58 cd ..
59 mkdir d
60 hg clone c d 2> err
61 echo $?
62 test -d d && echo "dir is still here" || echo "dir is gone"
63 test -d d/.hg && echo "repo is still here" || echo "repo is gone"
67 $ hg init c
68 $ cd c
69 $ echo c > c
70 $ hg commit -A -m test
71 adding c
72 $ chmod -rx .hg/store/data
73 $ cd ..
74 $ mkdir d
75 $ hg clone c d 2> err
76 [255]
77 $ test -d d
78 $ test -d d/.hg
79 [1]
64 80
65 # reenable perm to allow deletion
66 chmod +rx c/.hg/store/data
81 reenable perm to allow deletion
67 82
68 true
83 $ chmod +rx c/.hg/store/data
1 NO CONTENT: file was removed
General Comments 0
You need to be logged in to leave comments. Login now