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

  • Committer: Jelmer Vernooij
  • Date: 2020-04-05 19:11:34 UTC
  • mto: (7490.7.16 work)
  • mto: This revision was merged to the branch mainline in revision 7501.
  • Revision ID: jelmer@jelmer.uk-20200405191134-0aebh8ikiwygxma5
Populate the .gitignore file.

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
"""Black box tests for the reconcile command."""
18
18
 
19
19
 
20
 
from bzrlib import (
21
 
    bzrdir,
 
20
from breezy import (
 
21
    controldir,
 
22
    tests,
 
23
    )
 
24
from breezy.repository import WriteGroup
 
25
from breezy.bzr import (
22
26
    inventory,
23
 
    repository,
24
 
    tests,
25
27
    )
 
28
from breezy.tests.matchers import ContainsNoVfsCalls
26
29
 
27
30
 
28
31
class TrivialTest(tests.TestCaseWithTransport):
29
32
 
30
33
    def test_trivial_reconcile(self):
31
 
        t = bzrdir.BzrDir.create_standalone_workingtree('.')
 
34
        t = controldir.ControlDir.create_standalone_workingtree('.')
32
35
        (out, err) = self.run_bzr('reconcile')
33
36
        if t.branch.repository._reconcile_backsup_inventory:
34
37
            does_backup_text = "Inventory ok.\n"
40
43
                                  "%s"
41
44
                                  "Reconciliation complete.\n" %
42
45
                                  (t.branch.base,
43
 
                                   t.bzrdir.root_transport.base,
 
46
                                   t.controldir.root_transport.base,
44
47
                                   does_backup_text))
45
48
        self.assertEqualDiff(err, "")
46
49
 
47
50
    def test_does_something_reconcile(self):
48
 
        t = bzrdir.BzrDir.create_standalone_workingtree('.')
 
51
        t = controldir.ControlDir.create_standalone_workingtree('.')
49
52
        # an empty inventory with no revision will trigger reconciliation.
50
53
        repo = t.branch.repository
51
 
        inv = inventory.Inventory(revision_id='missing')
52
 
        inv.root.revision='missing'
 
54
        inv = inventory.Inventory(revision_id=b'missing')
 
55
        inv.root.revision = b'missing'
53
56
        repo.lock_write()
54
 
        repo.start_write_group()
55
 
        repo.add_inventory('missing', inv, [])
56
 
        repo.commit_write_group()
57
 
        repo.unlock()
 
57
        with repo.lock_write(), WriteGroup(repo):
 
58
            repo.add_inventory(b'missing', inv, [])
58
59
        (out, err) = self.run_bzr('reconcile')
59
60
        if repo._reconcile_backsup_inventory:
60
61
            does_backup_text = (
68
69
                    "%s"
69
70
                    "Reconciliation complete.\n" %
70
71
                    (t.branch.base,
71
 
                     t.bzrdir.root_transport.base,
 
72
                     t.controldir.root_transport.base,
72
73
                     does_backup_text))
73
74
        self.assertEqualDiff(expected, out)
74
75
        self.assertEqualDiff(err, "")
 
76
 
 
77
 
 
78
class TestSmartServerReconcile(tests.TestCaseWithTransport):
 
79
 
 
80
    def test_simple_reconcile(self):
 
81
        self.setup_smart_server_with_call_log()
 
82
        self.make_branch('branch')
 
83
        self.reset_smart_call_log()
 
84
        out, err = self.run_bzr(['reconcile', self.get_url('branch')])
 
85
        # This figure represent the amount of work to perform this use case. It
 
86
        # is entirely ok to reduce this number if a test fails due to rpc_count
 
87
        # being too low. If rpc_count increases, more network roundtrips have
 
88
        # become necessary for this use case. Please do not adjust this number
 
89
        # upwards without agreement from bzr's network support maintainers.
 
90
        self.assertLength(10, self.hpss_calls)
 
91
        self.assertLength(1, self.hpss_connections)
 
92
        self.assertThat(self.hpss_calls, ContainsNoVfsCalls)