This instance will be upgraded to Heptapod 0.21.0rc2 on 2021-04-16 at 14:00 UTC+2 (a few minutes of down time)

test-resolve.t 21.2 KB
Newer Older
Nicolas Dumazet's avatar
Nicolas Dumazet committed
1 2 3 4 5
test that a commit clears the merge state.

  $ hg init repo
  $ cd repo

6 7 8 9 10
  $ echo foo > file1
  $ echo foo > file2
  $ hg commit -Am 'add files'
  adding file1
  adding file2
Nicolas Dumazet's avatar
Nicolas Dumazet committed
11

12 13 14
  $ echo bar >> file1
  $ echo bar >> file2
  $ hg commit -Am 'append bar to files'
Nicolas Dumazet's avatar
Nicolas Dumazet committed
15

16
create a second head with conflicting edits
Nicolas Dumazet's avatar
Nicolas Dumazet committed
17 18

  $ hg up -C 0
19 20 21 22
  2 files updated, 0 files merged, 0 files removed, 0 files unresolved
  $ echo baz >> file1
  $ echo baz >> file2
  $ hg commit -Am 'append baz to files'
Nicolas Dumazet's avatar
Nicolas Dumazet committed
23 24
  created new head

25 26 27 28 29 30 31
create a third head with no conflicting edits
  $ hg up -qC 0
  $ echo foo > file3
  $ hg commit -Am 'add non-conflicting file'
  adding file3
  created new head

Nicolas Dumazet's avatar
Nicolas Dumazet committed
32 33
failing merge

34 35
  $ hg up -qC 2
  $ hg merge --tool=internal:fail 1
36
  0 files updated, 0 files merged, 0 files removed, 2 files unresolved
37
  use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon
38
  [1]
Nicolas Dumazet's avatar
Nicolas Dumazet committed
39

40
resolve -l should contain unresolved entries
Gregory Szorc's avatar
Gregory Szorc committed
41 42

  $ hg resolve -l
43 44
  U file1
  U file2
Gregory Szorc's avatar
Gregory Szorc committed
45

46 47 48 49
  $ hg resolve -l --no-status
  file1
  file2

50
resolving an unknown path should emit a warning, but not for -l
51

52
  $ hg resolve -m does-not-exist
53
  arguments do not match paths that need resolving
54
  $ hg resolve -l does-not-exist
55

56 57 58 59 60 61 62 63 64 65 66 67 68 69
tell users how they could have used resolve

  $ mkdir nested
  $ cd nested
  $ hg resolve -m file1
  arguments do not match paths that need resolving
  (try: hg resolve -m path:file1)
  $ hg resolve -m file1 filez
  arguments do not match paths that need resolving
  (try: hg resolve -m path:file1 path:filez)
  $ hg resolve -m path:file1 path:filez
  $ hg resolve -l
  R file1
  U file2
70 71 72
  $ hg resolve -l --config ui.relative-paths=yes
  R ../file1
  U ../file2
73 74 75
  $ hg resolve --re-merge filez file2
  arguments do not match paths that need resolving
  (try: hg resolve --re-merge path:filez path:file2)
76 77 78 79 80 81 82 83 84 85 86 87 88 89
  $ hg resolve -m filez file2
  arguments do not match paths that need resolving
  (try: hg resolve -m path:filez path:file2)
  $ hg resolve -m path:filez path:file2
  (no more unresolved files)
  $ hg resolve -l
  R file1
  R file2

cleanup
  $ hg resolve -u
  $ cd ..
  $ rmdir nested

Gregory Szorc's avatar
Gregory Szorc committed
90 91
resolve the failure

92 93 94 95 96 97 98 99 100
  $ echo resolved > file1
  $ hg resolve -m file1

resolve -l should show resolved file as resolved

  $ hg resolve -l
  R file1
  U file2

101 102 103
  $ hg resolve -l -Tjson
  [
   {
104 105
    "mergestatus": "R",
    "path": "file1"
106 107
   },
   {
108 109
    "mergestatus": "U",
    "path": "file2"
110 111 112
   }
  ]

