/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_tree/test_tree.py

  • Committer: Jelmer Vernooij
  • Date: 2018-11-16 18:35:30 UTC
  • mfrom: (7143.15.15 more-cleanups)
  • mto: This revision was merged to the branch mainline in revision 7178.
  • Revision ID: jelmer@jelmer.uk-20181116183530-ue8yx60h5tinl2wy
Merge more-cleanups.

Show diffs side-by-side

added added

removed removed

Lines of Context:
179
179
            self.assertEqual([b'foobar\n'], lines)
180
180
        finally:
181
181
            file_without_path.close()
182
 
        # Test lookup with path works
183
 
        file_with_path = tree.get_file('a', a_id)
184
 
        try:
185
 
            lines = file_with_path.readlines()
186
 
            self.assertEqual([b'foobar\n'], lines)
187
 
        finally:
188
 
            file_with_path.close()
189
182
 
190
183
    def test_get_file_context_manager(self):
191
184
        work_tree = self.make_branch_and_tree('wt')
202
195
        a_id = tree.path2id('a')
203
196
        tree.lock_read()
204
197
        self.addCleanup(tree.unlock)
205
 
        # test read by file-id
206
 
        self.assertEqual(b'foobar\n', tree.get_file_text('a', a_id))
207
198
        # test read by path
208
199
        self.assertEqual(b'foobar\n', tree.get_file_text('a'))
209
200
 
213
204
        a_id = tree.path2id('a')
214
205
        tree.lock_read()
215
206
        self.addCleanup(tree.unlock)
216
 
        # test read by file-id
217
 
        self.assertEqual([b'foobar\n'], tree.get_file_lines('a', a_id))
218
207
        # test read by path
219
208
        self.assertEqual([b'foobar\n'], tree.get_file_lines('a'))
220
209
 
280
269
        self.build_tree(['a/', 'a/b/', 'a/b/c', 'a/d/', 'a/d/e', 'f/', 'f/g'])
281
270
        work_tree.add(['a', 'a/b', 'a/b/c', 'a/d', 'a/d/e', 'f', 'f/g'])
282
271
        tree = self._convert_tree(work_tree)
283
 
        output = [e.name for e in
284
 
                  tree.iter_child_entries('', tree.get_root_id())]
 
272
        output = [e.name for e in tree.iter_child_entries('')]
285
273
        self.assertEqual({'a', 'f'}, set(output))
286
 
        output = [e.name for e in
287
 
                  tree.iter_child_entries('a', tree.path2id('a'))]
 
274
        output = [e.name for e in tree.iter_child_entries('a')]
288
275
        self.assertEqual({'b', 'd'}, set(output))
289
276
 
290
277
    def test_does_not_exist(self):