~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_bundle.py

  • Committer: Patch Queue Manager
  • Date: 2012-01-27 14:28:32 UTC
  • mfrom: (6445.2.6 avoid-inventory)
  • Revision ID: pqm@pqm.ubuntu.com-20120127142832-qcv2y1c3i0mbt9bl
(jelmer) Avoid the use of inventories in a few more places. (Jelmer Vernooij)

Show diffs side-by-side

added added

removed removed

Lines of Context:
76
76
 
77
77
    inventory = property(lambda x:x)
78
78
 
 
79
    def get_root_id(self):
 
80
        return self.root.file_id
 
81
 
79
82
    def all_file_ids(self):
80
83
        return set(self.paths.keys())
81
84
 
 
85
    def is_executable(self, file_id):
 
86
        # Not all the files are executable.
 
87
        return False
 
88
 
82
89
    def __getitem__(self, file_id):
83
90
        if file_id == self.root.file_id:
84
91
            return self.root
95
102
        for path, file_id in self.ids.iteritems():
96
103
            yield path, self[file_id]
97
104
 
98
 
    def get_file_kind(self, file_id):
 
105
    def kind(self, file_id):
99
106
        if file_id in self.contents:
100
107
            kind = 'file'
101
108
        else:
106
113
        from bzrlib.inventory import (InventoryEntry, InventoryFile
107
114
                                    , InventoryDirectory, InventoryLink)
108
115
        name = os.path.basename(path)
109
 
        kind = self.get_file_kind(file_id)
 
116
        kind = self.kind(file_id)
110
117
        parent_id = self.parent_id(file_id)
111
118
        text_sha_1, text_size = self.contents_stats(file_id)
112
119
        if kind == 'directory':
945
952
        self.tree1.commit('message', rev_id='revid1')
946
953
        bundle = self.get_valid_bundle('null:', 'revid1')
947
954
        tree = self.get_bundle_tree(bundle, 'revid1')
948
 
        self.assertEqual('revid1', tree.inventory.root.revision)
 
955
        root_revision = tree.get_file_revision(tree.get_root_id())
 
956
        self.assertEqual('revid1', root_revision)
949
957
 
950
958
    def test_install_revisions(self):
951
959
        self.tree1 = self.make_branch_and_tree('b1')