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

  • Committer: Robert Collins
  • Date: 2010-05-06 23:41:35 UTC
  • mto: This revision was merged to the branch mainline in revision 5223.
  • Revision ID: robertc@robertcollins.net-20100506234135-yivbzczw1sejxnxc
Lock methods on ``Tree``, ``Branch`` and ``Repository`` are now
expected to return an object which can be used to unlock them. This reduces
duplicate code when using cleanups. The previous 'tokens's returned by
``Branch.lock_write`` and ``Repository.lock_write`` are now attributes
on the result of the lock_write. ``repository.RepositoryWriteLockResult``
and ``branch.BranchWriteLockResult`` document this. (Robert Collins)

``log._get_info_for_log_files`` now takes an add_cleanup callable.
(Robert Collins)

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 breezy import (
21
 
    controldir,
 
20
from bzrlib import (
 
21
    bzrdir,
 
22
    inventory,
 
23
    repository,
22
24
    tests,
23
25
    )
24
 
from breezy.repository import WriteGroup
25
 
from breezy.bzr import (
26
 
    inventory,
27
 
    )
28
 
from breezy.tests.matchers import ContainsNoVfsCalls
29
26
 
30
27
 
31
28
class TrivialTest(tests.TestCaseWithTransport):
32
29
 
33
30
    def test_trivial_reconcile(self):
34
 
        t = controldir.ControlDir.create_standalone_workingtree('.')
 
31
        t = bzrdir.BzrDir.create_standalone_workingtree('.')
35
32
        (out, err) = self.run_bzr('reconcile')
36
33
        if t.branch.repository._reconcile_backsup_inventory:
37
34
            does_backup_text = "Inventory ok.\n"
43
40
                                  "%s"
44
41
                                  "Reconciliation complete.\n" %
45
42
                                  (t.branch.base,
46
 
                                   t.controldir.root_transport.base,
 
43
                                   t.bzrdir.root_transport.base,
47
44
                                   does_backup_text))
48
45
        self.assertEqualDiff(err, "")
49
46
 
50
47
    def test_does_something_reconcile(self):
51
 
        t = controldir.ControlDir.create_standalone_workingtree('.')
 
48
        t = bzrdir.BzrDir.create_standalone_workingtree('.')
52
49
        # an empty inventory with no revision will trigger reconciliation.
53
50
        repo = t.branch.repository
54
 
        inv = inventory.Inventory(revision_id=b'missing')
55
 
        inv.root.revision = b'missing'
 
51
        inv = inventory.Inventory(revision_id='missing')
 
52
        inv.root.revision='missing'
56
53
        repo.lock_write()
57
 
        with repo.lock_write(), WriteGroup(repo):
58
 
            repo.add_inventory(b'missing', inv, [])
 
54
        repo.start_write_group()
 
55
        repo.add_inventory('missing', inv, [])
 
56
        repo.commit_write_group()
 
57
        repo.unlock()
59
58
        (out, err) = self.run_bzr('reconcile')
60
59
        if repo._reconcile_backsup_inventory:
61
60
            does_backup_text = (
69
68
                    "%s"
70
69
                    "Reconciliation complete.\n" %
71
70
                    (t.branch.base,
72
 
                     t.controldir.root_transport.base,
 
71
                     t.bzrdir.root_transport.base,
73
72
                     does_backup_text))
74
73
        self.assertEqualDiff(expected, out)
75
74
        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)