/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/tests/repository_implementations/test_reconcile.py

Teach Knit repositories how to handle ghosts without corrupting at all.

Show diffs side-by-side

added added

removed removed

Lines of Context:
125
125
    def test_reweave_inventory_without_revision(self):
126
126
        # actual low level test.
127
127
        d = bzrlib.bzrdir.BzrDir.open('inventory_without_revision')
128
 
        reconciler = d.open_repository().reconcile()
129
 
        # no inconsistent parents should have been found
130
 
        self.assertEqual(1, reconciler.inconsistent_parents)
 
128
        repo = d.open_repository()
 
129
        if ([None, 'missing', 'references_missing'] 
 
130
            != repo.get_ancestry('references_missing')):
 
131
            # the repo handles ghosts without corruption, so reconcile has
 
132
            # nothing to do here
 
133
            expected_inconsistent_parents = 0
 
134
        else:
 
135
            expected_inconsistent_parents = 1
 
136
        reconciler = repo.reconcile()
 
137
        # some number of inconsistent parents should have been found
 
138
        self.assertEqual(expected_inconsistent_parents,
 
139
                         reconciler.inconsistent_parents)
131
140
        # and one garbage inventories
132
141
        self.assertEqual(1, reconciler.garbage_inventories)
133
142
        # now the backup should have it but not the current inventory
158
167
    def test_reweave_inventory_fixes_ancestryfor_a_present_ghost(self):
159
168
        d = bzrlib.bzrdir.BzrDir.open('inventory_ghost_present')
160
169
        repo = d.open_repository()
161
 
        self.assertEqual([None, 'ghost'], repo.get_ancestry('ghost'))
 
170
        ghost_ancestry = repo.get_ancestry('ghost')
 
171
        if ghost_ancestry == [None, 'the_ghost', 'ghost']:
 
172
            # the repo handles ghosts without corruption, so reconcile has
 
173
            # nothing to do
 
174
            return
 
175
        self.assertEqual([None, 'ghost'], ghost_ancestry)
162
176
        reconciler = repo.reconcile()
163
177
        # one inconsistent parents should have been found : the
164
178
        # available but not reference parent for ghost.