tests/test-clone-failure.t
author Adrian Buehlmann <adrian@cadifra.com>
Fri, 01 Jun 2012 13:38:18 +0200
changeset 16846 e38ed2ceabe7
parent 15443 a1914d214579
permissions -rw-r--r--
test-clone-failure: enable for Windows using #if
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
16846
e38ed2ceabe7 test-clone-failure: enable for Windows using #if
Adrian Buehlmann <adrian@cadifra.com>
parents: 15443
diff changeset
    10
  abort: error: *refused* (glob)
12411
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
16846
e38ed2ceabe7 test-clone-failure: enable for Windows using #if
Adrian Buehlmann <adrian@cadifra.com>
parents: 15443
diff changeset
    14
e38ed2ceabe7 test-clone-failure: enable for Windows using #if
Adrian Buehlmann <adrian@cadifra.com>
parents: 15443
diff changeset
    15
#if unix-permissions
e38ed2ceabe7 test-clone-failure: enable for Windows using #if
Adrian Buehlmann <adrian@cadifra.com>
parents: 15443
diff changeset
    16
12411
5d3c28a339cb tests: unify test-clone-failure
Matt Mackall <mpm@selenic.com>
parents: 9329
diff changeset
    17
Inaccessible source
550
96ff7dae94f7 [PATCH] Tests for clone command
mpm@selenic.com
parents:
diff changeset
    18
12411
5d3c28a339cb tests: unify test-clone-failure
Matt Mackall <mpm@selenic.com>
parents: 9329
diff changeset
    19
  $ mkdir a
5d3c28a339cb tests: unify test-clone-failure
Matt Mackall <mpm@selenic.com>
parents: 9329
diff changeset
    20
  $ chmod 000 a
5d3c28a339cb tests: unify test-clone-failure
Matt Mackall <mpm@selenic.com>
parents: 9329
diff changeset
    21
  $ hg clone a b
5d3c28a339cb tests: unify test-clone-failure
Matt Mackall <mpm@selenic.com>
parents: 9329
diff changeset
    22
  abort: repository a not found!
5d3c28a339cb tests: unify test-clone-failure
Matt Mackall <mpm@selenic.com>
parents: 9329
diff changeset
    23
  [255]
5d3c28a339cb tests: unify test-clone-failure
Matt Mackall <mpm@selenic.com>
parents: 9329
diff changeset
    24
5d3c28a339cb tests: unify test-clone-failure
Matt Mackall <mpm@selenic.com>
parents: 9329
diff changeset
    25
Inaccessible destination
550
96ff7dae94f7 [PATCH] Tests for clone command
mpm@selenic.com
parents:
diff changeset
    26
13956
ffb5c09ba822 tests: remove redundant mkdir
Martin Geisler <mg@lazybytes.net>
parents: 13080
diff changeset
    27
  $ hg init b
12411
5d3c28a339cb tests: unify test-clone-failure
Matt Mackall <mpm@selenic.com>
parents: 9329
diff changeset
    28
  $ cd b
5d3c28a339cb tests: unify test-clone-failure
Matt Mackall <mpm@selenic.com>
parents: 9329
diff changeset
    29
  $ hg clone . ../a
5d3c28a339cb tests: unify test-clone-failure
Matt Mackall <mpm@selenic.com>
parents: 9329
diff changeset
    30
  abort: Permission denied: ../a
5d3c28a339cb tests: unify test-clone-failure
Matt Mackall <mpm@selenic.com>
parents: 9329
diff changeset
    31
  [255]
5d3c28a339cb tests: unify test-clone-failure
Matt Mackall <mpm@selenic.com>
parents: 9329
diff changeset
    32
  $ cd ..
5d3c28a339cb tests: unify test-clone-failure
Matt Mackall <mpm@selenic.com>
parents: 9329
diff changeset
    33
  $ chmod 700 a
5d3c28a339cb tests: unify test-clone-failure
Matt Mackall <mpm@selenic.com>
parents: 9329
diff changeset
    34
  $ rm -r a b
5d3c28a339cb tests: unify test-clone-failure
Matt Mackall <mpm@selenic.com>
parents: 9329
diff changeset
    35
16846
e38ed2ceabe7 test-clone-failure: enable for Windows using #if
Adrian Buehlmann <adrian@cadifra.com>
parents: 15443
diff changeset
    36
