Patchwork [1,of,5,changedelete] filemerge: also return a dirstate action for nomerge internal tools

login
register
mail settings
Submitter Siddharth Agarwal
Date Nov. 5, 2015, 8:11 a.m.
Message ID <5f0d32c189f5a9e190b4.1446711118@dev666.prn1.facebook.com>
Download mbox | patch
Permalink /patch/11296/
State Superseded
Headers show

Comments

Siddharth Agarwal - Nov. 5, 2015, 8:11 a.m.
# HG changeset patch
# User Siddharth Agarwal <sid0@fb.com>
# Date 1446705516 28800
#      Wed Nov 04 22:38:36 2015 -0800
# Node ID 5f0d32c189f5a9e190b40cb0966fa5fc836ae23f
# Parent  f9984f76fd90e439221425d751e29bae17bec995
filemerge: also return a dirstate action for nomerge internal tools

We're going to support the filemerge code resolving change/delete conflicts in
upcoming patches. Some of these resolutions require that the dirstate be
modified. Modifying the dirstate directly from in here would be (a) a pretty
bad layering violation and (b) wrong because all dirstate removals should
happen before adds. So in this and upcoming patches we're instead going to pass
the action to take up to merge.mergestate.

Patch

diff --git a/mercurial/filemerge.py b/mercurial/filemerge.py
--- a/mercurial/filemerge.py
+++ b/mercurial/filemerge.py
@@ -188,13 +188,13 @@  def _iprompt(repo, mynode, orig, fcd, fc
 @internaltool('local', nomerge)
 def _ilocal(repo, mynode, orig, fcd, fco, fca, toolconf):
     """Uses the local version of files as the merged version."""
-    return 0
+    return 0, None
 
 @internaltool('other', nomerge)
 def _iother(repo, mynode, orig, fcd, fco, fca, toolconf):
     """Uses the other version of files as the merged version."""
     repo.wwrite(fcd.path(), fco.data(), fco.flags())
-    return 0
+    return 0, None
 
 @internaltool('fail', nomerge)
 def _ifail(repo, mynode, orig, fcd, fco, fca, toolconf):
@@ -202,7 +202,7 @@  def _ifail(repo, mynode, orig, fcd, fco,
     Rather than attempting to merge files that were modified on both
     branches, it marks them as unresolved. The resolve command must be
     used to resolve these conflicts."""
-    return 1
+    return 1, None
 
 def _premerge(repo, toolconf, files, labels=None):
     tool, toolpath, binary, symlink = toolconf
@@ -491,7 +491,8 @@  def _filemerge(premerge, repo, mynode, o
     toolconf = tool, toolpath, binary, symlink
 
     if mergetype == nomerge:
-        return True, func(repo, mynode, orig, fcd, fco, fca, toolconf)
+        r, action = func(repo, mynode, orig, fcd, fco, fca, toolconf)
+        return True, r
 
     if premerge:
         if orig != fco.path():