tests/test-issue660.t
author Sune Foldager <cryo@cyanite.org>
Mon, 13 Sep 2010 16:25:13 +0200
changeset 12278 c4c2ba553401
parent 12195 ee41be2bbf5a
child 12316 4134686b83e1
permissions -rw-r--r--
merge with stable
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
8936
1de6e7e1bb9f change wiki/bts URLs to point to new hostname
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 6210
diff changeset
     1
# http://mercurial.selenic.com/bts/issue660
5487
7a64931e2d76 Fix file-changed-to-dir and dir-to-file commits (issue660).
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
     2
12195
ee41be2bbf5a tests: unify test-issue*
Adrian Buehlmann <adrian@cadifra.com>
parents: 11551
diff changeset
     3
  $ hg init
ee41be2bbf5a tests: unify test-issue*
Adrian Buehlmann <adrian@cadifra.com>
parents: 11551
diff changeset
     4
  $ echo a > a
ee41be2bbf5a tests: unify test-issue*
Adrian Buehlmann <adrian@cadifra.com>
parents: 11551
diff changeset
     5
  $ mkdir b
ee41be2bbf5a tests: unify test-issue*
Adrian Buehlmann <adrian@cadifra.com>
parents: 11551
diff changeset
     6
  $ echo b > b/b
ee41be2bbf5a tests: unify test-issue*
Adrian Buehlmann <adrian@cadifra.com>
parents: 11551
diff changeset
     7
  $ hg commit -A -m "a is file, b is dir"
ee41be2bbf5a tests: unify test-issue*
Adrian Buehlmann <adrian@cadifra.com>
parents: 11551
diff changeset
     8
  adding a
ee41be2bbf5a tests: unify test-issue*
Adrian Buehlmann <adrian@cadifra.com>
parents: 11551
diff changeset
     9
  adding b/b
5487
7a64931e2d76 Fix file-changed-to-dir and dir-to-file commits (issue660).
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
    10
12195
ee41be2bbf5a tests: unify test-issue*
Adrian Buehlmann <adrian@cadifra.com>
parents: 11551
diff changeset
    11
File replaced with directory:
5487
7a64931e2d76 Fix file-changed-to-dir and dir-to-file commits (issue660).
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
    12
12195
ee41be2bbf5a tests: unify test-issue*
Adrian Buehlmann <adrian@cadifra.com>
parents: 11551
diff changeset
    13
  $ rm a
ee41be2bbf5a tests: unify test-issue*
Adrian Buehlmann <adrian@cadifra.com>
parents: 11551
diff changeset
    14
  $ mkdir a
ee41be2bbf5a tests: unify test-issue*
Adrian Buehlmann <adrian@cadifra.com>
parents: 11551
diff changeset
    15
  $ echo a > a/a
ee41be2bbf5a tests: unify test-issue*
Adrian Buehlmann <adrian@cadifra.com>
parents: 11551
diff changeset
    16
ee41be2bbf5a tests: unify test-issue*
Adrian Buehlmann <adrian@cadifra.com>
parents: 11551
diff changeset
    17
Should fail - would corrupt dirstate:
5487
7a64931e2d76 Fix file-changed-to-dir and dir-to-file commits (issue660).
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
    18
12195
ee41be2bbf5a tests: unify test-issue*
Adrian Buehlmann <adrian@cadifra.com>
parents: 11551
diff changeset
    19
  $ hg add a/a
ee41be2bbf5a tests: unify test-issue*
Adrian Buehlmann <adrian@cadifra.com>
parents: 11551
diff changeset
    20
  abort: file 'a' in dirstate clashes with 'a/a'
ee41be2bbf5a tests: unify test-issue*
Adrian Buehlmann <adrian@cadifra.com>
parents: 11551
diff changeset
    21
ee41be2bbf5a tests: unify test-issue*
Adrian Buehlmann <adrian@cadifra.com>
parents: 11551
diff changeset
    22
Removing shadow:
ee41be2bbf5a tests: unify test-issue*
Adrian Buehlmann <adrian@cadifra.com>
parents: 11551
diff changeset
    23
ee41be2bbf5a tests: unify test-issue*
Adrian Buehlmann <adrian@cadifra.com>
parents: 11551
diff changeset
    24
  $ hg rm --after a
ee41be2bbf5a tests: unify test-issue*
Adrian Buehlmann <adrian@cadifra.com>
parents: 11551
diff changeset
    25
ee41be2bbf5a tests: unify test-issue*
Adrian Buehlmann <adrian@cadifra.com>
parents: 11551
diff changeset
    26
