37
37
from bzrlib.knit import KnitVersionedFile, \
38
38
KnitAnnotateFactory
39
from bzrlib.tests import TestCaseWithTransport
39
from bzrlib.tests import TestCaseWithTransport, TestSkipped
40
40
from bzrlib.tests.HTTPTestUtil import TestCaseWithWebserver
41
41
from bzrlib.trace import mutter
42
42
from bzrlib.transport import get_transport
126
126
(errors.BzrBadParameterUnicode, NotImplementedError),
127
127
vf.add_lines_with_ghosts, 'a', [], ['a\n', u'b\n', 'c\n'])
129
def test_add_follows_left_matching_blocks(self):
130
"""If we change left_matching_blocks, delta changes
132
Note: There are multiple correct deltas in this case, because
133
we start with 1 "a" and we get 3.
136
if isinstance(vf, WeaveFile):
137
raise TestSkipped("WeaveFile ignores left_matching_blocks")
138
vf.add_lines('1', [], ['a\n'])
139
vf.add_lines('2', ['1'], ['a\n', 'a\n', 'a\n'],
140
left_matching_blocks=[(0, 0, 1), (1, 3, 0)])
141
self.assertEqual([(1, 1, 2, [('2', 'a\n'), ('2', 'a\n')])],
142
vf.get_delta('2')[3])
143
vf.add_lines('3', ['1'], ['a\n', 'a\n', 'a\n'],
144
left_matching_blocks=[(0, 2, 1), (1, 3, 0)])
145
self.assertEqual([(0, 0, 2, [('3', 'a\n'), ('3', 'a\n')])],
146
vf.get_delta('3')[3])
129
148
def test_inline_newline_throws(self):
130
149
# \r characters are not permitted in lines being added
131
150
vf = self.get_file()