diff mercurial/filemerge.py @ 46430:0c95b59a89f1

resolve: also detect new :mergediff conflict markers The conflict markers created by `:mergediff` were not detected as conflicts, which affects both `commands.resolve.mark-check` and `mergetools.<tool>.check`. This patch fixes that. The new regex it uses for finding conflict markers is less restrictive because it `:mergediff` doesn't follow the `<<<<<<<` and `>>>>>>>` lines by a space (and a description). Hopefully lines like that don't give too many false positives. We can add back the space and make `:mergediff` add trailing spaces if it turns out to be a problem. OTOH, there will always be some false positives and we have ways of overriding the checks already. This patch can go onto the default or stable branch, depending on how much we care about an experimental feature. Differential Revision: https://phab.mercurial-scm.org/D9835
author Martin von Zweigbergk <martinvonz@google.com>
date Tue, 19 Jan 2021 14:00:42 -0800
parents 3ca5ca380a34
children 63dfaca9087f
line wrap: on
line diff
--- a/mercurial/filemerge.py	Mon Jan 18 22:32:09 2021 -0800
+++ b/mercurial/filemerge.py	Tue Jan 19 14:00:42 2021 -0800
@@ -1195,7 +1195,11 @@
 
 def hasconflictmarkers(data):
     return bool(
-        re.search(b"^(<<<<<<< .*|=======|>>>>>>> .*)$", data, re.MULTILINE)
+        re.search(
+            br"^(<<<<<<<.*|=======.*|------- .*|\+\+\+\+\+\+\+ .*|>>>>>>>.*)$",
+            data,
+            re.MULTILINE,
+        )
     )