~ubuntu-branches/ubuntu/maverick/bzr/maverick-proposed

« back to all changes in this revision

Viewing changes to bzrlib/tests/per_tree/test_path_content_summary.py

  • Committer: Bazaar Package Importer
  • Author(s): Jelmer Vernooij
  • Date: 2010-02-17 17:47:40 UTC
  • mfrom: (1.4.5 upstream) (9.2.2 experimental)
  • Revision ID: james.westby@ubuntu.com-20100217174740-35yh6t5rjnztg9z6
Tags: 2.1.0-1
New upstream release.

Show diffs side-by-side

added added

removed removed

Lines of Context:
21
21
from bzrlib import (
22
22
    osutils,
23
23
    tests,
 
24
    transform,
24
25
    )
25
26
 
26
27
from bzrlib.tests import per_tree
78
79
        self.assertEqual(('missing', None, None, None), summary)
79
80
 
80
81
    def test_file_content_summary_executable(self):
81
 
        if not osutils.supports_executable():
82
 
            raise tests.TestNotApplicable()
83
82
        tree = self.make_branch_and_tree('tree')
84
83
        self.build_tree(['tree/path'])
85
84
        tree.add(['path'])
86
 
        current_mode = os.stat('tree/path').st_mode
87
 
        os.chmod('tree/path', current_mode | 0100)
 
85
        tt = transform.TreeTransform(tree)
 
86
        self.addCleanup(tt.finalize)
 
87
        tt.set_executability(True, tt.trans_id_tree_path('path'))
 
88
        tt.apply()
88
89
        summary = self._convert_tree(tree).path_content_summary('path')
89
90
        self.assertEqual(4, len(summary))
90
91
        self.assertEqual('file', summary[0])
95
96
        self.assertSubset((summary[3],),
96
97
            (None, '0c352290ae1c26ca7f97d5b2906c4624784abd60'))
97
98
 
 
99
    def test_file_content_summary_not_versioned(self):
 
100
        tree = self.make_branch_and_tree('tree')
 
101
        self.build_tree(['tree/path'])
 
102
        tree = self._convert_tree(tree)
 
103
        summary = tree.path_content_summary('path')
 
104
        self.assertEqual(4, len(summary))
 
105
        if isinstance(tree, (per_tree.DirStateRevisionTree,
 
106
                             per_tree.RevisionTree)):
 
107
            self.assertEqual('missing', summary[0])
 
108
            self.assertIs(None, summary[2])
 
109
            self.assertIs(None, summary[3])
 
110
        elif isinstance(tree, transform._PreviewTree):
 
111
            self.expectFailure('PreviewTree returns "missing" for unversioned'
 
112
                'files', self.assertEqual, 'file', summary[0])
 
113
            self.assertEqual('file', summary[0])
 
114
        else:
 
115
            self.assertEqual('file', summary[0])
 
116
            self.check_content_summary_size(tree, summary, 22)
 
117
            self.assertEqual(False, summary[2])
 
118
        self.assertSubset((summary[3],),
 
119
            (None, '0c352290ae1c26ca7f97d5b2906c4624784abd60'))
 
120
 
98
121
    def test_file_content_summary_non_exec(self):
99
122
        tree = self.make_branch_and_tree('tree')
100
123
        self.build_tree(['tree/path'])