diff 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
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: