diff mercurial/mergestate.py @ 48760:93d6f0e7ba2f

filemerge: move check for identical sides out of filemerge() `filemerge.filemerge()` returns `None` if no merge was necessary because the two sides were identical. I don't think it should be that function's responsibility to handle that case; we should ideally not even call `filemerge.filemerge()` if the two inputs identical. This patch therefore moves the check out to the caller (`mergestate.py`). The largefiles test changed because we now notice that the two sides made the same change, so we don't consider it a merge. Also note that the new message better matches the line above it in the test output. Differential Revision: https://phab.mercurial-scm.org/D12154
author Martin von Zweigbergk <martinvonz@google.com>
date Mon, 07 Feb 2022 22:54:38 -0800
parents d169e651066b
children 6000f5b25c9b
line wrap: on
line diff
--- a/mercurial/mergestate.py	Mon Feb 07 20:12:09 2022 -0800
+++ b/mercurial/mergestate.py	Mon Feb 07 22:54:38 2022 -0800
@@ -421,6 +421,14 @@
             self._restore_backup(wctx[dfile], localkey, flags)
         else:
             wctx[dfile].remove(ignoremissing=True)
+
+        if not fco.cmp(fcd):  # files identical?
+            # If return value of merge is None, then there are no real conflict
+            del self._state[dfile]
+            self._results[dfile] = None, None
+            self._dirty = True
+            return None
+
         merge_ret, deleted = filemerge.filemerge(
             self._repo,
             wctx,
@@ -431,12 +439,6 @@
             fca,
             labels=self._labels,
         )
-        if merge_ret is None:
-            # If return value of merge is None, then there are no real conflict
-            del self._state[dfile]
-            self._results[dfile] = None, None
-            self._dirty = True
-            return None
 
         if not merge_ret:
             self.mark(dfile, MERGE_RECORD_RESOLVED)