~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

  • Committer: John Arbash Meinel
  • Date: 2010-02-17 17:11:16 UTC
  • mfrom: (4797.2.17 2.1)
  • mto: (4797.2.18 2.1)
  • mto: This revision was merged to the branch mainline in revision 5055.
  • Revision ID: john@arbash-meinel.com-20100217171116-h7t9223ystbnx5h8
merge bzr.2.1 in preparation for NEWS entry.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2007, 2009 Canonical Ltd
 
1
# Copyright (C) 2007, 2009, 2010 Canonical Ltd
2
2
#
3
3
# This program is free software; you can redistribute it and/or modify
4
4
# it under the terms of the GNU General Public License as published by
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'])