--- a/mercurial/commands.py Mon Jul 02 18:39:48 2018 -0700
+++ b/mercurial/commands.py Thu Jul 26 17:11:03 2018 -0700
@@ -35,6 +35,7 @@
error,
exchange,
extensions,
+ filemerge,
formatter,
graphmod,
hbisect,
@@ -4594,6 +4595,9 @@
runconclude = False
tocomplete = []
+ hasconflictmarkers = []
+ if mark:
+ markcheck = ui.config('experimental', 'resolve.mark-check')
for f in ms:
if not m(f):
continue
@@ -4629,6 +4633,12 @@
continue
if mark:
+ if markcheck:
+ with repo.wvfs(f) as fobj:
+ fdata = fobj.read()
+ if filemerge.hasconflictmarkers(fdata) and \
+ ms[f] != mergemod.MERGE_RECORD_RESOLVED:
+ hasconflictmarkers.append(f)
ms.mark(f, mergemod.MERGE_RECORD_RESOLVED)
elif unmark:
ms.mark(f, mergemod.MERGE_RECORD_UNRESOLVED)
@@ -4663,6 +4673,13 @@
if inst.errno != errno.ENOENT:
raise
+ if hasconflictmarkers:
+ ui.warn(_('warning: the following files still have conflict '
+ 'markers:\n ') + '\n '.join(hasconflictmarkers) + '\n')
+ if markcheck == 'abort' and not all:
+ raise error.Abort(_('conflict markers detected'),
+ hint=_('use --all to mark anyway'))
+
for f in tocomplete:
try:
# resolve file