tests/test-clone-failure.t
author Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
Tue, 22 Mar 2011 07:40:02 +0100
changeset 13722 f4a85acef50c
parent 13080 bdb73eede5fb
child 13956 ffb5c09ba822
permissions -rw-r--r--
wireproto: fix decodelist to properly return empty list Needed by tests for next patch introducing known().
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
12411
5d3c28a339cb tests: unify test-clone-failure
Matt Mackall <mpm@selenic.com>
parents: 9329
diff changeset
     1
No local source
5d3c28a339cb tests: unify test-clone-failure
Matt Mackall <mpm@selenic.com>
parents: 9329
diff changeset
     2
5d3c28a339cb tests: unify test-clone-failure
Matt Mackall <mpm@selenic.com>
parents: 9329
diff changeset
     3
  $ hg clone a b
5d3c28a339cb tests: unify test-clone-failure
Matt Mackall <mpm@selenic.com>
parents: 9329
diff changeset
     4
  abort: repository a not found!
5d3c28a339cb tests: unify test-clone-failure
Matt Mackall <mpm@selenic.com>
parents: 9329
diff changeset
     5
  [255]
550
96ff7dae94f7 [PATCH] Tests for clone command
mpm@selenic.com
parents:
diff changeset
     6
12411
5d3c28a339cb tests: unify test-clone-failure
Matt Mackall <mpm@selenic.com>
parents: 9329
diff changeset
     7
No remote source
550
96ff7dae94f7 [PATCH] Tests for clone command
mpm@selenic.com
parents:
diff changeset
     8
12411
5d3c28a339cb tests: unify test-clone-failure
Matt Mackall <mpm@selenic.com>
parents: 9329
diff changeset
     9
  $ hg clone http://127.0.0.1:3121/a b
5d3c28a339cb tests: unify test-clone-failure
Matt Mackall <mpm@selenic.com>
parents: 9329
diff changeset
    10
  abort: error: Connection refused
5d3c28a339cb tests: unify test-clone-failure
Matt Mackall <mpm@selenic.com>
parents: 9329
diff changeset
    11
  [255]
5d3c28a339cb tests: unify test-clone-failure
Matt Mackall <mpm@selenic.com>
parents: 9329
diff changeset
    12
  $ rm -rf b # work around bug with http clone
5d3c28a339cb tests: unify test-clone-failure
Matt Mackall <mpm@selenic.com>
parents: 9329
diff changeset
    13
5d3c28a339cb tests: unify test-clone-failure
Matt Mackall <mpm@selenic.com>
parents: 9329
diff changeset
    14
Inaccessible source
550
96ff7dae94f7 [PATCH] Tests for clone command
mpm@selenic.com
parents:
diff changeset
    15
12411
5d3c28a339cb tests: unify test-clone-failure
Matt Mackall <mpm@selenic.com>
parents: 9329
diff changeset
    16
  $ mkdir a
5d3c28a339cb tests: unify test-clone-failure
Matt Mackall <mpm@selenic.com>
parents: 9329
diff changeset
    17
  $ chmod 000 a
5d3c28a339cb tests: unify test-clone-failure
Matt Mackall <mpm@selenic.com>
parents: 9329
diff changeset
    18
  $ hg clone a b
5d3c28a339cb tests: unify test-clone-failure
Matt Mackall <mpm@selenic.com>
parents: 9329
diff changeset
    19
  abort: repository a not found!
5d3c28a339cb tests: unify test-clone-failure
Matt Mackall <mpm@selenic.com>
parents: 9329
diff changeset
    20
  [255]
5d3c28a339cb tests: unify test-clone-failure
Matt Mackall <mpm@selenic.com>
parents: 9329
diff changeset
    21
5d3c28a339cb tests: unify test-clone-failure
Matt Mackall <mpm@selenic.com>
parents: 9329
diff changeset
    22
Inaccessible destination
550
96ff7dae94f7 [PATCH] Tests for clone command
mpm@selenic.com
parents:
diff changeset
    23
12411
5d3c28a339cb tests: unify test-clone-failure
Matt Mackall <mpm@selenic.com>
parents: 9329
diff changeset
    24
  $ mkdir b
5d3c28a339cb tests: unify test-clone-failure
Matt Mackall <mpm@selenic.com>
parents: 9329
diff changeset
    25
  $ cd b
5d3c28a339cb tests: unify test-clone-failure
Matt Mackall <mpm@selenic.com>
parents: 9329
diff changeset
    26
  $ hg init
