~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: 2008-10-16 21:31:35 UTC
  • mfrom: (3363.19.4 fix-iter-changes)
  • Revision ID: pqm@pqm.ubuntu.com-20081016213135-0115pw9c95l2dyxq
PreviewTree.iter_changes accepts all standard parameters (abentley)

Show diffs side-by-side

added added

removed removed

Lines of Context:
2013
2013
        resolve_conflicts(tt)
2014
2014
 
2015
2015
 
 
2016
A_ENTRY = ('a-id', ('a', 'a'), True, (True, True),
 
2017
                  ('TREE_ROOT', 'TREE_ROOT'), ('a', 'a'), ('file', 'file'),
 
2018
                  (False, False))
 
2019
ROOT_ENTRY = ('TREE_ROOT', ('', ''), False, (True, True), (None, None),
 
2020
              ('', ''), ('directory', 'directory'), (False, None))
 
2021
 
 
2022
 
2016
2023
class TestTransformPreview(tests.TestCaseWithTransport):
2017
2024
 
2018
2025
    def create_tree(self):
2090
2097
                          (False, False))],
2091
2098
                          list(preview_tree.iter_changes(revision_tree)))
2092
2099
 
2093
 
    def test_include_unchanged_value_error(self):
 
2100
    def test_include_unchanged_succeeds(self):
2094
2101
        revision_tree, preview_tree = self.get_tree_and_preview_tree()
2095
 
        e = self.assertRaises(ValueError, preview_tree.iter_changes,
2096
 
                              revision_tree, include_unchanged=True)
2097
 
        self.assertEqual('include_unchanged is not supported', str(e))
 
2102
        changes = preview_tree.iter_changes(revision_tree,
 
2103
                                            include_unchanged=True)
 
2104
        root = revision_tree.inventory.root.file_id
 
2105
 
 
2106
        self.assertEqual([ROOT_ENTRY, A_ENTRY], list(changes))
2098
2107
 
2099
2108
    def test_specific_files(self):
2100
2109
        revision_tree, preview_tree = self.get_tree_and_preview_tree()
2101
 
        e = self.assertRaises(ValueError, preview_tree.iter_changes,
2102
 
                              revision_tree, specific_files=['pete'])
2103
 
        self.assertEqual('specific_files is not supported', str(e))
 
2110
        changes = preview_tree.iter_changes(revision_tree,
 
2111
                                            specific_files=[''])
 
2112
        self.assertEqual([ROOT_ENTRY, A_ENTRY], list(changes))
2104
2113
 
2105
 
    def test_want_unversioned_value_error(self):
 
2114
    def test_want_unversioned(self):
2106
2115
        revision_tree, preview_tree = self.get_tree_and_preview_tree()
2107
 
        e = self.assertRaises(ValueError, preview_tree.iter_changes,
2108
 
                              revision_tree, want_unversioned=True)
2109
 
        self.assertEqual('want_unversioned is not supported', str(e))
 
2116
        changes = preview_tree.iter_changes(revision_tree,
 
2117
                                            want_unversioned=True)
 
2118
        self.assertEqual([ROOT_ENTRY, A_ENTRY], list(changes))
2110
2119
 
2111
2120
    def test_ignore_extra_trees_no_specific_files(self):
2112
2121
        # extra_trees is harmless without specific_files, so we'll silently