~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/selftest/testmerge3.py

  • Committer: Martin Pool
  • Date: 2005-07-05 08:09:30 UTC
  • Revision ID: mbp@sourcefrog.net-20050705080929-f44361a66a8b2e29
- Merge3.find_sync_regions always returns a zero-length sentinal at the end to
  ease matching.

- Merge3.merge partially done.

Show diffs side-by-side

added added

removed removed

Lines of Context:
31
31
        self.assertEquals(list(m3.find_sync_regions()),
32
32
                          [(0, 2,
33
33
                            0, 2,
34
 
                            0, 2)])
35
 
 
 
34
                            0, 2),
 
35
                           (2,2, 2,2, 2,2)])
 
36
 
 
37
        self.assertEquals(list(m3.merge_regions()),
 
38
                          [('unchanged', 0, 2)])
 
39
 
 
40
 
 
41
class FrontInsert(TestBase):
 
42
    def runTest(self):
 
43
        m3 = Merge3(['zz'],
 
44
                    ['aaa', 'bbb', 'zz'],
 
45
                    ['zz'])
 
46
 
 
47
        # todo: should use a sentinal at end as from get_matching_blocks
 
48
        # to match without zz
 
49
        self.assertEquals(list(m3.find_sync_regions()),
 
50
                          [(0,1, 2,3, 0,1),
 
51
                           (1,1, 3,3, 1,1),])
 
52
 
 
53
        self.assertEquals(list(m3.merge_regions()),
 
54
                          [('a', 0, 2),
 
55
                           ('unchanged', 0, 1)])
 
56
        
 
57
    
 
58
 
 
59
class NullInsert(TestBase):
 
60
    def runTest(self):
 
61
        m3 = Merge3([],
 
62
                    ['aaa', 'bbb'],
 
63
                    [])
 
64
 
 
65
        # todo: should use a sentinal at end as from get_matching_blocks
 
66
        # to match without zz
 
67
        self.assertEquals(list(m3.find_sync_regions()),
 
68
                          [(0,0, 2,2, 0,0)])
 
69
 
 
70
        self.assertEquals(list(m3.merge_regions()),
 
71
                          [('a', 0, 2)])
 
72
        
36
73
    
37
74
 
38
75
class NoConflicts(TestBase):
45
82
        self.assertEquals(m3.find_unconflicted(),
46
83
                          [(0, 1), (1, 2)])
47
84
 
48
 
 
49
 
 
50
85
        self.assertEquals(list(m3.find_sync_regions()),
51
 
                          [(0, 1, 0, 1, 0, 1),
52
 
                           (1, 2, 2, 3, 1, 2)])
 
86
                          [(0,1, 0,1, 0,1),
 
87
                           (1,2, 2,3, 1,2),
 
88
                           (2,2, 3,3, 2,2),])
 
89
 
 
90
 
53
91
 
54
92
 
55
93
class InsertClash(TestBase):
63
101
                          [(0, 1), (1, 2)])
64
102
 
65
103
        self.assertEquals(list(m3.find_sync_regions()),
66
 
                          [(0, 1, 0, 1, 0, 1),
67
 
                           (1, 2, 2, 3, 2, 3)])
 
104
                          [(0,1, 0,1, 0,1),
 
105
                           (1,2, 2,3, 2,3),
 
106
                           (2,2, 3,3, 3,3),])
68
107
 
69
108
 
70
109
 
79
118
                          [(0, 1), (2, 3)])
80
119
 
81
120
        self.assertEquals(list(m3.find_sync_regions()),
82
 
                          [(0, 1, 0, 1, 0, 1),
83
 
                           (2, 3, 2, 3, 2, 3)])
 
121
                          [(0,1, 0,1, 0,1),
 
122
                           (2,3, 2,3, 2,3),
 
123
                           (3,3, 3,3, 3,3),])
84
124
 
85
125
 
86
126
 
96
136
 
97
137
 
98
138
        self.assertEquals(list(m3.find_sync_regions()),
99
 
                          [(0, 1, 0, 1, 0, 1),
100
 
                           (3, 4, 4, 5, 5, 6)])
 
139
                          [(0,1, 0,1, 0,1),
 
140
                           (3,4, 4,5, 5,6),
 
141
                           (4,4, 5,5, 6,6),])
101
142
 
102
143
        
103
144