~ubuntu-branches/debian/sid/bzr/sid

« back to all changes in this revision

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

  • Committer: Bazaar Package Importer
  • Author(s): Jelmer Vernooij, Jelmer Vernooij, Max Bowsher
  • Date: 2011-07-14 15:35:42 UTC
  • mfrom: (1.5.10 upstream)
  • Revision ID: james.westby@ubuntu.com-20110714153542-7m3m8jpt6c167g2a
Tags: 2.4.0~beta5-1
[ Jelmer Vernooij ]
* Fix typo in package description. Thanks Paul Stewart.
* Mark python-bzrlib as breaking with older versions of bzr that
  predate python-bzrlib. LP: #803362

[ Max Bowsher ]
* New upstream release.

Show diffs side-by-side

added added

removed removed

Lines of Context:
30
30
    TestCaseWithRepository,
31
31
    all_repository_vf_format_scenarios,
32
32
    )
 
33
from bzrlib.tests.matchers import MatchesAncestry
33
34
from bzrlib.tests.scenarios import load_tests_apply_scenarios
34
35
from bzrlib.uncommit import uncommit
35
36
 
194
195
            **kwargs):
195
196
        # actual low level test.
196
197
        repo = aBzrDir.open_repository()
197
 
        if ([None, 'missing', 'references_missing']
198
 
            != repo.get_ancestry('references_missing')):
 
198
        if not repo.has_revision('missing'):
199
199
            # the repo handles ghosts without corruption, so reconcile has
200
200
            # nothing to do here. Specifically, this test has the inventory
201
201
            # 'missing' present and the revision 'missing' missing, so clearly
215
215
        self.check_missing_was_removed(repo)
216
216
        # and the parent list for 'references_missing' should have that
217
217
        # revision a ghost now.
218
 
        self.assertEqual([None, 'references_missing'],
219
 
                         repo.get_ancestry('references_missing'))
 
218
        self.assertFalse(repo.has_revision('missing'))
220
219
 
221
220
    def check_missing_was_removed(self, repo):
222
221
        if repo._reconcile_backsup_inventory:
265
264
        # now the current inventory should still have 'ghost'
266
265
        repo = d.open_repository()
267
266
        repo.get_inventory('ghost')
268
 
        self.assertEqual([None, 'ghost'], repo.get_ancestry('ghost'))
 
267
        self.assertThat(['ghost', 'the_ghost'], MatchesAncestry(repo, 'ghost'))
269
268
 
270
269
    def test_reweave_inventory_fixes_ancestryfor_a_present_ghost(self):
271
270
        d = bzrlib.bzrdir.BzrDir.open(self.get_url('inventory_ghost_present'))
272
271
        repo = d.open_repository()
273
 
        ghost_ancestry = repo.get_ancestry('ghost')
274
 
        if ghost_ancestry == [None, 'the_ghost', 'ghost']:
 
272
        m = MatchesAncestry(repo, 'ghost')
 
273
        if m.match(['the_ghost', 'ghost']) is None:
275
274
            # the repo handles ghosts without corruption, so reconcile has
276
275
            # nothing to do
277
276
            return
278
 
        self.assertEqual([None, 'ghost'], ghost_ancestry)
 
277
        self.assertThat(['ghost'], m)
279
278
        reconciler = repo.reconcile()
280
279
        # this is a data corrupting error, so a normal reconcile should fix it.
281
280
        # one inconsistent parents should have been found : the
287
286
        repo = d.open_repository()
288
287
        repo.get_inventory('ghost')
289
288
        repo.get_inventory('the_ghost')
290
 
        self.assertEqual([None, 'the_ghost', 'ghost'], repo.get_ancestry('ghost'))
291
 
        self.assertEqual([None, 'the_ghost'], repo.get_ancestry('the_ghost'))
 
289
        self.assertThat(['the_ghost', 'ghost'],
 
290
            MatchesAncestry(repo, 'ghost'))
 
291
        self.assertThat(['the_ghost'],
 
292
            MatchesAncestry(repo, 'the_ghost'))
292
293
 
293
294
    def test_text_from_ghost_revision(self):
294
295
        repo = self.make_repository('text-from-ghost')