#endif
e38ed2ceabe7 test-clone-failure: enable for Windows using #if
Adrian Buehlmann <adrian@cadifra.com>
parents: 15443
diff changeset
    37
e38ed2ceabe7 test-clone-failure: enable for Windows using #if
Adrian Buehlmann <adrian@cadifra.com>
parents: 15443
diff changeset
    38
12411
5d3c28a339cb tests: unify test-clone-failure
Matt Mackall <mpm@selenic.com>
parents: 9329
diff changeset
    39
Source of wrong type
550
96ff7dae94f7 [PATCH] Tests for clone command
mpm@selenic.com
parents:
diff changeset
    40
12411
5d3c28a339cb tests: unify test-clone-failure
Matt Mackall <mpm@selenic.com>
parents: 9329
diff changeset
    41
  $ if "$TESTDIR/hghave" -q fifo; then
5d3c28a339cb tests: unify test-clone-failure
Matt Mackall <mpm@selenic.com>
parents: 9329
diff changeset
    42
  >     mkfifo a
5d3c28a339cb tests: unify test-clone-failure
Matt Mackall <mpm@selenic.com>
parents: 9329
diff changeset
    43
  >     hg clone a b
5d3c28a339cb tests: unify test-clone-failure
Matt Mackall <mpm@selenic.com>
parents: 9329
diff changeset
    44
  >     rm a
5d3c28a339cb tests: unify test-clone-failure
Matt Mackall <mpm@selenic.com>
parents: 9329
diff changeset
    45
  > else
5d3c28a339cb tests: unify test-clone-failure
Matt Mackall <mpm@selenic.com>
parents: 9329
diff changeset
    46
  >     echo "abort: repository a not found!"
5d3c28a339cb tests: unify test-clone-failure
Matt Mackall <mpm@selenic.com>
parents: 9329
diff changeset
    47
  > fi
5d3c28a339cb tests: unify test-clone-failure
Matt Mackall <mpm@selenic.com>
parents: 9329
diff changeset
    48
  abort: repository a not found!
550
96ff7dae94f7 [PATCH] Tests for clone command
mpm@selenic.com
parents:
diff changeset
    49
12411
5d3c28a339cb tests: unify test-clone-failure
Matt Mackall <mpm@selenic.com>
parents: 9329
diff changeset
    50
Default destination, same directory
5d3c28a339cb tests: unify test-clone-failure
Matt Mackall <mpm@selenic.com>
parents: 9329
diff changeset
    51
13956
ffb5c09ba822 tests: remove redundant mkdir
Martin Geisler <mg@lazybytes.net>
parents: 13080
diff changeset
    52
  $ hg init q
12411
5d3c28a339cb tests: unify test-clone-failure
Matt Mackall <mpm@selenic.com>
parents: 9329
diff changeset
    53
  $ hg clone q
5d3c28a339cb tests: unify test-clone-failure
Matt Mackall <mpm@selenic.com>
parents: 9329
diff changeset
    54
  destination directory: q
5d3c28a339cb tests: unify test-clone-failure
Matt Mackall <mpm@selenic.com>
parents: 9329
diff changeset
    55
  abort: destination 'q' is not empty
5d3c28a339cb tests: unify test-clone-failure
Matt Mackall <mpm@selenic.com>
parents: 9329
diff changeset
    56
  [255]
5d3c28a339cb tests: unify test-clone-failure
Matt Mackall <mpm@selenic.com>
parents: 9329
diff changeset
    57
5d3c28a339cb tests: unify test-clone-failure
Matt Mackall <mpm@selenic.com>
parents: 9329
diff changeset
    58
destination directory not empty
550
96ff7dae94f7 [PATCH] Tests for clone command
mpm@selenic.com
parents:
diff changeset
    59
12411
5d3c28a339cb tests: unify test-clone-failure
Matt Mackall <mpm@selenic.com>
parents: 9329
diff changeset
    60
  $ mkdir a 
5d3c28a339cb tests: unify test-clone-failure
Matt Mackall <mpm@selenic.com>
parents: 9329
diff changeset
    61
  $ echo stuff > a/a
5d3c28a339cb tests: unify test-clone-failure
Matt Mackall <mpm@selenic.com>
parents: 9329
diff changeset
    62
  $ hg clone q a
