59
59
self.log(' %r' % k._parents)
60
60
self.log(' %r' % k2._parents)
64
62
self.fail('read/write check failed')
65
class WeaveContains(TestBase):
66
"""Weave __contains__ operator"""
69
self.assertFalse('foo' in k)
70
k.add('foo', [], TEXT_1)
71
self.assertTrue('foo' in k)
69
74
class Easy(TestBase):
876
881
eq = self.assertEquals
877
882
eq(sorted(wa.iter_names()), ['v1', 'v2', 'v3', 'x1',])
878
883
eq(wa.get_text('x1'), 'line from x1\n')
880
def test_reweave_with_empty(self):
882
wr = reweave(self.weave1, wb)
883
eq = self.assertEquals
884
eq(sorted(wr.iter_names()), ['v1', 'v2', 'v3'])
885
eq(wr.get_lines('v3'), ['hello\n', 'cruel\n', 'world\n'])
886
self.weave1.reweave(wb)
887
self.assertEquals(wr, self.weave1)
889
def test_join_with_ghosts_raises_parent_mismatch(self):
890
wa = self.weave1.copy()
892
wb.add('x1', [], ['line from x1\n'])
893
wb.add('v1', [], ['hello\n'])
894
wb.add('v2', ['v1', 'x1'], ['hello\n', 'world\n'])
895
self.assertRaises(errors.WeaveParentMismatch, wa.join, wb)
897
def test_reweave_with_ghosts(self):
898
"""Join that inserts parents of an existing revision.
900
This can happen when merging from another branch who
901
knows about revisions the destination does not. In
902
this test the second weave knows of an additional parent of
903
v2. Any revisions which are in common still have to have the
905
wa = self.weave1.copy()
907
wb.add('x1', [], ['line from x1\n'])
908
wb.add('v1', [], ['hello\n'])
909
wb.add('v2', ['v1', 'x1'], ['hello\n', 'world\n'])
911
eq = self.assertEquals
912
eq(sorted(wc.iter_names()), ['v1', 'v2', 'v3', 'x1',])
913
eq(wc.get_text('x1'), 'line from x1\n')
914
eq(wc.get_lines('v2'), ['hello\n', 'world\n'])
915
eq(wc.parent_names('v2'), ['v1', 'x1'])
916
self.weave1.reweave(wb)
917
self.assertEquals(wc, self.weave1)
920
if __name__ == '__main__':
923
sys.exit(unittest.main())