[Updated] D11391: filemerge: be more strict when detecting conflict markers, add `|` markers

spectral (Kyle Lippincott) phabricator at mercurial-scm.org
Thu Sep 9 09:13:30 UTC 2021


Closed by commit rHG053dd53a0b59: filemerge: be more strict when detecting conflict markers, add `|` markers (authored by spectral).
This revision was automatically updated to reflect the committed changes.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D11391?vs=30184&id=30187

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D11391/new/

REVISION DETAIL
  https://phab.mercurial-scm.org/D11391

AFFECTED FILES
  mercurial/filemerge.py

CHANGE DETAILS

diff --git a/mercurial/filemerge.py b/mercurial/filemerge.py
--- a/mercurial/filemerge.py
+++ b/mercurial/filemerge.py
@@ -1212,9 +1212,13 @@
 
 
 def hasconflictmarkers(data):
+    # Detect lines starting with a string of 7 identical characters from the
+    # subset Mercurial uses for conflict markers, followed by either the end of
+    # line or a space and some text. Note that using [<>=+|-]{7} would detect
+    # `<><><><><` as a conflict marker, which we don't want.
     return bool(
         re.search(
-            br"^(<<<<<<<.*|=======.*|------- .*|\+\+\+\+\+\+\+ .*|>>>>>>>.*)$",
+            br"^([<>=+|-])\1{6}( .*)$",
             data,
             re.MULTILINE,
         )



To: spectral, #hg-reviewers, Alphare, pulkit
Cc: pulkit, mercurial-patches
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mercurial-scm.org/pipermail/mercurial-patches/attachments/20210909/7933d21c/attachment-0002.html>


More information about the Mercurial-patches mailing list