~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/selftest/test_weave.py

  • Committer: Martin Pool
  • Date: 2005-10-06 08:11:46 UTC
  • mto: (1185.13.3)
  • mto: This revision was merged to the branch mainline in revision 1418.
  • Revision ID: mbp@sourcefrog.net-20051006081146-6be9d0613fd0d24d
- fix join of weaves where parents occur at different offsets
- test for this

Show diffs side-by-side

added added

removed removed

Lines of Context:
840
840
        eq(wa.get_lines('b1'),
841
841
           ['hello\n', 'pale blue\n', 'world\n'])
842
842
 
 
843
    def test_join_unordered(self):
 
844
        """Join weaves where indexes differ.
 
845
        
 
846
        The source weave contains a different version at index 0."""
 
847
        wa = self.weave1.copy()
 
848
        wb = Weave()
 
849
        wb.add('x1', [], ['line from x1\n'])
 
850
        wb.add('v1', [], ['hello\n'])
 
851
        wb.add('v2', ['v1'], ['hello\n', 'world\n'])
 
852
        wa.join(wb)
 
853
        eq = self.assertEquals
 
854
        eq(sorted(wa.iter_names()), ['v1', 'v2', 'v3', 'x1',])
 
855
        eq(wa.get_text('x1'), 'line from x1\n')
 
856
        eq(wa.get_lines('v2'), ['hello\n', 'world\n'])
 
857
 
 
858
    def test_join_with_ghosts(self):
 
859
        """Join that inserts parents of an existing revision.
 
860
 
 
861
        This can happen when merging from another branch who
 
862
        knows about revisions the destination does not.  In 
 
863
        this test the second weave knows of an additional parent of 
 
864
        v2.  Any revisions which are in common still have to have the 
 
865
        same text."""
 
866
 
843
867
 
844
868
if __name__ == '__main__':
845
869
    import sys