tests/test-clone-failure
changeset 12411 5d3c28a339cb
parent 12410 2bfb335c7594
child 12412 2dbb9e5e3454
equal deleted inserted replaced
12410:2bfb335c7594 12411:5d3c28a339cb
     1 #!/bin/sh
       
     2 
       
     3 # No local source
       
     4 hg clone a b
       
     5 echo $?
       
     6 
       
     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
       
    11 
       
    12 # Inaccessible source
       
    13 mkdir a
       
    14 chmod 000 a
       
    15 hg clone a b
       
    16 echo $?
       
    17 
       
    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
       
    27 
       
    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
       
    38 
       
    39 # Default destination, same directory
       
    40 mkdir q
       
    41 cd q
       
    42 hg init
       
    43 cd ..
       
    44 hg clone q
       
    45 
       
    46 # destination directory not empty
       
    47 mkdir a 
       
    48 echo stuff > a/a
       
    49 hg clone q a
       
    50 echo $?
       
    51 
       
    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"
       
    64 
       
    65 # reenable perm to allow deletion
       
    66 chmod +rx c/.hg/store/data
       
    67 
       
    68 true