diff --git a/mercurial/filemerge.py b/mercurial/filemerge.py --- a/mercurial/filemerge.py +++ b/mercurial/filemerge.py @@ -287,6 +287,9 @@ def _formatconflictmarker(repo, ctx, tem label = ('%s:' % label).ljust(pad + 1) mark = '%s %s' % (label, templater.stringify(templateresult)) + if mark: + mark = mark.splitlines()[0] # split for safety + # The <<< marks add 8 to the length, and '...' adds three, so max # length of the actual marker is 69. maxlength = 80 - 8 - 3 diff --git a/tests/test-conflict.t b/tests/test-conflict.t --- a/tests/test-conflict.t +++ b/tests/test-conflict.t @@ -52,6 +52,26 @@ Verify custom conflict markers something >>>>>>> other: test 1 +Verify line splitting of custom conflict marker which causes multiple lines + + $ hg up -q --clean . + $ cat >> .hg/hgrc < [ui] + > mergemarkertemplate={author} {rev}\nfoo\nbar\nbaz + > EOF + + $ hg -q merge 1 + warning: conflicts during merge. + merging a incomplete! (edit conflicts, then use 'hg resolve --mark') + [1] + + $ cat a + <<<<<<< local: test 2 + something else + ======= + something + >>>>>>> other: test 1 + Verify basic conflict markers $ hg up -q --clean .