113 114 115
  $ hg resolve -l -T '{path} {mergestatus} {status} {p1rev} {p2rev}\n'
  file1 R M 2 1
  file2 U M 2 1
116

117 118 119
resolve -m without paths should mark all resolved

  $ hg resolve -m
120
  (no more unresolved files)
Nicolas Dumazet's avatar
Nicolas Dumazet committed
121 122
  $ hg commit -m 'resolved'

123
resolve -l should be empty after commit
Nicolas Dumazet's avatar
Nicolas Dumazet committed
124 125

  $ hg resolve -l
126

127 128 129 130
  $ hg resolve -l -Tjson
  [
  ]

131 132 133 134
resolve --all should abort when no merge in progress

  $ hg resolve --all
  abort: resolve command not applicable when not merging
135
  [20]
136

137 138
resolve -m should abort when no merge in progress

139
  $ hg resolve -m
140
  abort: resolve command not applicable when not merging
141
  [20]
Nicolas Dumazet's avatar
Nicolas Dumazet committed
142

143 144 145 146 147 148 149 150 151 152 153 154
can not update or merge when there are unresolved conflicts

  $ hg up -qC 0
  $ echo quux >> file1
  $ hg up 1
  merging file1
  warning: conflicts while merging file1! (edit, then use 'hg resolve --mark')
  1 files updated, 0 files merged, 0 files removed, 1 files unresolved
  use 'hg resolve' to retry unresolved file merges
  [1]
  $ hg up 0
  abort: outstanding merge conflicts
155
  (use 'hg resolve' to resolve)
156 157 158
  [255]
  $ hg merge 2
  abort: outstanding merge conflicts
159
  (use 'hg resolve' to resolve)
160 161 162
  [255]
  $ hg merge --force 2
  abort: outstanding merge conflicts
163
  (use 'hg resolve' to resolve)
164 165
  [255]

