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

  • Committer: Jelmer Vernooij
  • Date: 2019-02-15 17:41:17 UTC
  • mto: (7290.1.2 work)
  • mto: This revision was merged to the branch mainline in revision 7295.
  • Revision ID: jelmer@jelmer.uk-20190215174117-o9w1am2z88mg9g1q
Update references to home location.

~/.config/breezy rather than ~/.bazaar.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2006 Canonical Ltd
 
1
# Copyright (C) 2006, 2008-2011 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 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):
 
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):
29
32
 
30
33
    def test_reweave_empty(self):
31
34
        # we want a repo capable format
35
38
        child = bzrdir.BzrDirMetaFormat1().initialize('child')
36
39
        self.assertRaises(errors.NoRepositoryPresent, child.open_repository)
37
40
        reconciler = Reconciler(child)
38
 
        reconciler.reconcile()
 
41
        result = reconciler.reconcile()
39
42
        # smoke test for reconcile appears to work too.
40
43
        reconcile(child)
41
44
        # no inconsistent parents should have been found
42
45
        # but the values should have been set.
43
 
        self.assertEqual(0, reconciler.inconsistent_parents)
 
46
        self.assertEqual(0, result.inconsistent_parents)
44
47
        # and no garbage inventories
45
 
        self.assertEqual(0, reconciler.garbage_inventories)
 
48
        self.assertEqual(0, result.garbage_inventories)
46
49
 
47
50
 
48
51
class TestReconciler(tests.TestCaseWithTransport):
49
52
 
50
53
    def test_reconciler_with_no_branch(self):
51
54
        repo = self.make_repository('repo')
52
 
        reconciler = Reconciler(repo.bzrdir)
53
 
        reconciler.reconcile()
 
55
        reconciler = Reconciler(repo.controldir)
 
56
        result = reconciler.reconcile()
54
57
        # no inconsistent parents should have been found
55
58
        # but the values should have been set.
56
 
        self.assertEqual(0, reconciler.inconsistent_parents)
 
59
        self.assertEqual(0, result.inconsistent_parents)
57
60
        # and no garbage inventories
58
 
        self.assertEqual(0, reconciler.garbage_inventories)
59
 
        self.assertIs(None, reconciler.fixed_branch_history)
 
61
        self.assertEqual(0, result.garbage_inventories)
 
62
        self.assertIs(None, result.fixed_branch_history)
60
63
 
61
64
    def test_reconciler_finds_branch(self):
62
65
        a_branch = self.make_branch('a_branch')
63
 
        reconciler = Reconciler(a_branch.bzrdir)
64
 
        reconciler.reconcile()
 
66
        reconciler = Reconciler(a_branch.controldir)
 
67
        result = reconciler.reconcile()
65
68
 
66
69
        # It should have checked the repository, and the branch
67
 
        self.assertEqual(0, reconciler.inconsistent_parents)
68
 
        self.assertEqual(0, reconciler.garbage_inventories)
69
 
        self.assertIs(False, reconciler.fixed_branch_history)
 
70
        self.assertEqual(0, result.inconsistent_parents)
 
71
        self.assertEqual(0, result.garbage_inventories)
 
72
        self.assertIs(False, result.fixed_branch_history)