Should succeed - shadow removed:
5487
7a64931e2d76 Fix file-changed-to-dir and dir-to-file commits (issue660).
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
    27
12195
ee41be2bbf5a tests: unify test-issue*
Adrian Buehlmann <adrian@cadifra.com>
parents: 11551
diff changeset
    28
  $ hg add a/a
ee41be2bbf5a tests: unify test-issue*
Adrian Buehlmann <adrian@cadifra.com>
parents: 11551
diff changeset
    29
ee41be2bbf5a tests: unify test-issue*
Adrian Buehlmann <adrian@cadifra.com>
parents: 11551
diff changeset
    30
Directory replaced with file:
5487
7a64931e2d76 Fix file-changed-to-dir and dir-to-file commits (issue660).
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
    31
12195
ee41be2bbf5a tests: unify test-issue*
Adrian Buehlmann <adrian@cadifra.com>
parents: 11551
diff changeset
    32
  $ rm -r b
ee41be2bbf5a tests: unify test-issue*
Adrian Buehlmann <adrian@cadifra.com>
parents: 11551
diff changeset
    33
  $ echo b > b
ee41be2bbf5a tests: unify test-issue*
Adrian Buehlmann <adrian@cadifra.com>
parents: 11551
diff changeset
    34
ee41be2bbf5a tests: unify test-issue*
Adrian Buehlmann <adrian@cadifra.com>
parents: 11551
diff changeset
    35
Should fail - would corrupt dirstate:
5487
7a64931e2d76 Fix file-changed-to-dir and dir-to-file commits (issue660).
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
    36
12195
ee41be2bbf5a tests: unify test-issue*
Adrian Buehlmann <adrian@cadifra.com>
parents: 11551
diff changeset
    37
  $ hg add b
ee41be2bbf5a tests: unify test-issue*
Adrian Buehlmann <adrian@cadifra.com>
parents: 11551
diff changeset
    38
  abort: directory 'b' already in dirstate
5487
7a64931e2d76 Fix file-changed-to-dir and dir-to-file commits (issue660).
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
    39
12195
ee41be2bbf5a tests: unify test-issue*
Adrian Buehlmann <adrian@cadifra.com>
parents: 11551
diff changeset
    40
Removing shadow:
5487
7a64931e2d76 Fix file-changed-to-dir and dir-to-file commits (issue660).
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
    41
12195
ee41be2bbf5a tests: unify test-issue*
Adrian Buehlmann <adrian@cadifra.com>
parents: 11551
diff changeset
    42
  $ hg rm --after b/b
ee41be2bbf5a tests: unify test-issue*
Adrian Buehlmann <adrian@cadifra.com>
parents: 11551
diff changeset
    43
ee41be2bbf5a tests: unify test-issue*
Adrian Buehlmann <adrian@cadifra.com>
parents: 11551
diff changeset
    44
Should succeed - shadow removed:
5487
7a64931e2d76 Fix file-changed-to-dir and dir-to-file commits (issue660).
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
    45
12195
ee41be2bbf5a tests: unify test-issue*
Adrian Buehlmann <adrian@cadifra.com>
parents: 11551
diff changeset
    46
  $ hg add b
ee41be2bbf5a tests: unify test-issue*
Adrian Buehlmann <adrian@cadifra.com>
parents: 11551
diff changeset
    47
ee41be2bbf5a tests: unify test-issue*
Adrian Buehlmann <adrian@cadifra.com>
parents: 11551
diff changeset
    48
Look what we got:
5487
7a64931e2d76 Fix file-changed-to-dir and dir-to-file commits (issue660).
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
    49
12195
ee41be2bbf5a tests: unify test-issue*
Adrian Buehlmann <adrian@cadifra.com>
parents: 11551
diff changeset
    50
  $ hg st
ee41be2bbf5a tests: unify test-issue*
Adrian Buehlmann <adrian@cadifra.com>
parents: 11551
diff changeset
    51
  A a/a
ee41be2bbf5a tests: unify test-issue*
Adrian Buehlmann <adrian@cadifra.com>
parents: 11551
diff changeset
    52
  A b
ee41be2bbf5a tests: unify test-issue*
Adrian Buehlmann <adrian@cadifra.com>
parents: 11551
diff changeset
    53
  R a
ee41be2bbf5a tests: unify test-issue*
Adrian Buehlmann <adrian@cadifra.com>
parents: 11551
diff changeset
    54
  R b/b
5487
7a64931e2d76 Fix file-changed-to-dir and dir-to-file commits (issue660).
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
    55
12195
ee41be2bbf5a tests: unify test-issue*
Adrian Buehlmann <adrian@cadifra.com>
parents: 11551
diff changeset
    56
