changeset 27034:86ede9eda252

filemerge: return whether the file was deleted This is required for change/delete conflict resolution -- see previous patches for more details.
author Siddharth Agarwal <sid0@fb.com>
date Wed, 18 Nov 2015 14:22:52 -0800
parents 089dab8794dc
children de7bf242644e
files hgext/largefiles/overrides.py mercurial/filemerge.py mercurial/merge.py
diffstat 3 files changed, 14 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/largefiles/overrides.py	Wed Nov 18 13:55:31 2015 -0800
+++ b/hgext/largefiles/overrides.py	Wed Nov 18 14:22:52 2015 -0800
@@ -561,7 +561,7 @@
                (lfutil.splitstandin(orig), ahash, dhash, ohash),
              0) == 1)):
         repo.wwrite(fcd.path(), fco.data(), fco.flags())
-    return True, 0
+    return True, 0, False
 
 def copiespathcopies(orig, ctx1, ctx2, match=None):
     copies = orig(ctx1, ctx2, match=match)
--- a/mercurial/filemerge.py	Wed Nov 18 13:55:31 2015 -0800
+++ b/mercurial/filemerge.py	Wed Nov 18 14:22:52 2015 -0800
@@ -497,8 +497,8 @@
     fca = ancestor file context
     fcd = local file context for current/destination file
 
-    Returns whether the merge is complete, and the return value of the merge.
-    """
+    Returns whether the merge is complete, the return value of the merge, and
+    a boolean indicating whether the file was deleted from disk."""
 
     def temp(prefix, ctx):
         pre = "%s~%s." % (os.path.basename(ctx.path()), prefix)
@@ -510,7 +510,7 @@
         return name
 
     if not fco.cmp(fcd): # files identical?
-        return True, None
+        return True, None, False
 
     ui = repo.ui
     fd = fcd.path()
@@ -538,7 +538,7 @@
 
     if mergetype == nomerge:
         r, deleted = func(repo, mynode, orig, fcd, fco, fca, toolconf)
-        return True, r
+        return True, r, deleted
 
     if premerge:
         if orig != fco.path():
@@ -552,7 +552,7 @@
                                  toolconf):
         if onfailure:
             ui.warn(onfailure % fd)
-        return True, 1
+        return True, 1, False
 
     a = repo.wjoin(fd)
     b = temp("base", fca)
@@ -573,7 +573,7 @@
         if premerge and mergetype == fullmerge:
             r = _premerge(repo, toolconf, files, labels=labels)
             # complete if premerge successful (r is 0)
-            return not r, r
+            return not r, r, False
 
         needcheck, r, deleted = func(repo, mynode, orig, fcd, fco, fca,
                                      toolconf, files, labels=labels)
@@ -585,7 +585,7 @@
             if onfailure:
                 ui.warn(onfailure % fd)
 
-        return True, r
+        return True, r, deleted
     finally:
         if not r:
             util.unlink(back)
--- a/mercurial/merge.py	Wed Nov 18 13:55:31 2015 -0800
+++ b/mercurial/merge.py	Wed Nov 18 14:22:52 2015 -0800
@@ -432,11 +432,13 @@
             f = self._repo.vfs('merge/' + hash)
             self._repo.wwrite(dfile, f.read(), flags)
             f.close()
-            complete, r = filemerge.premerge(self._repo, self._local, lfile,
-                                             fcd, fco, fca, labels=labels)
+            complete, r, deleted = filemerge.premerge(self._repo, self._local,
+                                                      lfile, fcd, fco, fca,
+                                                      labels=labels)
         else:
-            complete, r = filemerge.filemerge(self._repo, self._local, lfile,
-                                              fcd, fco, fca, labels=labels)
+            complete, r, deleted = filemerge.filemerge(self._repo, self._local,
+                                                       lfile, fcd, fco, fca,
+                                                       labels=labels)
         if r is None:
             # no real conflict
             del self._state[dfile]