| 1 |
#require icasefs |
| 2 |
|
| 3 |
################################ |
| 4 |
test for branch merging |
| 5 |
################################ |
| 6 |
|
| 7 |
test for rename awareness of case-folding collision check: |
| 8 |
|
| 9 |
(1) colliding file is one renamed from collided file: |
| 10 |
this is also case for issue3370. |
| 11 |
|
| 12 |
$ hg init branch_merge_renaming |
| 13 |
$ cd branch_merge_renaming |
| 14 |
|
| 15 |
$ echo a > a |
| 16 |
$ hg add a |
| 17 |
$ echo b > b |
| 18 |
$ hg add b |
| 19 |
$ hg commit -m '#0' |
| 20 |
$ hg tag -l A |
| 21 |
$ hg rename a tmp |
| 22 |
$ hg rename tmp A |
| 23 |
$ hg commit -m '#1' |
| 24 |
$ hg tag -l B |
| 25 |
$ hg update -q 0 |
| 26 |
$ touch x |
| 27 |
$ hg add x |
| 28 |
$ hg commit -m '#2' |
| 29 |
created new head |
| 30 |
$ hg tag -l C |
| 31 |
|
| 32 |
$ hg merge -q |
| 33 |
$ hg status -A |
| 34 |
M A |
| 35 |
R a |
| 36 |
C b |
| 37 |
C x |
| 38 |
|
| 39 |
$ hg update -q --clean 1 |
| 40 |
$ hg merge -q |
| 41 |
$ hg status -A |
| 42 |
M x |
| 43 |
C A |
| 44 |
C b |
| 45 |
$ hg commit -m '(D)' |
| 46 |
$ hg tag -l D |
| 47 |
|
| 48 |
additional test for issue3452: |
| 49 |
|
| 50 |
| this assumes the history below. |
| 51 |
| |
| 52 |
| (A) -- (C) -- (E) ------- |
| 53 |
| \ \ \ |
| 54 |
| \ \ \ |
| 55 |
| (B) -- (D) -- (F) -- (G) |
| 56 |
| |
| 57 |
| A: add file 'a' |
| 58 |
| B: rename from 'a' to 'A' |
| 59 |
| C: add 'x' (or operation other than modification of 'a') |
| 60 |
| D: merge C into B |
| 61 |
| E: modify 'a' |
| 62 |
| F: modify 'A' |
| 63 |
| G: merge E into F |
| 64 |
| |
| 65 |
| issue3452 occurs when (B) is recorded before (C) |
| 66 |
|
| 67 |
$ hg update -q --clean C |
| 68 |
$ echo "modify 'a' at (E)" > a |
| 69 |
$ echo "modify 'b' at (E)" > b |
| 70 |
$ hg commit -m '(E)' |
| 71 |
created new head |
| 72 |
$ hg tag -l E |
| 73 |
|
| 74 |
$ hg update -q --clean D |
| 75 |
$ echo "modify 'A' at (F)" > A |
| 76 |
$ hg commit -m '(F)' |
| 77 |
$ hg tag -l F |
| 78 |
|
| 79 |
$ hg merge -q --tool internal:other E |
| 80 |
$ hg status -A |
| 81 |
M A |
| 82 |
a |
| 83 |
M b |
| 84 |
C x |
| 85 |
$ cat A |
| 86 |
modify 'a' at (E) |
| 87 |
|
| 88 |
test also the case that (B) is recorded after (C), to prevent |
| 89 |
regression by changes in the future. |
| 90 |
|
| 91 |
to avoid unexpected (successful) behavior by filelog unification, |
| 92 |
target file is not 'a'/'A' but 'b'/'B' in this case. |
| 93 |
|
| 94 |
$ hg update -q --clean A |
| 95 |
$ hg rename b tmp |
| 96 |
$ hg rename tmp B |
| 97 |
$ hg commit -m '(B1)' |
| 98 |
created new head |
| 99 |
$ hg tag -l B1 |
| 100 |
|
| 101 |
$ hg merge -q C |
| 102 |
$ hg status -A |
| 103 |
M x |
| 104 |
C B |
| 105 |
C a |
| 106 |
$ hg commit -m '(D1)' |
| 107 |
$ hg tag -l D1 |
| 108 |
|
| 109 |
$ echo "modify 'B' at (F1)" > B |
| 110 |
$ hg commit -m '(F1)' |
| 111 |
$ hg tag -l F1 |
| 112 |
|
| 113 |
$ hg merge -q --tool internal:other E |
| 114 |
$ hg status -A |
| 115 |
M B |
| 116 |
b |
| 117 |
M a |
| 118 |
C x |
| 119 |
$ cat B |
| 120 |
modify 'b' at (E) |
| 121 |
|
| 122 |
$ cd .. |
| 123 |
|
| 124 |
(2) colliding file is not related to collided file |
| 125 |
|
| 126 |
$ hg init branch_merge_collding |
| 127 |
$ cd branch_merge_collding |
| 128 |
|
| 129 |
$ echo a > a |
| 130 |
$ hg add a |
| 131 |
$ hg commit -m '#0' |
| 132 |
$ hg remove a |
| 133 |
$ hg commit -m '#1' |
| 134 |
$ echo A > A |
| 135 |
$ hg add A |
| 136 |
$ hg commit -m '#2' |
| 137 |
$ hg update --clean 0 |
| 138 |
1 files updated, 0 files merged, 1 files removed, 0 files unresolved |
| 139 |
$ echo x > x |
| 140 |
$ hg add x |
| 141 |
$ hg commit -m '#3' |
| 142 |
created new head |
| 143 |
$ echo 'modified at #4' > a |
| 144 |
$ hg commit -m '#4' |
| 145 |
|
| 146 |
$ hg merge |
| 147 |
abort: case-folding collision between [aA] and [Aa] (re) |
| 148 |
[20] |
| 149 |
$ hg parents --template '{rev}\n' |
| 150 |
4 |
| 151 |
$ hg status -A |
| 152 |
C a |
| 153 |
C x |
| 154 |
$ cat a |
| 155 |
modified at #4 |
| 156 |
|
| 157 |
$ hg update --clean 2 |
| 158 |
1 files updated, 0 files merged, 2 files removed, 0 files unresolved |
| 159 |
$ hg merge |
| 160 |
abort: case-folding collision between [aA] and [Aa] (re) |
| 161 |
[20] |
| 162 |
$ hg parents --template '{rev}\n' |
| 163 |
2 |
| 164 |
$ hg status -A |
| 165 |
C A |
| 166 |
$ cat A |
| 167 |
A |
| 168 |
|
| 169 |
test for deletion awareness of case-folding collision check (issue3648): |
| 170 |
revision '#3' doesn't change 'a', so 'a' should be recognized as |
| 171 |
safely removed in merging between #2 and #3. |
| 172 |
|
| 173 |
$ hg update --clean 3 |
| 174 |
2 files updated, 0 files merged, 1 files removed, 0 files unresolved |
| 175 |
$ hg merge 2 |
| 176 |
1 files updated, 0 files merged, 1 files removed, 0 files unresolved |
| 177 |
(branch merge, don't forget to commit) |
| 178 |
$ hg status -A |
| 179 |
M A |
| 180 |
R a |
| 181 |
C x |
| 182 |
|
| 183 |
$ hg update --clean 2 |
| 184 |
1 files updated, 0 files merged, 1 files removed, 0 files unresolved |
| 185 |
$ hg merge 3 |
| 186 |
1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
| 187 |
(branch merge, don't forget to commit) |
| 188 |
$ hg status -A |
| 189 |
M x |
| 190 |
C A |
| 191 |
|
| 192 |
$ cd .. |
| 193 |
|
| 194 |
Prepare for tests of directory case-folding collisions |
| 195 |
|
| 196 |
$ hg init directory-casing |
| 197 |
$ cd directory-casing |
| 198 |
$ touch 0 # test: file without directory |
| 199 |
$ mkdir 0a |
| 200 |
$ touch 0a/f |
| 201 |
$ mkdir aA |
| 202 |
$ touch aA/a |
| 203 |
$ hg ci -Aqm0 |
| 204 |
|
| 205 |
Directory/file case-folding collision: |
| 206 |
|
| 207 |
$ hg up -q null |
| 208 |
$ touch 00 # test: starts as '0' |
| 209 |
$ mkdir 000 # test: starts as '0' |
| 210 |
$ touch 000/f |
| 211 |
$ touch Aa # test: collision with 'aA/a' |
| 212 |
$ hg ci -Aqm1 |
| 213 |
|
| 214 |
$ hg merge 0 |
| 215 |
abort: case-folding collision between Aa and directory of aA/a |
| 216 |
[20] |
| 217 |
(note: no collision between 0 and 00 or 000/f) |
| 218 |
|
| 219 |
Directory case-folding collision: |
| 220 |
|
| 221 |
$ hg up -qC null |
| 222 |
$ hg --config extensions.purge= purge |
| 223 |
$ mkdir 0A0 |
| 224 |
$ touch 0A0/f # test: starts as '0a' |
| 225 |
$ mkdir Aa |
| 226 |
$ touch Aa/b # test: collision with 'aA/a' |
| 227 |
$ hg ci -Aqm2 |
| 228 |
|
| 229 |
$ hg merge 0 |
| 230 |
3 files updated, 0 files merged, 0 files removed, 0 files unresolved |
| 231 |
(branch merge, don't forget to commit) |
| 232 |
|
| 233 |
$ cd .. |
| 234 |
|
| 235 |
################################ |
| 236 |
test for linear updates |
| 237 |
################################ |
| 238 |
|
| 239 |
test for rename awareness of case-folding collision check: |
| 240 |
|
| 241 |
(1) colliding file is one renamed from collided file |
| 242 |
|
| 243 |
$ hg init linearupdate_renameaware_1 |
| 244 |
$ cd linearupdate_renameaware_1 |
| 245 |
|
| 246 |
$ echo a > a |
| 247 |
$ hg add a |
| 248 |
$ hg commit -m '#0' |
| 249 |
$ hg rename a tmp |
| 250 |
$ hg rename tmp A |
| 251 |
$ hg commit -m '#1' |
| 252 |
|
| 253 |
$ hg update 0 |
| 254 |
1 files updated, 0 files merged, 1 files removed, 0 files unresolved |
| 255 |
|
| 256 |
$ echo 'this is added line' >> a |
| 257 |
$ hg update 1 |
| 258 |
merging a and A to A |
| 259 |
0 files updated, 1 files merged, 0 files removed, 0 files unresolved |
| 260 |
$ hg status -A |
| 261 |
M A |
| 262 |
$ cat A |
| 263 |
a |
| 264 |
this is added line |
| 265 |
|
| 266 |
$ cd .. |
| 267 |
|
| 268 |
(2) colliding file is not related to collided file |
| 269 |
|
| 270 |
$ hg init linearupdate_renameaware_2 |
| 271 |
$ cd linearupdate_renameaware_2 |
| 272 |
|
| 273 |
$ echo a > a |
| 274 |
$ hg add a |
| 275 |
$ hg commit -m '#0' |
| 276 |
$ hg remove a |
| 277 |
$ hg commit -m '#1' |
| 278 |
$ echo A > A |
| 279 |
$ hg add A |
| 280 |
$ hg commit -m '#2' |
| 281 |
|
| 282 |
$ hg update 0 |
| 283 |
1 files updated, 0 files merged, 1 files removed, 0 files unresolved |
| 284 |
$ hg parents --template '{rev}\n' |
| 285 |
0 |
| 286 |
$ hg status -A |
| 287 |
C a |
| 288 |
$ cat A |
| 289 |
a |
| 290 |
$ hg up -qC 2 |
| 291 |
|
| 292 |
$ hg update --check 0 |
| 293 |
1 files updated, 0 files merged, 1 files removed, 0 files unresolved |
| 294 |
$ hg parents --template '{rev}\n' |
| 295 |
0 |
| 296 |
$ hg status -A |
| 297 |
C a |
| 298 |
$ cat a |
| 299 |
a |
| 300 |
|
| 301 |
$ hg update --clean 2 |
| 302 |
1 files updated, 0 files merged, 1 files removed, 0 files unresolved |
| 303 |
$ hg parents --template '{rev}\n' |
| 304 |
2 |
| 305 |
$ hg status -A |
| 306 |
C A |
| 307 |
$ cat A |
| 308 |
A |
| 309 |
|
| 310 |
$ cd .. |
| 311 |
|
| 312 |
(3) colliding file is not related to collided file: added in working dir |
| 313 |
|
| 314 |
$ hg init linearupdate_renameaware_3 |
| 315 |
$ cd linearupdate_renameaware_3 |
| 316 |
|
| 317 |
$ echo a > a |
| 318 |
$ hg add a |
| 319 |
$ hg commit -m '#0' |
| 320 |
$ hg rename a b |
| 321 |
$ hg commit -m '#1' |
| 322 |
$ hg update 0 |
| 323 |
1 files updated, 0 files merged, 1 files removed, 0 files unresolved |
| 324 |
|
| 325 |
$ echo B > B |
| 326 |
$ hg add B |
| 327 |
$ hg status |
| 328 |
A B |
| 329 |
$ hg update |
| 330 |
abort: case-folding collision between [bB] and [Bb] (re) |
| 331 |
[20] |
| 332 |
|
| 333 |
$ hg update --check |
| 334 |
abort: uncommitted changes |
| 335 |
[20] |
| 336 |
|
| 337 |
$ hg update --clean |
| 338 |
1 files updated, 0 files merged, 1 files removed, 0 files unresolved |
| 339 |
$ hg parents --template '{rev}\n' |
| 340 |
1 |
| 341 |
$ hg status -A |
| 342 |
C b |
| 343 |
$ cat b |
| 344 |
a |
| 345 |
|
| 346 |
$ cd .. |