/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/test_reconcile.py

  • Committer: Robert Collins
  • Date: 2010-05-05 00:05:29 UTC
  • mto: This revision was merged to the branch mainline in revision 5206.
  • Revision ID: robertc@robertcollins.net-20100505000529-ltmllyms5watqj5u
Make 'pydoc bzrlib.tests.build_tree_shape' useful.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2006, 2008-2011 Canonical Ltd
 
1
# Copyright (C) 2006 Canonical Ltd
2
2
#
3
3
# This program is free software; you can redistribute it and/or modify
4
4
# it under the terms of the GNU General Public License as published by
17
17
"""Tests for reconiliation behaviour that is repository independent."""
18
18
 
19
19
 
20
 
from breezy import (
21
 
    errors,
22
 
    tests,
23
 
    )
24
 
from breezy.bzr import (
25
 
    bzrdir,
26
 
    )
27
 
from breezy.reconcile import reconcile, Reconciler
28
 
from breezy.tests import per_repository
29
 
 
30
 
 
31
 
class TestWorksWithSharedRepositories(per_repository.TestCaseWithRepository):
 
20
from bzrlib import bzrdir, errors, tests
 
21
from bzrlib.reconcile import reconcile, Reconciler
 
22
from bzrlib.revision import Revision
 
23
from bzrlib.tests.per_repository import TestCaseWithRepository
 
24
from bzrlib.transport import get_transport
 
25
from bzrlib.workingtree import WorkingTree
 
26
 
 
27
 
 
28
class TestWorksWithSharedRepositories(TestCaseWithRepository):
32
29
 
33
30
    def test_reweave_empty(self):
34
31
        # we want a repo capable format
38
35
        child = bzrdir.BzrDirMetaFormat1().initialize('child')
39
36
        self.assertRaises(errors.NoRepositoryPresent, child.open_repository)
40
37
        reconciler = Reconciler(child)
41
 
        result = reconciler.reconcile()
 
38
        reconciler.reconcile()
42
39
        # smoke test for reconcile appears to work too.
43
40
        reconcile(child)
44
41
        # no inconsistent parents should have been found
45
42
        # but the values should have been set.
46
 
        self.assertEqual(0, result.inconsistent_parents)
 
43
        self.assertEqual(0, reconciler.inconsistent_parents)
47
44
        # and no garbage inventories
48
 
        self.assertEqual(0, result.garbage_inventories)
 
45
        self.assertEqual(0, reconciler.garbage_inventories)
49
46
 
50
47
 
51
48
class TestReconciler(tests.TestCaseWithTransport):
52
49
 
53
50
    def test_reconciler_with_no_branch(self):
54
51
        repo = self.make_repository('repo')
55
 
        reconciler = Reconciler(repo.controldir)
56
 
        result = reconciler.reconcile()
 
52
        reconciler = Reconciler(repo.bzrdir)
 
53
        reconciler.reconcile()
57
54
        # no inconsistent parents should have been found
58
55
        # but the values should have been set.
59
 
        self.assertEqual(0, result.inconsistent_parents)
 
56
        self.assertEqual(0, reconciler.inconsistent_parents)
60
57
        # and no garbage inventories
61
 
        self.assertEqual(0, result.garbage_inventories)
62
 
        self.assertIs(None, result.fixed_branch_history)
 
58
        self.assertEqual(0, reconciler.garbage_inventories)
 
59
        self.assertIs(None, reconciler.fixed_branch_history)
63
60
 
64
61
    def test_reconciler_finds_branch(self):
65
62
        a_branch = self.make_branch('a_branch')
66
 
        reconciler = Reconciler(a_branch.controldir)
67
 
        result = reconciler.reconcile()
 
63
        reconciler = Reconciler(a_branch.bzrdir)
 
64
        reconciler.reconcile()
68
65
 
69
66
        # It should have checked the repository, and the branch
70
 
        self.assertEqual(0, result.inconsistent_parents)
71
 
        self.assertEqual(0, result.garbage_inventories)
72
 
        self.assertIs(False, result.fixed_branch_history)
 
67
        self.assertEqual(0, reconciler.inconsistent_parents)
 
68
        self.assertEqual(0, reconciler.garbage_inventories)
 
69
        self.assertIs(False, reconciler.fixed_branch_history)