18
18
from bzrlib.selftest import TestCaseInTempDir, TestCase
19
19
from bzrlib.merge3 import Merge3
20
from bzrlib.errors import CantReprocessAndShowBase
21
22
def split_lines(t):
22
23
from cStringIO import StringIO
300
301
self.log('merge result:')
301
302
self.log(''.join(ml))
302
303
self.assertEquals(ml, MERGED_RESULT)
305
def test_minimal_conflicts(self):
307
base_text = ("a\n" * 20).splitlines(True)
308
this_text = ("a\n"*10+"b\n" * 10).splitlines(True)
309
other_text = ("a\n"*10+"c\n"+"b\n" * 8 + "c\n").splitlines(True)
310
m3 = Merge3(base_text, other_text, this_text)
311
m_lines = m3.merge_lines('OTHER', 'THIS', reprocess=True)
312
merged_text = "".join(list(m_lines))
313
optimal_text = "a\n" * 10 + "<<<<<<< OTHER\nc\n=======\n>>>>>>> THIS"\
314
+ "\n" + 8* "b\n" + "<<<<<<< OTHER\nc\n=======\nb\nb\n>>>>>>>"\
316
self.assertEqualDiff(merged_text, optimal_text)
318
def test_reprocess_and_base(self):
319
"""Reprocessing and showing base breaks correctly"""
320
base_text = ("a\n" * 20).splitlines(True)
321
this_text = ("a\n"*10+"b\n" * 10).splitlines(True)
322
other_text = ("a\n"*10+"c\n"+"b\n" * 8 + "c\n").splitlines(True)
323
m3 = Merge3(base_text, other_text, this_text)
324
m_lines = m3.merge_lines('OTHER', 'THIS', reprocess=True,
325
base_marker='|||||||')
326
self.assertRaises(CantReprocessAndShowBase, list, m_lines)