Revert reintroducing shadow - should fail:
5487
7a64931e2d76 Fix file-changed-to-dir and dir-to-file commits (issue660).
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
    57
12195
ee41be2bbf5a tests: unify test-issue*
Adrian Buehlmann <adrian@cadifra.com>
parents: 11551
diff changeset
    58
  $ rm -r a b
ee41be2bbf5a tests: unify test-issue*
Adrian Buehlmann <adrian@cadifra.com>
parents: 11551
diff changeset
    59
  $ hg revert b/b
ee41be2bbf5a tests: unify test-issue*
Adrian Buehlmann <adrian@cadifra.com>
parents: 11551
diff changeset
    60
  abort: file 'b' in dirstate clashes with 'b/b'
ee41be2bbf5a tests: unify test-issue*
Adrian Buehlmann <adrian@cadifra.com>
parents: 11551
diff changeset
    61
ee41be2bbf5a tests: unify test-issue*
Adrian Buehlmann <adrian@cadifra.com>
parents: 11551
diff changeset
    62
Revert all - should succeed:
5487
7a64931e2d76 Fix file-changed-to-dir and dir-to-file commits (issue660).
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
    63
12195
ee41be2bbf5a tests: unify test-issue*
Adrian Buehlmann <adrian@cadifra.com>
parents: 11551
diff changeset
    64
  $ hg revert --all
ee41be2bbf5a tests: unify test-issue*
Adrian Buehlmann <adrian@cadifra.com>
parents: 11551
diff changeset
    65
  undeleting a
ee41be2bbf5a tests: unify test-issue*
Adrian Buehlmann <adrian@cadifra.com>
parents: 11551
diff changeset
    66
  forgetting a/a
ee41be2bbf5a tests: unify test-issue*
Adrian Buehlmann <adrian@cadifra.com>
parents: 11551
diff changeset
    67
  forgetting b
ee41be2bbf5a tests: unify test-issue*
Adrian Buehlmann <adrian@cadifra.com>
parents: 11551
diff changeset
    68
  undeleting b/b
ee41be2bbf5a tests: unify test-issue*
Adrian Buehlmann <adrian@cadifra.com>
parents: 11551
diff changeset
    69
ee41be2bbf5a tests: unify test-issue*
Adrian Buehlmann <adrian@cadifra.com>
parents: 11551
diff changeset
    70
  $ hg st
5487
7a64931e2d76 Fix file-changed-to-dir and dir-to-file commits (issue660).
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
    71
12195
ee41be2bbf5a tests: unify test-issue*
Adrian Buehlmann <adrian@cadifra.com>
parents: 11551
diff changeset
    72
addremove:
5487
7a64931e2d76 Fix file-changed-to-dir and dir-to-file commits (issue660).
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
    73
12195
ee41be2bbf5a tests: unify test-issue*
Adrian Buehlmann <adrian@cadifra.com>
parents: 11551
diff changeset
    74
  $ rm -r a b
ee41be2bbf5a tests: unify test-issue*
Adrian Buehlmann <adrian@cadifra.com>
parents: 11551
diff changeset
    75
  $ mkdir a
ee41be2bbf5a tests: unify test-issue*
Adrian Buehlmann <adrian@cadifra.com>
parents: 11551
diff changeset
    76
  $ echo a > a/a
ee41be2bbf5a tests: unify test-issue*
Adrian Buehlmann <adrian@cadifra.com>
parents: 11551
diff changeset
    77
  $ echo b > b
ee41be2bbf5a tests: unify test-issue*
Adrian Buehlmann <adrian@cadifra.com>
parents: 11551
diff changeset
    78
ee41be2bbf5a tests: unify test-issue*
Adrian Buehlmann <adrian@cadifra.com>
parents: 11551
diff changeset
    79
  $ hg addremove -s 0
ee41be2bbf5a tests: unify test-issue*
Adrian Buehlmann <adrian@cadifra.com>
parents: 11551
diff changeset
    80
  removing a
ee41be2bbf5a tests: unify test-issue*
Adrian Buehlmann <adrian@cadifra.com>
parents: 11551
diff changeset
    81
  adding a/a
ee41be2bbf5a tests: unify test-issue*
Adrian Buehlmann <adrian@cadifra.com>
parents: 11551
diff changeset
    82
  adding b
ee41be2bbf5a tests: unify test-issue*
Adrian Buehlmann <adrian@cadifra.com>
parents: 11551
diff changeset
    83
  removing b/b
5487
7a64931e2d76 Fix file-changed-to-dir and dir-to-file commits (issue660).
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
    84
