Mercurial > hg
changeset 26899:5f88e092f82c
resolve: don't abort when file is missing
A file being missing is a completely valid situation in which the user may want
to re-resolve merge conflicts. Mercurial already maintains backups of local
data, so this turns out to be easy to handle.
author | Siddharth Agarwal <sid0@fb.com> |
---|---|
date | Tue, 10 Nov 2015 17:16:59 -0800 |
parents | 33eb8a56d0c9 |
children | d1c741644d25 |
files | mercurial/commands.py tests/test-merge-tools.t |
diffstat | 2 files changed, 37 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/commands.py Tue Nov 10 17:13:16 2015 -0800 +++ b/mercurial/commands.py Tue Nov 10 17:16:59 2015 -0800 @@ -5655,7 +5655,11 @@ else: # backup pre-resolve (merge uses .orig for its own purposes) a = repo.wjoin(f) - util.copyfile(a, a + ".resolve") + try: + util.copyfile(a, a + ".resolve") + except (IOError, OSError) as inst: + if inst.errno != errno.ENOENT: + raise try: # preresolve file @@ -5673,7 +5677,11 @@ # replace filemerge's .orig file with our resolve file # for files in tocomplete, ms.resolve will not overwrite # .orig -- only preresolve does - util.rename(a + ".resolve", a + ".orig") + try: + util.rename(a + ".resolve", a + ".orig") + except OSError as inst: + if inst.errno != errno.ENOENT: + raise for f in tocomplete: try:
--- a/tests/test-merge-tools.t Tue Nov 10 17:13:16 2015 -0800 +++ b/tests/test-merge-tools.t Tue Nov 10 17:16:59 2015 -0800 @@ -579,6 +579,33 @@ ? f.orig # hg resolve --list U f + $ rm f + $ hg resolve --all --config ui.merge=internal:prompt --config ui.interactive=true + no tool found to merge f + keep (l)ocal or take (o)ther? + [1] + $ aftermerge + # cat f + revision 1 + space + # hg stat + M f + # hg resolve --list + U f + $ hg resolve --all --config ui.merge=internal:prompt + no tool found to merge f + keep (l)ocal or take (o)ther? l + (no more unresolved files) + $ aftermerge + # cat f + revision 1 + space + # hg stat + M f + ? f.orig + # hg resolve --list + R f + ui.merge specifies internal:dump: $ beforemerge