~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_dirstate.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:
64
64
    def setUp(self):
65
65
        tests.TestCaseWithTransport.setUp(self)
66
66
 
67
 
        self.overrideAttr(osutils,
68
 
                          '_selected_dir_reader', self._dir_reader_class())
 
67
        # Save platform specific info and reset it
 
68
        cur_dir_reader = osutils._selected_dir_reader
 
69
 
 
70
        def restore():
 
71
            osutils._selected_dir_reader = cur_dir_reader
 
72
        self.addCleanup(restore)
 
73
 
 
74
        osutils._selected_dir_reader = self._dir_reader_class()
69
75
 
70
76
    def create_empty_dirstate(self):
71
77
        """Return a locked but empty dirstate"""
730
736
 
731
737
class TestDirStateManipulations(TestCaseWithDirState):
732
738
 
733
 
    def test_update_minimal_updates_id_index(self):
734
 
        state = self.create_dirstate_with_root_and_subdir()
735
 
        self.addCleanup(state.unlock)
736
 
        id_index = state._get_id_index()
737
 
        self.assertEqual(['a-root-value', 'subdir-id'], sorted(id_index))
738
 
        state.add('file-name', 'file-id', 'file', None, '')
739
 
        self.assertEqual(['a-root-value', 'file-id', 'subdir-id'],
740
 
                         sorted(id_index))
741
 
        state.update_minimal(('', 'new-name', 'file-id'), 'f',
742
 
                             path_utf8='new-name')
743
 
        self.assertEqual(['a-root-value', 'file-id', 'subdir-id'],
744
 
                         sorted(id_index))
745
 
        self.assertEqual([('', 'new-name', 'file-id')],
746
 
                         sorted(id_index['file-id']))
747
 
        state._validate()
748
 
 
749
739
    def test_set_state_from_inventory_no_content_no_parents(self):
750
740
        # setting the current inventory is a slow but important api to support.
751
741
        tree1 = self.make_branch_and_memory_tree('tree1')