~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/workingtree_implementations/test_basis_inventory.py

  • Committer: Martin Pool
  • Date: 2006-06-20 07:55:43 UTC
  • mfrom: (1798 +trunk)
  • mto: This revision was merged to the branch mainline in revision 1799.
  • Revision ID: mbp@sourcefrog.net-20060620075543-b10f6575d4a4fa32
[merge] bzr.dev

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.revision import Revision
21
22
import bzrlib.xml5
22
23
 
23
24
 
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