comparison mercurial/filemerge.py @ 46356: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
comparison
equal deleted inserted replaced
46355:98e3a693061a 46356:0c95b59a89f1
1193 # default action is 'continue', in which case we neither prompt nor halt 1193 # default action is 'continue', in which case we neither prompt nor halt
1194 1194
1195 1195
1196 def hasconflictmarkers(data): 1196 def hasconflictmarkers(data):
1197 return bool( 1197 return bool(
1198 re.search(b"^(<<<<<<< .*|=======|>>>>>>> .*)$", data, re.MULTILINE) 1198 re.search(
1199 br"^(<<<<<<<.*|=======.*|------- .*|\+\+\+\+\+\+\+ .*|>>>>>>>.*)$",
1200 data,
1201 re.MULTILINE,
1202 )
1199 ) 1203 )
1200 1204
1201 1205
1202 def _check(repo, r, ui, tool, fcd, files): 1206 def _check(repo, r, ui, tool, fcd, files):
1203 fd = fcd.path() 1207 fd = fcd.path()