Mercurial > public > mercurial-scm > hg
comparison mercurial/commands.py @ 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 | 853154f27525 |
children | 50d2389a2e49 |
comparison
equal
deleted
inserted
replaced
26898:33eb8a56d0c9 | 26899:5f88e092f82c |
---|---|
5653 elif unmark: | 5653 elif unmark: |
5654 ms.mark(f, "u") | 5654 ms.mark(f, "u") |
5655 else: | 5655 else: |
5656 # backup pre-resolve (merge uses .orig for its own purposes) | 5656 # backup pre-resolve (merge uses .orig for its own purposes) |
5657 a = repo.wjoin(f) | 5657 a = repo.wjoin(f) |
5658 util.copyfile(a, a + ".resolve") | 5658 try: |
5659 util.copyfile(a, a + ".resolve") | |
5660 except (IOError, OSError) as inst: | |
5661 if inst.errno != errno.ENOENT: | |
5662 raise | |
5659 | 5663 |
5660 try: | 5664 try: |
5661 # preresolve file | 5665 # preresolve file |
5662 ui.setconfig('ui', 'forcemerge', opts.get('tool', ''), | 5666 ui.setconfig('ui', 'forcemerge', opts.get('tool', ''), |
5663 'resolve') | 5667 'resolve') |
5671 ms.commit() | 5675 ms.commit() |
5672 | 5676 |
5673 # replace filemerge's .orig file with our resolve file | 5677 # replace filemerge's .orig file with our resolve file |
5674 # for files in tocomplete, ms.resolve will not overwrite | 5678 # for files in tocomplete, ms.resolve will not overwrite |
5675 # .orig -- only preresolve does | 5679 # .orig -- only preresolve does |
5676 util.rename(a + ".resolve", a + ".orig") | 5680 try: |
5681 util.rename(a + ".resolve", a + ".orig") | |
5682 except OSError as inst: | |
5683 if inst.errno != errno.ENOENT: | |
5684 raise | |
5677 | 5685 |
5678 for f in tocomplete: | 5686 for f in tocomplete: |
5679 try: | 5687 try: |
5680 # resolve file | 5688 # resolve file |
5681 ui.setconfig('ui', 'forcemerge', opts.get('tool', ''), | 5689 ui.setconfig('ui', 'forcemerge', opts.get('tool', ''), |