~abentley/bzrtools/bzrtools.dev

« back to all changes in this revision

Viewing changes to tests/test_conflict_diff.py

  • Committer: Aaron Bentley
  • Date: 2009-07-10 04:05:24 UTC
  • Revision ID: aaron@aaronbentley.com-20090710040524-slufgm4he3fx1r4f
Mirror the child_submit_to setting.

Show diffs side-by-side

added added

removed removed

Lines of Context:
21
21
from bzrlib.tests import TestCaseWithTransport
22
22
from bzrlib.plugins.bzrtools import errors
23
23
from bzrlib.plugins.bzrtools.conflict_diff import (
24
 
    ConflictDiffer
 
24
    conflict_diff,
 
25
    get_old_lines,
25
26
)
26
27
 
27
28
 
31
32
        self.build_tree_contents(
32
33
            [('foo.THIS', 'this\n'), ('foo.BASE', 'base\n')])
33
34
        s = StringIO()
34
 
        ConflictDiffer().conflict_diff(s, 'foo', 'this')
 
35
        conflict_diff(s, 'foo', 'this')
35
36
        self.assertEqual('--- foo.BASE\n+++ foo.THIS\n'
36
37
                         '@@ -1,1 +1,1 @@\n'
37
38
                         '-base\n+this\n\n', s.getvalue())
40
41
        tree = self.make_branch_and_tree('.')
41
42
        self.build_tree_contents([('foo', 'base\n')])
42
43
        tree.add('foo')
43
 
        e = self.assertRaises(errors.NoConflictFiles,
44
 
                              ConflictDiffer().get_old_lines,
45
 
                              'foo',
 
44
        e = self.assertRaises(errors.NoConflictFiles, get_old_lines, 'foo',
46
45
                              'foo.BASE')
47
46
        self.assertEqual('foo.BASE does not exist and there are no pending'
48
47
                         ' merges.', str(e))
49
48
 
50
49
    def test_get_old_lines(self):
51
50
        self.build_tree_contents([('foo.BASE', 'base\n')])
52
 
        old_lines = ConflictDiffer().get_old_lines('foo', 'foo.BASE')
 
51
        old_lines = get_old_lines('foo', 'foo.BASE')
53
52
        self.assertEqual(['base\n'], old_lines)
54
53
 
55
54
    def test_get_old_lines_no_base(self):
64
63
        tree.commit('Changed foo text')
65
64
        tree.merge_from_branch(other.branch)
66
65
        os.unlink('tree/foo.BASE')
67
 
        old_lines = ConflictDiffer().get_old_lines('tree/foo', 'tree/foo.BASE')
 
66
        old_lines = get_old_lines('tree/foo', 'tree/foo.BASE')
68
67
        self.assertEqual(['base\n'], old_lines)