/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/workingtree_implementations/test_basis_inventory.py

Merge bzr.dev, fix minor conflict in cmd_revision_history().

Show diffs side-by-side

added added

removed removed

Lines of Context:
18
18
 
19
19
from bzrlib.tests.workingtree_implementations import TestCaseWithWorkingTree
20
20
from bzrlib.branch import Branch
21
 
from bzrlib.xml5 import serializer_v5
 
21
from bzrlib.revision import Revision
 
22
import bzrlib.xml5
22
23
 
23
24
 
24
25
class TestBasisInventory(TestCaseWithWorkingTree):
49
50
        t._control_files.get_utf8('basis-inventory')
50
51
 
51
52
        basis_inv_txt = t.read_basis_inventory()
52
 
        basis_inv = serializer_v5.read_inventory_from_string(basis_inv_txt)
 
53
        basis_inv = bzrlib.xml5.serializer_v5.read_inventory_from_string(basis_inv_txt)
53
54
        self.assertEquals('r2', basis_inv.revision_id)
54
55
        store_inv = b.repository.get_inventory('r2')
55
56
 
56
57
        self.assertEquals(store_inv._byid, basis_inv._byid)
57
58
 
 
59
    def test_basis_inv_gets_revision(self):
 
60
        """When the inventory of the basis tree has no revision id it gets set.
 
61
 
 
62
        It gets set during set_last_revision.
 
63
        """
 
64
        tree = self.make_branch_and_tree('.')
 
65
        tree.lock_write()
 
66
        tree.branch.repository.control_weaves.get_weave('inventory',
 
67
            tree.branch.repository.get_transaction()
 
68
            ).add_lines('r1', [], [
 
69
                '<inventory format="5">\n',
 
70
                '</inventory>\n'])
 
71
        rev = Revision(timestamp=0,
 
72
                       timezone=None,
 
73
                       committer="Foo Bar <foo@example.com>",
 
74
                       message="Message",
 
75
                       inventory_sha1="",
 
76
                       revision_id='r1')
 
77
        rev.parent_ids = []
 
78
        tree.branch.repository.add_revision('r1', rev)
 
79
        tree.unlock()
 
80
        tree.branch.append_revision('r1')
 
81
        tree.set_last_revision('r1')
 
82
        # TODO: we should deserialise the file here, rather than peeking
 
83
        # without parsing, but to do this properly needs a serialiser on the
 
84
        # tree object that abstracts whether it is xml/rio/etc.
 
85
        self.assertContainsRe(
 
86
            tree._control_files.get_utf8('basis-inventory').read(),
 
87
            'revision_id="r1"')
 
88