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