~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_merge3.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2007-10-10 08:52:29 UTC
  • mfrom: (2903.1.1 trunk)
  • Revision ID: pqm@pqm.ubuntu.com-20071010085229-7x5al1tirr29mq0l
Fix 149019 by using a proper line number when reporting errors

Show diffs side-by-side

added added

removed removed

Lines of Context:
383
383
        m_lines = m3.merge_lines('OTHER', 'THIS')
384
384
        self.assertEqual('<<<<<<< OTHER\rc\r=======\rb\r'
385
385
            '>>>>>>> THIS\r'.splitlines(True), list(m_lines))
386
 
 
387
 
    def test_merge3_cherrypick(self):
388
 
        base_text = "a\nb\n"
389
 
        this_text = "a\n"
390
 
        other_text = "a\nb\nc\n"
391
 
        # When cherrypicking, lines in base are not part of the conflict
392
 
        m3 = Merge3(base_text.splitlines(True), this_text.splitlines(True),
393
 
                    other_text.splitlines(True), is_cherrypick=True)
394
 
        m_lines = m3.merge_lines()
395
 
        self.assertEqualDiff('a\n<<<<<<<\n=======\nc\n>>>>>>>\n',
396
 
                             ''.join(m_lines))
397
 
 
398
 
        # This is not symmetric
399
 
        m3 = Merge3(base_text.splitlines(True), other_text.splitlines(True),
400
 
                    this_text.splitlines(True), is_cherrypick=True)
401
 
        m_lines = m3.merge_lines()
402
 
        self.assertEqualDiff('a\n<<<<<<<\nb\nc\n=======\n>>>>>>>\n',
403
 
                             ''.join(m_lines))
404
 
 
405
 
    def test_merge3_cherrypick_w_mixed(self):
406
 
        base_text = 'a\nb\nc\nd\ne\n'
407
 
        this_text = 'a\nb\nq\n'
408
 
        other_text = 'a\nb\nc\nd\nf\ne\ng\n'
409
 
        # When cherrypicking, lines in base are not part of the conflict
410
 
        m3 = Merge3(base_text.splitlines(True), this_text.splitlines(True),
411
 
                    other_text.splitlines(True), is_cherrypick=True)
412
 
        m_lines = m3.merge_lines()
413
 
        self.assertEqualDiff('a\n'
414
 
                             'b\n'
415
 
                             '<<<<<<<\n'
416
 
                             'q\n'
417
 
                             '=======\n'
418
 
                             'f\n'
419
 
                             '>>>>>>>\n'
420
 
                             '<<<<<<<\n'
421
 
                             '=======\n'
422
 
                             'g\n'
423
 
                             '>>>>>>>\n',
424
 
                             ''.join(m_lines))