/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/per_tree/test_path_content_summary.py

  • Committer: Aaron Bentley
  • Date: 2009-09-29 04:40:55 UTC
  • mfrom: (4717 +trunk)
  • mto: This revision was merged to the branch mainline in revision 4718.
  • Revision ID: aaron@aaronbentley.com-20090929044055-e9jtpmz6eyut711h
Merged bzr.dev into fix_get_mtime.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2007 Canonical Ltd
 
1
# Copyright (C) 2007, 2009 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
34
34
        self.addCleanup(result.unlock)
35
35
        return result
36
36
 
 
37
    def check_content_summary_size(self, tree, summary, expected_size):
 
38
        # if the tree supports content filters, then it's allowed to leave out
 
39
        # the size because it might be difficult to compute.  otherwise, it
 
40
        # must be present and correct
 
41
        returned_size = summary[1]
 
42
        if returned_size == expected_size or (
 
43
            tree.supports_content_filtering()
 
44
            and returned_size is None):
 
45
            pass
 
46
        else:
 
47
            self.fail("invalid size in summary: %r" % (returned_size,))
 
48
 
37
49
    def test_symlink_content_summary(self):
38
50
        self.requireFeature(tests.SymlinkFeature)
39
51
        tree = self.make_branch_and_tree('tree')
76
88
        summary = self._convert_tree(tree).path_content_summary('path')
77
89
        self.assertEqual(4, len(summary))
78
90
        self.assertEqual('file', summary[0])
79
 
        # size must be known
80
 
        self.assertEqual(22, summary[1])
 
91
        self.check_content_summary_size(tree, summary, 22)
81
92
        # executable
82
93
        self.assertEqual(True, summary[2])
83
94
        # may have hash,
91
102
        summary = self._convert_tree(tree).path_content_summary('path')
92
103
        self.assertEqual(4, len(summary))
93
104
        self.assertEqual('file', summary[0])
94
 
        # size must be known
95
 
        self.assertEqual(22, summary[1])
 
105
        self.check_content_summary_size(tree, summary, 22)
96
106
        # not executable
97
107
        if osutils.supports_executable:
98
108
            self.assertEqual(False, summary[2])