12195
ee41be2bbf5a tests: unify test-issue*
Adrian Buehlmann <adrian@cadifra.com>
parents: 11551
diff changeset
    85
  $ hg st
ee41be2bbf5a tests: unify test-issue*
Adrian Buehlmann <adrian@cadifra.com>
parents: 11551
diff changeset
    86
  A a/a
ee41be2bbf5a tests: unify test-issue*
Adrian Buehlmann <adrian@cadifra.com>
parents: 11551
diff changeset
    87
  A b
ee41be2bbf5a tests: unify test-issue*
Adrian Buehlmann <adrian@cadifra.com>
parents: 11551
diff changeset
    88
  R a
ee41be2bbf5a tests: unify test-issue*
Adrian Buehlmann <adrian@cadifra.com>
parents: 11551
diff changeset
    89
  R b/b
ee41be2bbf5a tests: unify test-issue*
Adrian Buehlmann <adrian@cadifra.com>
parents: 11551
diff changeset
    90
ee41be2bbf5a tests: unify test-issue*
Adrian Buehlmann <adrian@cadifra.com>
parents: 11551
diff changeset
    91
commit:
5487
7a64931e2d76 Fix file-changed-to-dir and dir-to-file commits (issue660).
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
    92
12195
ee41be2bbf5a tests: unify test-issue*
Adrian Buehlmann <adrian@cadifra.com>
parents: 11551
diff changeset
    93
  $ hg ci -A -m "a is dir, b is file"
ee41be2bbf5a tests: unify test-issue*
Adrian Buehlmann <adrian@cadifra.com>
parents: 11551
diff changeset
    94
  $ hg st --all
ee41be2bbf5a tests: unify test-issue*
Adrian Buehlmann <adrian@cadifra.com>
parents: 11551
diff changeset
    95
  C a/a
ee41be2bbf5a tests: unify test-issue*
Adrian Buehlmann <adrian@cadifra.com>
parents: 11551
diff changeset
    96
  C b
5487
7a64931e2d76 Fix file-changed-to-dir and dir-to-file commits (issue660).
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
    97
12195
ee41be2bbf5a tests: unify test-issue*
Adrian Buehlmann <adrian@cadifra.com>
parents: 11551
diff changeset
    98
Long directory replaced with file:
5487
7a64931e2d76 Fix file-changed-to-dir and dir-to-file commits (issue660).
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
    99
12195
ee41be2bbf5a tests: unify test-issue*
Adrian Buehlmann <adrian@cadifra.com>
parents: 11551
diff changeset
   100
  $ mkdir d
ee41be2bbf5a tests: unify test-issue*
Adrian Buehlmann <adrian@cadifra.com>
parents: 11551
diff changeset
   101
  $ mkdir d/d
ee41be2bbf5a tests: unify test-issue*
Adrian Buehlmann <adrian@cadifra.com>
parents: 11551
diff changeset
   102
  $ echo d > d/d/d
ee41be2bbf5a tests: unify test-issue*
Adrian Buehlmann <adrian@cadifra.com>
parents: 11551
diff changeset
   103
  $ hg commit -A -m "d is long directory"
ee41be2bbf5a tests: unify test-issue*
Adrian Buehlmann <adrian@cadifra.com>
parents: 11551
diff changeset
   104
  adding d/d/d
5487
7a64931e2d76 Fix file-changed-to-dir and dir-to-file commits (issue660).
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
   105
12195
ee41be2bbf5a tests: unify test-issue*
Adrian Buehlmann <adrian@cadifra.com>
parents: 11551
diff changeset
   106
  $ rm -r d
ee41be2bbf5a tests: unify test-issue*
Adrian Buehlmann <adrian@cadifra.com>
parents: 11551
diff changeset
   107
  $ echo d > d
ee41be2bbf5a tests: unify test-issue*
Adrian Buehlmann <adrian@cadifra.com>
parents: 11551
diff changeset
   108
ee41be2bbf5a tests: unify test-issue*
Adrian Buehlmann <adrian@cadifra.com>
parents: 11551
diff changeset
   109
Should fail - would corrupt dirstate:
ee41be2bbf5a tests: unify test-issue*
Adrian Buehlmann <adrian@cadifra.com>
parents: 11551
diff changeset
   110
ee41be2bbf5a tests: unify test-issue*
Adrian Buehlmann <adrian@cadifra.com>
parents: 11551
diff changeset
   111
  $ hg add d
ee41be2bbf5a tests: unify test-issue*
Adrian Buehlmann <adrian@cadifra.com>
parents: 11551
diff changeset
   112
  abort: directory 'd' already in dirstate
