tests/test-clone-failure.t
author Patrick Mezard <patrick@mezard.eu>
Sat, 28 Apr 2012 15:01:57 +0200
branchstable
changeset 16536 63c817ea4a70
parent 15443 a1914d214579
child 16846 e38ed2ceabe7
permissions -rw-r--r--
commit: abort on merge with missing files Here is a script illustrating the previous behaviour: The merge brings a new file 'b' from remote $ hg merge 1 --debug searching for copies back to rev 1 unmatched files in other: b resolving manifests overwrite: False, partial: False ancestor: 07f494440405, local: 540395c44225+, remote: 102a90ea7b4a b: remote created -> g updating: b 1/1 files (100.00%) getting b 1 files updated, 0 files merged, 0 files removed, 0 files unresolved (branch merge, don't forget to commit) Delete but do not remove b $ rm b $ hg st ! b The commit succeeds $ hg commit -m merge $ hg parents --template "{rev} {desc|firstline} files: {files}\n" 3 merge files: $ hg st ! b b changes were ignored, but even b existence was ignored $ hg manifest a This happens because localrepo.commitctx() checks the input ctx.files(), which is empty for workingctx.files() only returns added, modified or removed entries, and bypass files/manifest updates completely. So the committed revision manifest is the same as its first parent one, not containing the 'b' file. This patch forces the commit to abort in presence of a merge and missing files. test-merge4.t is modified accordingly as it was introduced to check hg was not just terminating with a traceback (5e9e8b8d2629).
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
15443
a1914d214579 tests: use 'hghave unix-permissions' for tests that really use chmod
Mads Kiilerich <mads@kiilerich.com>
parents: 13956
diff changeset
     1
  $ "$TESTDIR/hghave" unix-permissions || exit 80
a1914d214579 tests: use 'hghave unix-permissions' for tests that really use chmod
Mads Kiilerich <mads@kiilerich.com>
parents: 13956
diff changeset
     2
12411
5d3c28a339cb tests: unify test-clone-failure
Matt Mackall <mpm@selenic.com>
parents: 9329
diff changeset
     3
No local source
5d3c28a339cb tests: unify test-clone-failure
Matt Mackall <mpm@selenic.com>
parents: 9329
diff changeset
     4
5d3c28a339cb tests: unify test-clone-failure
Matt Mackall <mpm@selenic.com>
parents: 9329
diff changeset
     5
  $ hg clone a b
5d3c28a339cb tests: unify test-clone-failure
Matt Mackall <mpm@selenic.com>
parents: 9329
diff changeset
     6
  abort: repository a not found!
5d3c28a339cb tests: unify test-clone-failure
Matt Mackall <mpm@selenic.com>
parents: 9329
diff changeset
     7
  [255]
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
No remote source
550
96ff7dae94f7 [PATCH] Tests for clone command
mpm@selenic.com
parents:
diff changeset
    10
12411
5d3c28a339cb tests: unify test-clone-failure
Matt Mackall <mpm@selenic.com>
parents: 9329
diff changeset
    11
  $ 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
    12
  abort: error: Connection refused
5d3c28a339cb tests: unify test-clone-failure
Matt Mackall <mpm@selenic.com>
parents: 9329
diff changeset
    13
  [255]
5d3c28a339cb tests: unify test-clone-failure
Matt Mackall <mpm@selenic.com>
parents: 9329
diff changeset
    14
  $ rm -rf b # work around bug with http clone
5d3c28a339cb tests: unify test-clone-failure
Matt Mackall <mpm@selenic.com>
parents: 9329
diff changeset
    15
5d3c28a339cb tests: unify test-clone-failure
Matt Mackall <mpm@selenic.com>
parents: 9329
diff changeset
    16
Inaccessible source
550
96ff7dae94f7 [PATCH] Tests for clone command
mpm@selenic.com
parents:
diff changeset
    17
12411
5d3c28a339cb tests: unify test-clone-failure
Matt Mackall <mpm@selenic.com>
parents: 9329
diff changeset
    18
  $ mkdir a
5d3c28a339cb tests: unify test-clone-failure
Matt Mackall <mpm@selenic.com>
parents: 9329
diff changeset
    19
  $ chmod 000 a
5d3c28a339cb tests: unify test-clone-failure
Matt Mackall <mpm@selenic.com>
parents: 9329
diff changeset
    20
  $ hg clone a b
5d3c28a339cb tests: unify test-clone-failure
Matt Mackall <mpm@selenic.com>
parents: 9329
diff changeset
    21
  abort: repository a not found!
5d3c28a339cb tests: unify test-clone-failure
Matt Mackall <mpm@selenic.com>
parents: 9329
diff changeset
    22
  [255]
5d3c28a339cb tests: unify test-clone-failure
Matt Mackall <mpm@selenic.com>
parents: 9329
diff changeset
    23
5d3c28a339cb tests: unify test-clone-failure
Matt Mackall <mpm@selenic.com>
parents: 9329
diff changeset
    24
Inaccessible destination
550
96ff7dae94f7 [PATCH] Tests for clone command
mpm@selenic.com
parents:
diff changeset
    25
13956
ffb5c09ba822 tests: remove redundant mkdir
Martin Geisler <mg@lazybytes.net>
parents: 13080
diff changeset
    26
  $ hg init b
12411
5d3c28a339cb tests: unify test-clone-failure
Matt Mackall <mpm@selenic.com>
parents: 9329
diff changeset
    27
  $ cd b
5d3c28a339cb tests: unify test-clone-failure
Matt Mackall <mpm@selenic.com>
parents: 9329
diff changeset
    28
  $ hg clone . ../a
5d3c28a339cb tests: unify test-clone-failure
Matt Mackall <mpm@selenic.com>
parents: 9329
diff changeset
    29
  abort: Permission denied: ../a
5d3c28a339cb tests: unify test-clone-failure
Matt Mackall <mpm@selenic.com>
parents: 9329
diff changeset
    30
  [255]
5d3c28a339cb tests: unify test-clone-failure
Matt Mackall <mpm@selenic.com>
parents: 9329
diff changeset
    31
  $ cd ..
5d3c28a339cb tests: unify test-clone-failure
Matt Mackall <mpm@selenic.com>
parents: 9329
diff changeset
    32
  $ chmod 700 a
5d3c28a339cb tests: unify test-clone-failure
Matt Mackall <mpm@selenic.com>
parents: 9329
diff changeset
    33
  $ rm -r a b
5d3c28a339cb tests: unify test-clone-failure
Matt Mackall <mpm@selenic.com>
parents: 9329
diff changeset
    34
5d3c28a339cb tests: unify test-clone-failure
Matt Mackall <mpm@selenic.com>
parents: 9329
diff changeset
    35
Source of wrong type
550
96ff7dae94f7 [PATCH] Tests for clone command
mpm@selenic.com
parents:
diff changeset
    36
12411
5d3c28a339cb tests: unify test-clone-failure
Matt Mackall <mpm@selenic.com>
parents: 9329
diff changeset
    37
  $ if "$TESTDIR/hghave" -q fifo; then
5d3c28a339cb tests: unify test-clone-failure
Matt Mackall <mpm@selenic.com>
parents: 9329
diff changeset
    38
  >     mkfifo a
5d3c28a339cb tests: unify test-clone-failure
Matt Mackall <mpm@selenic.com>
parents: 9329
diff changeset
    39
  >     hg clone a b
5d3c28a339cb tests: unify test-clone-failure
Matt Mackall <mpm@selenic.com>
parents: 9329
diff changeset
    40
  >     rm a
5d3c28a339cb tests: unify test-clone-failure
Matt Mackall <mpm@selenic.com>
parents: 9329
diff changeset
    41
  > else
5d3c28a339cb tests: unify test-clone-failure
Matt Mackall <mpm@selenic.com>
parents: 9329
diff changeset
    42
  >     echo "abort: repository a not found!"
5d3c28a339cb tests: unify test-clone-failure
Matt Mackall <mpm@selenic.com>
parents: 9329
diff changeset
    43
  > fi
5d3c28a339cb tests: unify test-clone-failure
Matt Mackall <mpm@selenic.com>
parents: 9329
diff changeset
    44
  abort: repository a not found!
550
96ff7dae94f7 [PATCH] Tests for clone command
mpm@selenic.com
parents:
diff changeset
    45
12411
5d3c28a339cb tests: unify test-clone-failure
Matt Mackall <mpm@selenic.com>
parents: 9329
diff changeset
    46
Default destination, same directory
5d3c28a339cb tests: unify test-clone-failure
Matt Mackall <mpm@selenic.com>
parents: 9329
diff changeset
    47
13956
ffb5c09ba822 tests: remove redundant mkdir
Martin Geisler <mg@lazybytes.net>
parents: 13080
diff changeset
    48
  $ hg init q
12411
5d3c28a339cb tests: unify test-clone-failure
Matt Mackall <mpm@selenic.com>
parents: 9329
diff changeset
    49
  $ hg clone q
5d3c28a339cb tests: unify test-clone-failure
Matt Mackall <mpm@selenic.com>
parents: 9329
diff changeset
    50
  destination directory: q
5d3c28a339cb tests: unify test-clone-failure
Matt Mackall <mpm@selenic.com>
parents: 9329
diff changeset
    51
  abort: destination 'q' is not empty
5d3c28a339cb tests: unify test-clone-failure
Matt Mackall <mpm@selenic.com>
parents: 9329
diff changeset
    52
  [255]
5d3c28a339cb tests: unify test-clone-failure
Matt Mackall <mpm@selenic.com>
parents: 9329
diff changeset
    53
5d3c28a339cb tests: unify test-clone-failure
Matt Mackall <mpm@selenic.com>
parents: 9329
diff changeset
    54
destination directory not empty
550
96ff7dae94f7 [PATCH] Tests for clone command
mpm@selenic.com
parents:
diff changeset
    55
12411
5d3c28a339cb tests: unify test-clone-failure
Matt Mackall <mpm@selenic.com>
parents: 9329
diff changeset
    56
  $ mkdir a 
5d3c28a339cb tests: unify test-clone-failure
Matt Mackall <mpm@selenic.com>
parents: 9329
diff changeset
    57
  $ echo stuff > a/a
5d3c28a339cb tests: unify test-clone-failure
Matt Mackall <mpm@selenic.com>
parents: 9329
diff changeset
    58
  $ hg clone q a
5d3c28a339cb tests: unify test-clone-failure
Matt Mackall <mpm@selenic.com>
parents: 9329
diff changeset
    59
  abort: destination 'a' is not empty
5d3c28a339cb tests: unify test-clone-failure
Matt Mackall <mpm@selenic.com>
parents: 9329
diff changeset
    60
  [255]
5d3c28a339cb tests: unify test-clone-failure
Matt Mackall <mpm@selenic.com>
parents: 9329
diff changeset
    61
5d3c28a339cb tests: unify test-clone-failure
Matt Mackall <mpm@selenic.com>
parents: 9329
diff changeset
    62
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
    63
12411
5d3c28a339cb tests: unify test-clone-failure
Matt Mackall <mpm@selenic.com>
parents: 9329
diff changeset
    64
  $ hg init c
5d3c28a339cb tests: unify test-clone-failure
Matt Mackall <mpm@selenic.com>
parents: 9329
diff changeset
    65
  $ cd c
5d3c28a339cb tests: unify test-clone-failure
Matt Mackall <mpm@selenic.com>
parents: 9329
diff changeset
    66
  $ echo c > c
5d3c28a339cb tests: unify test-clone-failure
Matt Mackall <mpm@selenic.com>
parents: 9329
diff changeset
    67
  $ hg commit -A -m test
5d3c28a339cb tests: unify test-clone-failure
Matt Mackall <mpm@selenic.com>
parents: 9329
diff changeset
    68
  adding c
5d3c28a339cb tests: unify test-clone-failure
Matt Mackall <mpm@selenic.com>
parents: 9329
diff changeset
    69
  $ chmod -rx .hg/store/data
5d3c28a339cb tests: unify test-clone-failure
Matt Mackall <mpm@selenic.com>
parents: 9329
diff changeset
    70
  $ cd ..
5d3c28a339cb tests: unify test-clone-failure
Matt Mackall <mpm@selenic.com>
parents: 9329
diff changeset
    71
  $ mkdir d
5d3c28a339cb tests: unify test-clone-failure
Matt Mackall <mpm@selenic.com>
parents: 9329
diff changeset
    72
  $ hg clone c d 2> err
5d3c28a339cb tests: unify test-clone-failure
Matt Mackall <mpm@selenic.com>
parents: 9329
diff changeset
    73
  [255]
5d3c28a339cb tests: unify test-clone-failure
Matt Mackall <mpm@selenic.com>
parents: 9329
diff changeset
    74
  $ test -d d
5d3c28a339cb tests: unify test-clone-failure
Matt Mackall <mpm@selenic.com>
parents: 9329
diff changeset
    75
  $ test -d d/.hg
5d3c28a339cb tests: unify test-clone-failure
Matt Mackall <mpm@selenic.com>
parents: 9329
diff changeset
    76
  [1]
7935
39566bb99a9c on clone failure, only remove directories we created
Steve Borho <steve@borho.org>
parents: 7927
diff changeset
    77
12411
5d3c28a339cb tests: unify test-clone-failure
Matt Mackall <mpm@selenic.com>
parents: 9329
diff changeset
    78
reenable perm to allow deletion
9329
567648eab1dd test-clone-failure: reenable perm to allow deletion
Simon Heimberg <simohe@besonet.ch>
parents: 8167
diff changeset
    79
12411
5d3c28a339cb tests: unify test-clone-failure
Matt Mackall <mpm@selenic.com>
parents: 9329
diff changeset
    80
  $ chmod +rx c/.hg/store/data