~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_transform.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2011-05-05 19:22:33 UTC
  • mfrom: (5832.1.1 trunk)
  • Revision ID: pqm@pqm.ubuntu.com-20110505192233-6916128few7exzsh
(vila) Enable exporting all Tree types. (Aaron Bentley)

Show diffs side-by-side

added added

removed removed

Lines of Context:
2651
2651
        preview_mtime = preview_tree.get_file_mtime('file-id', 'renamed')
2652
2652
        work_mtime = work_tree.get_file_mtime('file-id', 'file')
2653
2653
 
 
2654
    def test_get_file_size(self):
 
2655
        work_tree = self.make_branch_and_tree('tree')
 
2656
        self.build_tree_contents([('tree/old', 'old')])
 
2657
        work_tree.add('old', 'old-id')
 
2658
        preview = TransformPreview(work_tree)
 
2659
        self.addCleanup(preview.finalize)
 
2660
        new_id = preview.new_file('name', preview.root, 'contents', 'new-id',
 
2661
                                  'executable')
 
2662
        tree = preview.get_preview_tree()
 
2663
        self.assertEqual(len('old'), tree.get_file_size('old-id'))
 
2664
        self.assertEqual(len('contents'), tree.get_file_size('new-id'))
 
2665
 
2654
2666
    def test_get_file(self):
2655
2667
        preview = self.get_empty_preview()
2656
2668
        preview.new_file('file', preview.root, 'contents', 'file-id')
3068
3080
        merger.merge_type = Merge3Merger
3069
3081
        merger.do_merge()
3070
3082
 
 
3083
    def test_has_filename(self):
 
3084
        wt = self.make_branch_and_tree('tree')
 
3085
        self.build_tree(['tree/unmodified', 'tree/removed', 'tree/modified'])
 
3086
        tt = TransformPreview(wt)
 
3087
        removed_id = tt.trans_id_tree_path('removed')
 
3088
        tt.delete_contents(removed_id)
 
3089
        tt.new_file('new', tt.root, 'contents')
 
3090
        modified_id = tt.trans_id_tree_path('modified')
 
3091
        tt.delete_contents(modified_id)
 
3092
        tt.create_file('modified-contents', modified_id)
 
3093
        self.addCleanup(tt.finalize)
 
3094
        tree = tt.get_preview_tree()
 
3095
        self.assertTrue(tree.has_filename('unmodified'))
 
3096
        self.assertFalse(tree.has_filename('not-present'))
 
3097
        self.assertFalse(tree.has_filename('removed'))
 
3098
        self.assertTrue(tree.has_filename('new'))
 
3099
        self.assertTrue(tree.has_filename('modified'))
 
3100
 
3071
3101
    def test_is_executable(self):
3072
3102
        tree = self.make_branch_and_tree('tree')
3073
3103
        preview = TransformPreview(tree)