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

  • Committer: Jelmer Vernooij
  • Date: 2019-03-04 00:16:27 UTC
  • mfrom: (7293 work)
  • mto: This revision was merged to the branch mainline in revision 7318.
  • Revision ID: jelmer@jelmer.uk-20190304001627-v6u7o6pf97tukhek
Merge trunk.

Show diffs side-by-side

added added

removed removed

Lines of Context:
25
25
        # This test is not applicable to DirState based trees: the basis is
26
26
        # not separate is mandatory.
27
27
        if isinstance(self.workingtree_format,
28
 
            breezy.bzr.workingtree_4.DirStateWorkingTreeFormat):
 
28
                      breezy.bzr.workingtree_4.DirStateWorkingTreeFormat):
29
29
            raise TestNotApplicable("not applicable to %r"
30
 
                % (self.workingtree_format,))
 
30
                                    % (self.workingtree_format,))
31
31
        # TODO: jam 20051218 this probably should add more than just
32
32
        #                    a couple files to the inventory
33
33
 
35
35
        t = self.make_branch_and_tree('.')
36
36
        if getattr(t, 'root_inventory', None) is None:
37
37
            raise TestNotApplicable("not applicable to %r"
38
 
                % (self.workingtree_format,))
 
38
                                    % (self.workingtree_format,))
39
39
 
40
40
        b = t.branch
41
 
        with open('a', 'wb') as f: f.write(b'a\n')
 
41
        with open('a', 'wb') as f:
 
42
            f.write(b'a\n')
42
43
        t.add('a')
43
44
        r1 = t.commit('a')
44
45
 
50
51
        store_inv = b.repository.get_inventory(r1)
51
52
        self.assertEqual([], store_inv._make_delta(basis_inv))
52
53
 
53
 
        with open('b', 'wb') as f: f.write(b'b\n')
 
54
        with open('b', 'wb') as f:
 
55
            f.write(b'b\n')
54
56
        t.add('b')
55
57
        r2 = t.commit('b')
56
58
 
57
59
        self.assertTrue(t._transport.has('basis-inventory-cache'))
58
60
 
59
61
        basis_inv_txt = t.read_basis_inventory()
60
 
        basis_inv = breezy.bzr.xml7.serializer_v7.read_inventory_from_string(basis_inv_txt)
 
62
        basis_inv = breezy.bzr.xml7.serializer_v7.read_inventory_from_string(
 
63
            basis_inv_txt)
61
64
        self.assertEqual(r2, basis_inv.revision_id)
62
65
        store_inv = b.repository.get_inventory(r2)
63
66
 
68
71
        # This test is not applicable to DirState based trees: the basis is
69
72
        # not separate and ignorable.
70
73
        if isinstance(self.workingtree_format,
71
 
            breezy.bzr.workingtree_4.DirStateWorkingTreeFormat):
 
74
                      breezy.bzr.workingtree_4.DirStateWorkingTreeFormat):
72
75
            raise TestNotApplicable("not applicable to %r"
73
 
                % (self.workingtree_format,))
 
76
                                    % (self.workingtree_format,))
74
77
        t = self.make_branch_and_tree('.')
75
78
        if getattr(t, 'root_inventory', None) is None:
76
79
            raise TestNotApplicable("not applicable to %r"
77
 
                % (self.workingtree_format,))
78
 
 
 
80
                                    % (self.workingtree_format,))
79
81
 
80
82
        b = t.branch
81
 
        with open('a', 'wb') as f: f.write(b'a\n')
 
83
        with open('a', 'wb') as f:
 
84
            f.write(b'a\n')
82
85
        t.add('a')
83
86
        t.commit('a')
84
87
        t._transport.put_bytes('basis-inventory-cache', b'booga')
88
91
        t._transport.put_bytes('basis-inventory-cache', b'<inventory />')
89
92
        t.basis_tree()
90
93
        t._transport.put_bytes('basis-inventory-cache',
91
 
            b'<inventory format="pi"/>')
 
94
                               b'<inventory format="pi"/>')
92
95
        t.basis_tree()