5d3c28a339cb tests: unify test-clone-failure
Matt Mackall <mpm@selenic.com>
parents: 9329
diff changeset
    63
  abort: destination 'a' is not empty
5d3c28a339cb tests: unify test-clone-failure
Matt Mackall <mpm@selenic.com>
parents: 9329
diff changeset
    64
  [255]
5d3c28a339cb tests: unify test-clone-failure
Matt Mackall <mpm@selenic.com>
parents: 9329
diff changeset
    65
16846
e38ed2ceabe7 test-clone-failure: enable for Windows using #if
Adrian Buehlmann <adrian@cadifra.com>
parents: 15443
diff changeset
    66
e38ed2ceabe7 test-clone-failure: enable for Windows using #if
Adrian Buehlmann <adrian@cadifra.com>
parents: 15443
diff changeset
    67
#if unix-permissions
e38ed2ceabe7 test-clone-failure: enable for Windows using #if
Adrian Buehlmann <adrian@cadifra.com>
parents: 15443
diff changeset
    68
12411
5d3c28a339cb tests: unify test-clone-failure
Matt Mackall <mpm@selenic.com>
parents: 9329
diff changeset
    69
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
    70
12411
5d3c28a339cb tests: unify test-clone-failure
Matt Mackall <mpm@selenic.com>
parents: 9329
diff changeset
    71
  $ hg init c
5d3c28a339cb tests: unify test-clone-failure
Matt Mackall <mpm@selenic.com>
parents: 9329
diff changeset
    72
  $ cd c
5d3c28a339cb tests: unify test-clone-failure
Matt Mackall <mpm@selenic.com>
parents: 9329
diff changeset
    73
  $ echo c > c
5d3c28a339cb tests: unify test-clone-failure
Matt Mackall <mpm@selenic.com>
parents: 9329
diff changeset
    74
  $ hg commit -A -m test
5d3c28a339cb tests: unify test-clone-failure
Matt Mackall <mpm@selenic.com>
parents: 9329
diff changeset
    75
  adding c
5d3c28a339cb tests: unify test-clone-failure
Matt Mackall <mpm@selenic.com>
parents: 9329
diff changeset
    76
  $ chmod -rx .hg/store/data
5d3c28a339cb tests: unify test-clone-failure
Matt Mackall <mpm@selenic.com>
parents: 9329
diff changeset
    77
  $ cd ..
5d3c28a339cb tests: unify test-clone-failure
Matt Mackall <mpm@selenic.com>
parents: 9329
diff changeset
    78
  $ mkdir d
5d3c28a339cb tests: unify test-clone-failure
Matt Mackall <mpm@selenic.com>
parents: 9329
diff changeset
    79
  $ hg clone c d 2> err
5d3c28a339cb tests: unify test-clone-failure
Matt Mackall <mpm@selenic.com>
parents: 9329
diff changeset
    80
  [255]
5d3c28a339cb tests: unify test-clone-failure
Matt Mackall <mpm@selenic.com>
parents: 9329
diff changeset
    81
  $ test -d d
5d3c28a339cb tests: unify test-clone-failure
Matt Mackall <mpm@selenic.com>
parents: 9329
diff changeset
    82
  $ test -d d/.hg
5d3c28a339cb tests: unify test-clone-failure
Matt Mackall <mpm@selenic.com>
parents: 9329
diff changeset
    83
  [1]
7935
39566bb99a9c on clone failure, only remove directories we created
Steve Borho <steve@borho.org>
parents: 7927
diff changeset
    84
12411
5d3c28a339cb tests: unify test-clone-failure
Matt Mackall <mpm@selenic.com>
parents: 9329
diff changeset
    85
reenable perm to allow deletion
9329
567648eab1dd test-clone-failure: reenable perm to allow deletion
Simon Heimberg <simohe@besonet.ch>
parents: 8167
diff changeset
    86
12411
5d3c28a339cb tests: unify test-clone-failure
Matt Mackall <mpm@selenic.com>
parents: 9329
diff changeset
    87
  $ chmod +rx c/.hg/store/data
16846
e38ed2ceabe7 test-clone-failure: enable for Windows using #if
Adrian Buehlmann <adrian@cadifra.com>
parents: 15443
diff changeset
    88
e38ed2ceabe7 test-clone-failure: enable for Windows using #if
Adrian Buehlmann <adrian@cadifra.com>
parents: 15443
diff changeset
    89
#endif