5487
7a64931e2d76 Fix file-changed-to-dir and dir-to-file commits (issue660).
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
   113
12195
ee41be2bbf5a tests: unify test-issue*
Adrian Buehlmann <adrian@cadifra.com>
parents: 11551
diff changeset
   114
Removing shadow:
ee41be2bbf5a tests: unify test-issue*
Adrian Buehlmann <adrian@cadifra.com>
parents: 11551
diff changeset
   115
ee41be2bbf5a tests: unify test-issue*
Adrian Buehlmann <adrian@cadifra.com>
parents: 11551
diff changeset
   116
  $ hg rm --after d/d/d
5487
7a64931e2d76 Fix file-changed-to-dir and dir-to-file commits (issue660).
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
   117
12195
ee41be2bbf5a tests: unify test-issue*
Adrian Buehlmann <adrian@cadifra.com>
parents: 11551
diff changeset
   118
Should succeed - shadow removed:
ee41be2bbf5a tests: unify test-issue*
Adrian Buehlmann <adrian@cadifra.com>
parents: 11551
diff changeset
   119
ee41be2bbf5a tests: unify test-issue*
Adrian Buehlmann <adrian@cadifra.com>
parents: 11551
diff changeset
   120
  $ hg add d
ee41be2bbf5a tests: unify test-issue*
Adrian Buehlmann <adrian@cadifra.com>
parents: 11551
diff changeset
   121
  $ hg ci -md
5487
7a64931e2d76 Fix file-changed-to-dir and dir-to-file commits (issue660).
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
   122
12195
ee41be2bbf5a tests: unify test-issue*
Adrian Buehlmann <adrian@cadifra.com>
parents: 11551
diff changeset
   123
Update should work at least with clean working directory:
5487
7a64931e2d76 Fix file-changed-to-dir and dir-to-file commits (issue660).
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
   124
12195
ee41be2bbf5a tests: unify test-issue*
Adrian Buehlmann <adrian@cadifra.com>
parents: 11551
diff changeset
   125
  $ rm -r a b d
ee41be2bbf5a tests: unify test-issue*
Adrian Buehlmann <adrian@cadifra.com>
parents: 11551
diff changeset
   126
  $ hg up -r 0
ee41be2bbf5a tests: unify test-issue*
Adrian Buehlmann <adrian@cadifra.com>
parents: 11551
diff changeset
   127
  2 files updated, 0 files merged, 0 files removed, 0 files unresolved
5516
f252ba975925 Fix dir-changed-to-file updates on clean workdir.
Maxim Dounin <mdounin@mdounin.ru>
parents: 5487
diff changeset
   128
12195
ee41be2bbf5a tests: unify test-issue*
Adrian Buehlmann <adrian@cadifra.com>
parents: 11551
diff changeset
   129
  $ hg st --all
ee41be2bbf5a tests: unify test-issue*
Adrian Buehlmann <adrian@cadifra.com>
parents: 11551
diff changeset
   130
  C a
ee41be2bbf5a tests: unify test-issue*
Adrian Buehlmann <adrian@cadifra.com>
parents: 11551
diff changeset
   131
  C b/b
5487
7a64931e2d76 Fix file-changed-to-dir and dir-to-file commits (issue660).
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
   132
12195
ee41be2bbf5a tests: unify test-issue*
Adrian Buehlmann <adrian@cadifra.com>
parents: 11551
diff changeset
   133
  $ rm -r a b
ee41be2bbf5a tests: unify test-issue*
Adrian Buehlmann <adrian@cadifra.com>
parents: 11551
diff changeset
   134
  $ hg up -r 1
ee41be2bbf5a tests: unify test-issue*
Adrian Buehlmann <adrian@cadifra.com>
parents: 11551
diff changeset
   135
  2 files updated, 0 files merged, 0 files removed, 0 files unresolved
ee41be2bbf5a tests: unify test-issue*
Adrian Buehlmann <adrian@cadifra.com>
parents: 11551
diff changeset
   136
ee41be2bbf5a tests: unify test-issue*
Adrian Buehlmann <adrian@cadifra.com>
parents: 11551
diff changeset
   137
  $ hg st --all
ee41be2bbf5a tests: unify test-issue*
Adrian Buehlmann <adrian@cadifra.com>
parents: 11551
diff changeset
   138
  C a/a
ee41be2bbf5a tests: unify test-issue*
Adrian Buehlmann <adrian@cadifra.com>
parents: 11551
diff changeset
   139
  C b
ee41be2bbf5a tests: unify test-issue*
Adrian Buehlmann <adrian@cadifra.com>
parents: 11551
diff changeset
   140