5d3c28a339cb tests: unify test-clone-failure
Matt Mackall <mpm@selenic.com>
parents: 9329
diff changeset
    27
  $ hg clone . ../a
5d3c28a339cb tests: unify test-clone-failure
Matt Mackall <mpm@selenic.com>
parents: 9329
diff changeset
    28
  abort: Permission denied: ../a
5d3c28a339cb tests: unify test-clone-failure
Matt Mackall <mpm@selenic.com>
parents: 9329
diff changeset
    29
  [255]
5d3c28a339cb tests: unify test-clone-failure
Matt Mackall <mpm@selenic.com>
parents: 9329
diff changeset
    30
  $ cd ..
5d3c28a339cb tests: unify test-clone-failure
Matt Mackall <mpm@selenic.com>
parents: 9329
diff changeset
    31
  $ chmod 700 a
5d3c28a339cb tests: unify test-clone-failure
Matt Mackall <mpm@selenic.com>
parents: 9329
diff changeset
    32
  $ rm -r a b
5d3c28a339cb tests: unify test-clone-failure
Matt Mackall <mpm@selenic.com>
parents: 9329
diff changeset
    33
5d3c28a339cb tests: unify test-clone-failure
Matt Mackall <mpm@selenic.com>
parents: 9329
diff changeset
    34
Source of wrong type
550
96ff7dae94f7 [PATCH] Tests for clone command
mpm@selenic.com
parents:
diff changeset
    35
12411
5d3c28a339cb tests: unify test-clone-failure
Matt Mackall <mpm@selenic.com>
parents: 9329
diff changeset
    36
  $ if "$TESTDIR/hghave" -q fifo; then
5d3c28a339cb tests: unify test-clone-failure
Matt Mackall <mpm@selenic.com>
parents: 9329
diff changeset
    37
  >     mkfifo a
5d3c28a339cb tests: unify test-clone-failure
Matt Mackall <mpm@selenic.com>
parents: 9329
diff changeset
    38
  >     hg clone a b
5d3c28a339cb tests: unify test-clone-failure
Matt Mackall <mpm@selenic.com>
parents: 9329
diff changeset
    39
  >     rm a
5d3c28a339cb tests: unify test-clone-failure
Matt Mackall <mpm@selenic.com>
parents: 9329
diff changeset
    40
  > else
5d3c28a339cb tests: unify test-clone-failure
Matt Mackall <mpm@selenic.com>
parents: 9329
diff changeset
    41
  >     echo "abort: repository a not found!"
5d3c28a339cb tests: unify test-clone-failure
Matt Mackall <mpm@selenic.com>
parents: 9329
diff changeset
    42
  > fi
5d3c28a339cb tests: unify test-clone-failure
Matt Mackall <mpm@selenic.com>
parents: 9329
diff changeset
    43
  abort: repository a not found!
550
96ff7dae94f7 [PATCH] Tests for clone command
mpm@selenic.com
parents:
diff changeset
    44
12411
5d3c28a339cb tests: unify test-clone-failure
Matt Mackall <mpm@selenic.com>
parents: 9329
diff changeset
    45
Default destination, same directory
5d3c28a339cb tests: unify test-clone-failure
Matt Mackall <mpm@selenic.com>
parents: 9329
diff changeset
    46
5d3c28a339cb tests: unify test-clone-failure
Matt Mackall <mpm@selenic.com>
parents: 9329
diff changeset
    47
  $ mkdir q
5d3c28a339cb tests: unify test-clone-failure
Matt Mackall <mpm@selenic.com>
parents: 9329
diff changeset
    48
  $ cd q
5d3c28a339cb tests: unify test-clone-failure
Matt Mackall <mpm@selenic.com>
parents: 9329
diff changeset
    49
  $ hg init
5d3c28a339cb tests: unify test-clone-failure
Matt Mackall <mpm@selenic.com>
parents: 9329
diff changeset
    50
  $ cd ..
5d3c28a339cb tests: unify test-clone-failure
Matt Mackall <mpm@selenic.com>
parents: 9329
diff changeset
    51
  $ hg clone q
5d3c28a339cb tests: unify test-clone-failure
Matt Mackall <mpm@selenic.com>
parents: 9329
diff changeset
    52
  destination directory: q
5d3c28a339cb tests: unify test-clone-failure
Matt Mackall <mpm@selenic.com>
parents: 9329
diff changeset
    53
  abort: destination 'q' is not empty
5d3c28a339cb tests: unify test-clone-failure
Matt Mackall <mpm@selenic.com>
parents: 9329
diff changeset
    54
  [255]
