~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

  • Committer: Jelmer Vernooij
  • Date: 2012-02-20 12:19:29 UTC
  • mfrom: (6437.23.11 2.5)
  • mto: (6581.1.1 trunk)
  • mto: This revision was merged to the branch mainline in revision 6582.
  • Revision ID: jelmer@samba.org-20120220121929-7ni2psvjoatm1yp4
Merge bzr/2.5.

Show diffs side-by-side

added added

removed removed

Lines of Context:
349
349
        # we should add a lower level api to allow constructing such cases.
350
350
 
351
351
        # first off the common logic:
352
 
        tree = self.make_branch_and_tree('wrong-first-parent')
353
 
        second_tree = self.make_branch_and_tree('reversed-secondary-parents')
354
 
        for t in [tree, second_tree]:
 
352
        self.first_tree = self.make_branch_and_tree('wrong-first-parent')
 
353
        self.second_tree = self.make_branch_and_tree(
 
354
            'reversed-secondary-parents')
 
355
        for t in [self.first_tree, self.second_tree]:
355
356
            t.commit('1', rev_id='1')
356
357
            uncommit(t.branch, tree=t)
357
358
            t.commit('2', rev_id='2')
360
361
            uncommit(t.branch, tree=t)
361
362
        #second_tree = self.make_branch_and_tree('reversed-secondary-parents')
362
363
        #second_tree.pull(tree) # XXX won't copy the repo?
363
 
        repo_secondary = second_tree.branch.repository
 
364
        repo_secondary = self.second_tree.branch.repository
364
365
 
365
366
        # now setup the wrong-first parent case
366
 
        repo = tree.branch.repository
 
367
        repo = self.first_tree.branch.repository
367
368
        repo.lock_write()
368
369
        repo.start_write_group()
369
370
        inv = Inventory(revision_id='wrong-first-parent')
406
407
 
407
408
    def test_reconcile_wrong_order(self):
408
409
        # a wrong order in primary parents is optionally correctable
409
 
        t = self.get_transport().clone('wrong-first-parent')
410
 
        d = bzrlib.bzrdir.BzrDir.open_from_transport(t)
411
 
        repo = d.open_repository()
 
410
        repo = self.first_tree.branch.repository
412
411
        repo.lock_read()
413
412
        try:
414
413
            g = repo.get_graph()
417
416
                raise TestSkipped('wrong-first-parent is not setup for testing')
418
417
        finally:
419
418
            repo.unlock()
420
 
        self.checkUnreconciled(d, repo.reconcile())
 
419
        self.checkUnreconciled(repo.bzrdir, repo.reconcile())
421
420
        # nothing should have been altered yet : inventories without
422
421
        # revisions are not data loss incurring for current format
423
422
        reconciler = repo.reconcile(thorough=True)
435
434
 
436
435
    def test_reconcile_wrong_order_secondary_inventory(self):
437
436
        # a wrong order in the parents for inventories is ignored.
438
 
        t = self.get_transport().clone('reversed-secondary-parents')
439
 
        d = bzrlib.bzrdir.BzrDir.open_from_transport(t)
440
 
        repo = d.open_repository()
441
 
        self.checkUnreconciled(d, repo.reconcile())
442
 
        self.checkUnreconciled(d, repo.reconcile(thorough=True))
 
437
        repo = self.second_tree.branch.repository
 
438
        self.checkUnreconciled(repo.bzrdir, repo.reconcile())
 
439
        self.checkUnreconciled(repo.bzrdir, repo.reconcile(thorough=True))