test-resolve.t
169 lines
| 3.6 KiB
| text/troff
|
Tads3Lexer
/ tests / test-resolve.t
|
r12117 | test that a commit clears the merge state. | ||
$ hg init repo | ||||
$ cd repo | ||||
|
r23021 | $ echo foo > file1 | ||
$ echo foo > file2 | ||||
$ hg commit -Am 'add files' | ||||
adding file1 | ||||
adding file2 | ||||
|
r12117 | |||
|
r23021 | $ echo bar >> file1 | ||
$ echo bar >> file2 | ||||
$ hg commit -Am 'append bar to files' | ||||
|
r12117 | |||
|
r23022 | create a second head with conflicting edits | ||
|
r12117 | |||
$ hg up -C 0 | ||||
|
r23021 | 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' | ||||
|
r12117 | created new head | ||
|
r23022 | 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 | ||||
|
r12117 | failing merge | ||
|
r23022 | $ hg up -qC 2 | ||
$ hg merge --tool=internal:fail 1 | ||||
|
r23021 | 0 files updated, 0 files merged, 0 files removed, 2 files unresolved | ||
|
r12314 | use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon | ||
|
r12316 | [1] | ||
|
r12117 | |||
|
r23021 | resolve -l should contain unresolved entries | ||
|
r21263 | |||
$ hg resolve -l | ||||
|
r23021 | U file1 | ||
U file2 | ||||
|
r21263 | |||
|
r24127 | $ hg resolve -l --no-status | ||
file1 | ||||
file2 | ||||
|
r24125 | resolving an unknown path should emit a warning, but not for -l | ||
|
r23020 | |||
|
r21265 | $ hg resolve -m does-not-exist | ||
|
r21721 | arguments do not match paths that need resolving | ||
|
r24125 | $ hg resolve -l does-not-exist | ||
|
r21265 | |||
|
r21263 | resolve the failure | ||
|
r23021 | $ echo resolved > file1 | ||
$ hg resolve -m file1 | ||||
resolve -l should show resolved file as resolved | ||||
$ hg resolve -l | ||||
R file1 | ||||
U file2 | ||||
|
r24127 | $ hg resolve -l -Tjson | ||
[ | ||||
{ | ||||
"path": "file1", | ||||
"status": "R" | ||||
}, | ||||
{ | ||||
"path": "file2", | ||||
"status": "U" | ||||
} | ||||
] | ||||
|
r23021 | resolve -m without paths should mark all resolved | ||
$ hg resolve -m | ||||
|
r21947 | (no more unresolved files) | ||
|
r12117 | $ hg commit -m 'resolved' | ||
|
r23020 | resolve -l should be empty after commit | ||
|
r12117 | |||
$ hg resolve -l | ||||
|
r21541 | |||
|
r24127 | $ hg resolve -l -Tjson | ||
[ | ||||
] | ||||
|
r23022 | resolve --all should abort when no merge in progress | ||
$ hg resolve --all | ||||
abort: resolve command not applicable when not merging | ||||
[255] | ||||
|
r23020 | resolve -m should abort when no merge in progress | ||
|
r21541 | $ hg resolve -m | ||
|
r21264 | abort: resolve command not applicable when not merging | ||
[255] | ||||
|
r12117 | |||
|
r23022 | 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) | ||||
|
r23024 | resolve --all should do nothing in merge without conflicts | ||
|
r23022 | $ hg resolve --all | ||
|
r23024 | (no more unresolved files) | ||
|
r23022 | |||
|
r23024 | resolve -m should do nothing in merge without conflicts | ||
|
r23022 | |||
$ hg resolve -m | ||||
|
r23024 | (no more unresolved files) | ||
|
r23022 | |||
|
r23023 | 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 | ||||
use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon | ||||
[1] | ||||
resolve without arguments should suggest --all | ||||
$ hg resolve | ||||
abort: no files or directories specified | ||||
|
r26352 | (use --all to re-merge all unresolved files) | ||
|
r23023 | [255] | ||
resolve --all should re-merge all unresolved files | ||||
|
r26619 | $ hg resolve --all | ||
merging file1 | ||||
|
r26614 | warning: conflicts while merging file1! (edit, then use 'hg resolve --mark') | ||
|
r26619 | merging file2 | ||
|
r26614 | warning: conflicts while merging file2! (edit, then use 'hg resolve --mark') | ||
|
r23023 | [1] | ||
|
r23025 | $ grep '<<<' file1 > /dev/null | ||
$ grep '<<<' file2 > /dev/null | ||||
|
r23023 | |||
resolve <file> should re-merge file | ||||
$ echo resolved > file1 | ||||
$ hg resolve -q file1 | ||||
|
r26614 | warning: conflicts while merging file1! (edit, then use 'hg resolve --mark') | ||
|
r23023 | [1] | ||
|
r23025 | $ grep '<<<' file1 > /dev/null | ||
|
r23023 | |||
resolve <file> should do nothing if 'file' was marked resolved | ||||
$ echo resolved > file1 | ||||
$ hg resolve -m file1 | ||||
$ hg resolve -q file1 | ||||
$ cat file1 | ||||
resolved | ||||
|
r12117 | test crashed merge with empty mergestate | ||
|
r23022 | $ hg up -qC 1 | ||
|
r12117 | $ mkdir .hg/merge | ||
$ touch .hg/merge/state | ||||
|
r23020 | resolve -l should be empty | ||
|
r12117 | |||
$ hg resolve -l | ||||
|
r16913 | |||
$ cd .. | ||||