5d3c28a339cb tests: unify test-clone-failure
Matt Mackall <mpm@selenic.com>
parents: 9329
diff changeset
    55
5d3c28a339cb tests: unify test-clone-failure
Matt Mackall <mpm@selenic.com>
parents: 9329
diff changeset
    56
destination directory not empty
550
96ff7dae94f7 [PATCH] Tests for clone command
mpm@selenic.com
parents:
diff changeset
    57
12411
5d3c28a339cb tests: unify test-clone-failure
Matt Mackall <mpm@selenic.com>
parents: 9329
diff changeset
    58
  $ mkdir a 
5d3c28a339cb tests: unify test-clone-failure
Matt Mackall <mpm@selenic.com>
parents: 9329
diff changeset
    59
  $ echo stuff > a/a
5d3c28a339cb tests: unify test-clone-failure
Matt Mackall <mpm@selenic.com>
parents: 9329
diff changeset
    60
  $ hg clone q a
5d3c28a339cb tests: unify test-clone-failure
Matt Mackall <mpm@selenic.com>
parents: 9329
diff changeset
    61
  abort: destination 'a' is not empty
5d3c28a339cb tests: unify test-clone-failure
Matt Mackall <mpm@selenic.com>
parents: 9329
diff changeset
    62
  [255]
5d3c28a339cb tests: unify test-clone-failure
Matt Mackall <mpm@selenic.com>
parents: 9329
diff changeset
    63
5d3c28a339cb tests: unify test-clone-failure
Matt Mackall <mpm@selenic.com>
parents: 9329
diff changeset
    64
leave existing directory in place after clone failure
7927
a218ba5f60df allow clone into existing but empty directories
Steve Borho <steve@borho.org>
parents: 5071
diff changeset
    65
12411
5d3c28a339cb tests: unify test-clone-failure
Matt Mackall <mpm@selenic.com>
parents: 9329
diff changeset
    66
  $ hg init c
5d3c28a339cb tests: unify test-clone-failure
Matt Mackall <mpm@selenic.com>
parents: 9329
diff changeset
    67
  $ cd c
5d3c28a339cb tests: unify test-clone-failure
Matt Mackall <mpm@selenic.com>
parents: 9329
diff changeset
    68
  $ echo c > c
5d3c28a339cb tests: unify test-clone-failure
Matt Mackall <mpm@selenic.com>
parents: 9329
diff changeset
    69
  $ hg commit -A -m test
5d3c28a339cb tests: unify test-clone-failure
Matt Mackall <mpm@selenic.com>
parents: 9329
diff changeset
    70
  adding c
5d3c28a339cb tests: unify test-clone-failure
Matt Mackall <mpm@selenic.com>
parents: 9329
diff changeset
    71
  $ chmod -rx .hg/store/data
5d3c28a339cb tests: unify test-clone-failure
Matt Mackall <mpm@selenic.com>
parents: 9329
diff changeset
    72
  $ cd ..
5d3c28a339cb tests: unify test-clone-failure
Matt Mackall <mpm@selenic.com>
parents: 9329
diff changeset
    73
  $ mkdir d
5d3c28a339cb tests: unify test-clone-failure
Matt Mackall <mpm@selenic.com>
parents: 9329
diff changeset
    74
  $ hg clone c d 2> err
5d3c28a339cb tests: unify test-clone-failure
Matt Mackall <mpm@selenic.com>
parents: 9329
diff changeset
    75
  [255]
5d3c28a339cb tests: unify test-clone-failure
Matt Mackall <mpm@selenic.com>
parents: 9329
diff changeset
    76
  $ test -d d
5d3c28a339cb tests: unify test-clone-failure
Matt Mackall <mpm@selenic.com>
parents: 9329
diff changeset
    77
  $ test -d d/.hg
5d3c28a339cb tests: unify test-clone-failure
Matt Mackall <mpm@selenic.com>
parents: 9329
diff changeset
    78
  [1]
7935
39566bb99a9c on clone failure, only remove directories we created
Steve Borho <steve@borho.org>
parents: 7927
diff changeset
    79
12411
5d3c28a339cb tests: unify test-clone-failure
Matt Mackall <mpm@selenic.com>
parents: 9329
diff changeset
    80
reenable perm to allow deletion
9329
567648eab1dd test-clone-failure: reenable perm to allow deletion
Simon Heimberg <simohe@besonet.ch>
parents: 8167
diff changeset
    81
12411
5d3c28a339cb tests: unify test-clone-failure
Matt Mackall <mpm@selenic.com>
parents: 9329
diff changeset
    82
  $ chmod +rx c/.hg/store/data