166 167 168 169 170 171 172
set up conflict-free merge

  $ hg up -qC 3
  $ hg merge 1
  2 files updated, 0 files merged, 0 files removed, 0 files unresolved
  (branch merge, don't forget to commit)

173
resolve --all should do nothing in merge without conflicts
174
  $ hg resolve --all
175
  (no more unresolved files)
176

177
resolve -m should do nothing in merge without conflicts
178 179

  $ hg resolve -m
180
  (no more unresolved files)
181

182 183 184 185 186
get back to conflicting state

  $ hg up -qC 2
  $ hg merge --tool=internal:fail 1
  0 files updated, 0 files merged, 0 files removed, 2 files unresolved
187
  use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon
188 189 190 191 192
  [1]

resolve without arguments should suggest --all
  $ hg resolve
  abort: no files or directories specified
193
  (use --all to re-merge all unresolved files)
194
  [10]
195 196

resolve --all should re-merge all unresolved files
197 198 199
  $ hg resolve --all
  merging file1
  merging file2
200
  warning: conflicts while merging file1! (edit, then use 'hg resolve --mark')
201
  warning: conflicts while merging file2! (edit, then use 'hg resolve --mark')
202
  [1]
203 204 205 206 207 208
  $ cat file1.orig
  foo
  baz
  $ cat file2.orig
  foo
  baz
209 210 211 212

.orig files should exists where specified
  $ hg resolve --all --verbose --config 'ui.origbackuppath=.hg/origbackups'
  merging file1
213
  creating directory: $TESTTMP/repo/.hg/origbackups
214 215 216 217 218
  merging file2
  warning: conflicts while merging file1! (edit, then use 'hg resolve --mark')
  warning: conflicts while merging file2! (edit, then use 'hg resolve --mark')
  [1]
  $ ls .hg/origbackups
219 220
  file1
  file2
221 222
  $ grep '<<<' file1 > /dev/null
  $ grep '<<<' file2 > /dev/null
223 224 225 226

resolve <file> should re-merge file
  $ echo resolved > file1
  $ hg resolve -q file1
227
  warning: conflicts while merging file1! (edit, then use 'hg resolve --mark')
228
  [1]
229
  $ grep '<<<' file1 > /dev/null
230

231 232
test .orig behavior with resolve

233
  $ hg resolve -q file1 --tool "sh -c 'f --dump \"$TESTTMP/repo/file1.orig\"'"
234
  $TESTTMP/repo/file1.orig:
235 236 237 238 239
  >>>
  foo
  baz
  <<<

240 241 242 243 244 245 246
resolve <file> should do nothing if 'file' was marked resolved
  $ echo resolved > file1
  $ hg resolve -m file1
  $ hg resolve -q file1
  $ cat file1
  resolved

247 248 249 250
insert unsupported advisory merge record

  $ hg --config extensions.fakemergerecord=$TESTDIR/fakemergerecord.py fakemergerecord -x
  $ hg debugmergestate
251 252 253 254
  local (working copy): 57653b9f834a4493f7240b0681efcb9ae7cab745
  other (merge rev): dc77451844e37f03f5c559e3b8529b2b48d381d1
  file: file1 (state "r")
    local path: file1 (hash 60b27f004e454aca81b0480209cce5081ec52390, flags "")
255 256
    ancestor path: file1 (node 2ed2a3912a0b24502043eae84ee4b279c18b90dd)
    other path: file1 (node 6f4310b00b9a147241b071a60c28a650827fb03d)
257 258 259
    extra: ancestorlinknode = 99726c03216e233810a2564cbc0adfe395007eac
  file: file2 (state "u")
    local path: file2 (hash cb99b709a1978bd205ab9dfd4c5aaa1fc91c7523, flags "")
260 261
    ancestor path: file2 (node 2ed2a3912a0b24502043eae84ee4b279c18b90dd)
    other path: file2 (node 6f4310b00b9a147241b071a60c28a650827fb03d)
262
    extra: ancestorlinknode = 99726c03216e233810a2564cbc0adfe395007eac
263 264 265 266
  $ hg resolve -l
  R file1
  U file2

267 268 269 270 271 272
test json output

  $ hg debugmergestate -T json
  [
   {
    "commits": [{"label": "working copy", "name": "local", "node": "57653b9f834a4493f7240b0681efcb9ae7cab745"}, {"label": "merge rev", "name": "other", "node": "dc77451844e37f03f5c559e3b8529b2b48d381d1"}],
273
    "extras": [],
274 275 276 277 278
    "files": [{"ancestor_node": "2ed2a3912a0b24502043eae84ee4b279c18b90dd", "ancestor_path": "file1", "extras": [{"key": "ancestorlinknode", "value": "99726c03216e233810a2564cbc0adfe395007eac"}], "local_flags": "", "local_key": "60b27f004e454aca81b0480209cce5081ec52390", "local_path": "file1", "other_node": "6f4310b00b9a147241b071a60c28a650827fb03d", "other_path": "file1", "path": "file1", "state": "r"}, {"ancestor_node": "2ed2a3912a0b24502043eae84ee4b279c18b90dd", "ancestor_path": "file2", "extras": [{"key": "ancestorlinknode", "value": "99726c03216e233810a2564cbc0adfe395007eac"}], "local_flags": "", "local_key": "cb99b709a1978bd205ab9dfd4c5aaa1fc91c7523", "local_path": "file2", "other_node": "6f4310b00b9a147241b071a60c28a650827fb03d", "other_path": "file2", "path": "file2", "state": "u"}]
   }
  ]


279 280 281 282
insert unsupported mandatory merge record

  $ hg --config extensions.fakemergerecord=$TESTDIR/fakemergerecord.py fakemergerecord -X
  $ hg debugmergestate
283 284 285
  abort: unsupported merge state records: X
  (see https://mercurial-scm.org/wiki/MergeStateRecords for more information)
  [255]
286 287 288 289 290 291 292 293 294
  $ hg resolve -l
  abort: unsupported merge state records: X
  (see https://mercurial-scm.org/wiki/MergeStateRecords for more information)
  [255]
  $ hg resolve -ma
  abort: unsupported merge state records: X
  (see https://mercurial-scm.org/wiki/MergeStateRecords for more information)
  [255]
  $ hg summary
295
  warning: merge state has unsupported record types: X
296 297 298 299 300 301 302 303 304 305
  parent: 2:57653b9f834a 
   append baz to files
  parent: 1:dc77451844e3 
   append bar to files
  branch: default
  commit: 2 modified, 2 unknown (merge)
  update: 2 new changesets (update)
  phases: 5 draft

update --clean shouldn't abort on unsupported records
Nicolas Dumazet's avatar
Nicolas Dumazet committed
306

307
  $ hg up -qC 1
308 309 310 311 312
  $ hg debugmergestate
  no merge state found

test crashed merge with empty mergestate

Nicolas Dumazet's avatar
Nicolas Dumazet committed
313 314 315
  $ mkdir .hg/merge
  $ touch .hg/merge/state

316
resolve -l should be empty
Nicolas Dumazet's avatar
Nicolas Dumazet committed
317 318

  $ hg resolve -l
kiilerix's avatar
kiilerix committed
319

320 321 322 323 324 325 326 327 328 329
resolve -m can be configured to look for remaining conflict markers
  $ hg up -qC 2
  $ hg merge -q --tool=internal:merge 1
  warning: conflicts while merging file1! (edit, then use 'hg resolve --mark')
  warning: conflicts while merging file2! (edit, then use 'hg resolve --mark')
  [1]
  $ hg resolve -l
  U file1
  U file2
  $ echo 'remove markers' > file1
330
  $ hg --config commands.resolve.mark-check=abort resolve -m
331 332 333 334
  warning: the following files still have conflict markers:
    file2
  abort: conflict markers detected
  (use --all to mark anyway)
335
  [20]
336 337 338 339
  $ hg resolve -l
  U file1
  U file2
Try with --all from the hint
340
  $ hg --config commands.resolve.mark-check=abort resolve -m --all
341 342 343 344 345 346
  warning: the following files still have conflict markers:
    file2
  (no more unresolved files)
  $ hg resolve -l
  R file1
  R file2
347
Test option value 'warn'
348 349 350 351
  $ hg resolve --unmark
  $ hg resolve -l
  U file1
  U file2
352
  $ hg --config commands.resolve.mark-check=warn resolve -m
353 354 355 356 357 358 359 360 361 362 363
  warning: the following files still have conflict markers:
    file2
  (no more unresolved files)
  $ hg resolve -l
  R file1
  R file2
If the file is already marked as resolved, we don't warn about it
  $ hg resolve --unmark file1
  $ hg resolve -l
  U file1
  R file2
364
  $ hg --config commands.resolve.mark-check=warn resolve -m
365 366
  (no more unresolved files)
  $ hg resolve -l
367 368 369 370 371 372 373 374 375 376 377 378
  R file1
  R file2
If the user passes an invalid value, we treat it as 'none'.
  $ hg resolve --unmark
  $ hg resolve -l
  U file1
  U file2
  $ hg --config commands.resolve.mark-check=nope resolve -m
  (no more unresolved files)
  $ hg resolve -l
  R file1
  R file2
379
Test explicitly setting the option to 'none'
380 381 382 383 384 385 386
  $ hg resolve --unmark
  $ hg resolve -l
  U file1
  U file2
  $ hg --config commands.resolve.mark-check=none resolve -m
  (no more unresolved files)
  $ hg resolve -l
387 388
  R file1
  R file2
389 390 391 392 393 394 395 396 397 398 399 400 401
Test with marking an explicit file as resolved, this should not abort (since
there's no --force flag, we have no way of combining --all with a filename)
  $ hg resolve --unmark
  $ hg resolve -l
  U file1
  U file2
(This downgrades to a warning since an explicit file was specified).
  $ hg --config commands.resolve.mark-check=abort resolve -m file2
  warning: the following files still have conflict markers:
    file2
  $ hg resolve -l
  U file1
  R file2
402 403 404 405 406 407
Testing the --re-merge flag
  $ hg resolve --unmark file1
  $ hg resolve -l
  U file1
  R file2
  $ hg resolve --mark --re-merge
408
  abort: too many actions specified
409
  [10]
410 411 412 413
  $ hg resolve --re-merge --all
  merging file1
  warning: conflicts while merging file1! (edit, then use 'hg resolve --mark')
  [1]
414 415 416 417 418
Explicit re-merge
  $ hg resolve --unmark file1
  $ hg resolve --config commands.resolve.explicit-re-merge=1 --all
  abort: no action specified
  (use --mark, --unmark, --list or --re-merge)
419
  [10]
420 421 422 423
  $ hg resolve --config commands.resolve.explicit-re-merge=1 --re-merge --all
  merging file1
  warning: conflicts while merging file1! (edit, then use 'hg resolve --mark')
  [1]
424

kiilerix's avatar
kiilerix committed
425
  $ cd ..
426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465

======================================================
Test 'hg resolve' confirm config option functionality |
======================================================
  $ cat >> $HGRCPATH << EOF
  > [extensions]
  > rebase=
  > EOF

  $ hg init repo2
  $ cd repo2

  $ echo boss > boss
  $ hg ci -Am "add boss"
  adding boss

  $ for emp in emp1 emp2 emp3; do echo work > $emp; done;
  $ hg ci -Aqm "added emp1 emp2 emp3"

  $ hg up 0
  0 files updated, 0 files merged, 3 files removed, 0 files unresolved

  $ for emp in emp1 emp2 emp3; do echo nowork > $emp; done;
  $ hg ci -Aqm "added lazy emp1 emp2 emp3"

  $ hg log -GT "{rev} {node|short} {firstline(desc)}\n"
  @  2 0acfd4a49af0 added lazy emp1 emp2 emp3
  |
  | o  1 f30f98a8181f added emp1 emp2 emp3
  |/
  o  0 88660038d466 add boss
  
  $ hg rebase -s 1 -d 2
  rebasing 1:f30f98a8181f "added emp1 emp2 emp3"
  merging emp1
  merging emp2
  merging emp3
  warning: conflicts while merging emp1! (edit, then use 'hg resolve --mark')
  warning: conflicts while merging emp2! (edit, then use 'hg resolve --mark')
  warning: conflicts while merging emp3! (edit, then use 'hg resolve --mark')
466
  unresolved conflicts (see 'hg resolve', then 'hg rebase --continue')
467
  [240]
468 469 470 471 472 473 474 475 476 477 478 479 480 481

Test when commands.resolve.confirm config option is not set:
===========================================================
  $ hg resolve --all
  merging emp1
  merging emp2
  merging emp3
  warning: conflicts while merging emp1! (edit, then use 'hg resolve --mark')
  warning: conflicts while merging emp2! (edit, then use 'hg resolve --mark')
  warning: conflicts while merging emp3! (edit, then use 'hg resolve --mark')
  [1]

Test when config option is set:
==============================
482
  $ cat >> .hg/hgrc << EOF
483 484 485 486 487 488 489 490 491
  > [ui]
  > interactive = True
  > [commands]
  > resolve.confirm = True
  > EOF

  $ hg resolve
  abort: no files or directories specified
  (use --all to re-merge all unresolved files)
492
  [10]
493 494 495 496 497
  $ hg resolve --all << EOF
  > n
  > EOF
  re-merge all unresolved files (yn)? n
  abort: user quit
498
  [250]
499 500 501 502 503 504 505 506 507 508 509 510 511

  $ hg resolve --all << EOF
  > y
  > EOF
  re-merge all unresolved files (yn)? y
  merging emp1
  merging emp2
  merging emp3
  warning: conflicts while merging emp1! (edit, then use 'hg resolve --mark')
  warning: conflicts while merging emp2! (edit, then use 'hg resolve --mark')
  warning: conflicts while merging emp3! (edit, then use 'hg resolve --mark')
  [1]

512 513 514 515 516 517 518 519 520 521 522 523 524 525
Test that commands.resolve.confirm respect --mark option (only when no patterns args are given):
===============================================================================================

  $ hg resolve -m emp1
  $ hg resolve -l
  R emp1
  U emp2
  U emp3

  $ hg resolve -m << EOF
  > n
  > EOF
  mark all unresolved files as resolved (yn)? n
  abort: user quit
526
  [250]
527 528 529 530 531 532 533 534 535 536 537 538

  $ hg resolve -m << EOF
  > y
  > EOF
  mark all unresolved files as resolved (yn)? y
  (no more unresolved files)
  continue: hg rebase --continue
  $ hg resolve -l
  R emp1
  R emp2
  R emp3

539
Test that commands.resolve.confirm respect --unmark option (only when no patterns args are given):
540
=================================================================================================
541 542 543 544 545 546 547 548 549 550 551 552 553

  $ hg resolve -u emp1

  $ hg resolve -l
  U emp1
  R emp2
  R emp3

  $ hg resolve -u << EOF
  > n
  > EOF
  mark all resolved files as unresolved (yn)? n
  abort: user quit
554
  [250]
555 556 557 558 559 560 561 562 563 564 565 566 567

  $ hg resolve -m << EOF
  > y
  > EOF
  mark all unresolved files as resolved (yn)? y
  (no more unresolved files)
  continue: hg rebase --continue

  $ hg resolve -l
  R emp1
  R emp2
  R emp3

568 569
  $ hg rebase --abort
  rebase aborted
570 571

Done with commands.resolve.confirm tests:
572
  $ cd ..
573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589

Test that commands.resolve.mark-check works even if there are deleted files:
  $ hg init resolve-deleted
  $ cd resolve-deleted
  $ echo r0 > file1
  $ hg ci -qAm r0
  $ echo r1 > file1
  $ hg ci -qm r1
  $ hg co -qr 0
  $ hg rm file1
  $ hg ci -qm "r2 (delete file1)"

(At this point we have r0 creating file1, and sibling commits r1 and r2, which
 modify and delete file1, respectively)

  $ hg merge -r 1
  file 'file1' was deleted in local [working copy] but was modified in other [merge rev].
590 591
  You can use (c)hanged version, leave (d)eleted, or leave (u)nresolved.
  What do you want to do? u
592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618
  0 files updated, 0 files merged, 0 files removed, 1 files unresolved
  use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon
  [1]
  $ hg resolve --list
  U file1
Because we left it as 'unresolved' the file should still exist.
  $ [ -f file1 ] || echo "File does not exist?"
BC behavior: `hg resolve --mark` accepts that the file is still there, and
doesn't have a problem with this situation.
  $ hg resolve --mark --config commands.resolve.mark-check=abort
  (no more unresolved files)
  $ hg resolve --list
  R file1
The file is still there:
  $ [ -f file1 ] || echo "File does not exist?"
Let's check mark-check=warn:
  $ hg resolve --unmark file1
  $ hg resolve --mark --config commands.resolve.mark-check=warn
  (no more unresolved files)
  $ hg resolve --list
  R file1
The file is still there:
  $ [ -f file1 ] || echo "File does not exist?"
Let's resolve the issue by deleting the file via `hg resolve`
  $ hg resolve --unmark file1
  $ echo 'd' | hg resolve file1 --config ui.interactive=1
  file 'file1' was deleted in local [working copy] but was modified in other [merge rev].
619 620
  You can use (c)hanged version, leave (d)eleted, or leave (u)nresolved.
  What do you want to do? d
621 622 623 624 625 626 627 628 629 630 631 632 633 634
  (no more unresolved files)
  $ hg resolve --list
  R file1
The file is deleted:
  $ [ -f file1 ] && echo "File still exists?" || true
Doing `hg resolve --mark` doesn't break now that the file is missing:
  $ hg resolve --mark --config commands.resolve.mark-check=abort
  (no more unresolved files)
  $ hg resolve --mark --config commands.resolve.mark-check=warn
  (no more unresolved files)
Resurrect the file, and delete it outside of hg:
  $ hg resolve --unmark file1
  $ hg resolve file1
  file 'file1' was deleted in local [working copy] but was modified in other [merge rev].
635 636
  You can use (c)hanged version, leave (d)eleted, or leave (u)nresolved.
  What do you want to do? u
637 638 639 640 641 642 643 644 645 646 647 648
  [1]
  $ [ -f file1 ] || echo "File does not exist?"
  $ hg resolve --list
  U file1
  $ rm file1
  $ hg resolve --mark --config commands.resolve.mark-check=abort
  (no more unresolved files)
  $ hg resolve --list
  R file1
  $ hg resolve --unmark file1
  $ hg resolve file1
  file 'file1' was deleted in local [working copy] but was modified in other [merge rev].
649 650
  You can use (c)hanged version, leave (d)eleted, or leave (u)nresolved.
  What do you want to do? u
651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666
  [1]
  $ [ -f file1 ] || echo "File does not exist?"
  $ hg resolve --list
  U file1
  $ rm file1
  $ hg resolve --mark --config commands.resolve.mark-check=warn
  (no more unresolved files)
  $ hg resolve --list
  R file1


For completeness, let's try that in the opposite direction (merging r2 into r1,
instead of r1 into r2):
  $ hg update -qCr 1
  $ hg merge -r 2
  file 'file1' was deleted in other [merge rev] but was modified in local [working copy].
667 668
  You can use (c)hanged version, (d)elete, or leave (u)nresolved.
  What do you want to do? u
669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695
  0 files updated, 0 files merged, 0 files removed, 1 files unresolved
  use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon
  [1]
  $ hg resolve --list
  U file1
Because we left it as 'unresolved' the file should still exist.
  $ [ -f file1 ] || echo "File does not exist?"
BC behavior: `hg resolve --mark` accepts that the file is still there, and
doesn't have a problem with this situation.
  $ hg resolve --mark --config commands.resolve.mark-check=abort
  (no more unresolved files)
  $ hg resolve --list
  R file1
The file is still there:
  $ [ -f file1 ] || echo "File does not exist?"
Let's check mark-check=warn:
  $ hg resolve --unmark file1
  $ hg resolve --mark --config commands.resolve.mark-check=warn
  (no more unresolved files)
  $ hg resolve --list
  R file1
The file is still there:
  $ [ -f file1 ] || echo "File does not exist?"
Let's resolve the issue by deleting the file via `hg resolve`
  $ hg resolve --unmark file1
  $ echo 'd' | hg resolve file1 --config ui.interactive=1
  file 'file1' was deleted in other [merge rev] but was modified in local [working copy].
696 697
  You can use (c)hanged version, (d)elete, or leave (u)nresolved.
  What do you want to do? d
698 699 700 701 702 703 704 705 706 707 708 709 710 711
  (no more unresolved files)
  $ hg resolve --list
  R file1
The file is deleted:
  $ [ -f file1 ] && echo "File still exists?" || true
Doing `hg resolve --mark` doesn't break now that the file is missing:
  $ hg resolve --mark --config commands.resolve.mark-check=abort
  (no more unresolved files)
  $ hg resolve --mark --config commands.resolve.mark-check=warn
  (no more unresolved files)
Resurrect the file, and delete it outside of hg:
  $ hg resolve --unmark file1
  $ hg resolve file1
  file 'file1' was deleted in other [merge rev] but was modified in local [working copy].
712 713
  You can use (c)hanged version, (d)elete, or leave (u)nresolved.
  What do you want to do? u
714 715 716 717 718 719 720 721 722 723 724 725
  [1]
  $ [ -f file1 ] || echo "File does not exist?"
  $ hg resolve --list
  U file1
  $ rm file1
  $ hg resolve --mark --config commands.resolve.mark-check=abort
  (no more unresolved files)
  $ hg resolve --list
  R file1
  $ hg resolve --unmark file1
  $ hg resolve file1
  file 'file1' was deleted in other [merge rev] but was modified in local [working copy].
726 727
  You can use (c)hanged version, (d)elete, or leave (u)nresolved.
  What do you want to do? u
728 729 730 731 732 733 734 735 736 737 738
  [1]
  $ [ -f file1 ] || echo "File does not exist?"
  $ hg resolve --list
  U file1
  $ rm file1
  $ hg resolve --mark --config commands.resolve.mark-check=warn
  (no more unresolved files)
  $ hg resolve --list
  R file1

  $ cd ..