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

  • Committer: Aaron Bentley
  • Date: 2008-10-28 10:43:48 UTC
  • mfrom: (0.15.43 unshelve)
  • mto: (0.16.95 shelf-ui)
  • mto: This revision was merged to the branch mainline in revision 3820.
  • Revision ID: aaron@aaronbentley.com-20081028104348-buezeiob2p7xj6i1
merge unshelve into shelf-manager

Show diffs side-by-side

added added

removed removed

Lines of Context:
163
163
        finally:
164
164
            tree.unlock()
165
165
 
 
166
    def test_get_file_text(self):
 
167
        work_tree = self.make_branch_and_tree('wt')
 
168
        tree = self.get_tree_no_parents_abc_content_2(work_tree)
 
169
        tree.lock_read()
 
170
        self.addCleanup(tree.unlock)
 
171
        # test read by file-id
 
172
        self.assertEqual('foobar\n', tree.get_file_text('a-id'))
 
173
        # test read by path
 
174
        self.assertEqual('foobar\n', tree.get_file_text('a-id', path='a'))
 
175
 
 
176
    def test_get_file_lines(self):
 
177
        work_tree = self.make_branch_and_tree('wt')
 
178
        tree = self.get_tree_no_parents_abc_content_2(work_tree)
 
179
        tree.lock_read()
 
180
        self.addCleanup(tree.unlock)
 
181
        # test read by file-id
 
182
        self.assertEqual(['foobar\n'], tree.get_file_lines('a-id'))
 
183
        # test read by path
 
184
        self.assertEqual(['foobar\n'], tree.get_file_lines('a-id', path='a'))
 
185
 
 
186
    def test_get_file_lines_multi_line_breaks(self):
 
187
        work_tree = self.make_branch_and_tree('wt')
 
188
        self.build_tree_contents([('wt/foobar', 'a\rb\nc\r\nd')])
 
189
        work_tree.add('foobar', 'foobar-id')
 
190
        tree = self._convert_tree(work_tree)
 
191
        tree.lock_read()
 
192
        self.addCleanup(tree.unlock)
 
193
        self.assertEqual(['a\rb\n', 'c\r\n', 'd'],
 
194
                         tree.get_file_lines('foobar-id'))
 
195
 
166
196
 
167
197
class TestExtractFilesBytes(TestCaseWithTree):
168
198