121
121
k.add('text0', [], 'text0')
122
122
self.assertEqual('34dc0e430c642a26c3dd1c2beb7a8b4f4445eb79',
123
123
k.get_sha1('text0'))
124
self.assertRaises(errors.WeaveRevisionNotPresent,
124
self.assertRaises(errors.RevisionNotPresent,
126
self.assertRaises(errors.WeaveRevisionNotPresent,
126
self.assertRaises(errors.RevisionNotPresent,
127
127
k.get_sha1, 'text1')
152
152
def runTest(self):
154
154
idx = k.add('text0', [], TEXT_0)
155
self.assertRaises(WeaveError,
155
self.assertRaises(errors.RevisionAlreadyPresent,
159
159
['not the same text'])
160
self.assertRaises(WeaveError,
160
self.assertRaises(errors.RevisionAlreadyPresent,
163
163
[12], # not the right parents
517
517
"""Weave with two diverged texts based on version 0.
519
519
def runTest(self):
520
# FIXME make the weave, dont poke at it.
523
k._names = ['0', '1', '2']
522
524
k._parents = [frozenset(),
599
601
self.assertEqual(list(k.inclusions([3])),
602
['text0', 'text1', 'text2', 'merge'])
602
604
self.log('k._weave=' + pformat(k._weave))
638
640
k.add([1], ['aaa', 'ccc', 'bbb', '222'])
641
class AutoMerge(TestBase):
645
texts = [['header', 'aaa', 'bbb'],
646
['header', 'aaa', 'line from 1', 'bbb'],
647
['header', 'aaa', 'bbb', 'line from 2', 'more from 2'],
650
k.add('text0', [], texts[0])
651
k.add('text1', [0], texts[1])
652
k.add('text2', [0], texts[2])
654
self.log('k._weave=' + pformat(k._weave))
656
m = list(k.mash_iter([0, 1, 2]))
662
'line from 2', 'more from 2'])
665
643
class Khayyam(TestBase):
666
644
"""Test changes to multi-line texts, and read/write"""
646
def test_multi_line_merge(self):
669
648
"""A Book of Verses underneath the Bough,
670
649
A Jug of Wine, a Loaf of Bread, -- and Thou