649
def test_save_refuses_if_changes_aborted(self):
650
self.build_tree(['a-file', 'a-dir/'])
651
state = dirstate.DirState.initialize('dirstate')
653
# No stat and no sha1 sum.
654
state.add('a-file', 'a-file-id', 'file', None, '')
659
# The dirstate should include TREE_ROOT and 'a-file' and nothing else
661
('', [(('', '', 'TREE_ROOT'),
662
[('d', '', 0, False, dirstate.DirState.NULLSTAT)])]),
663
('', [(('', 'a-file', 'a-file-id'),
664
[('f', '', 0, False, dirstate.DirState.NULLSTAT)])]),
667
state = dirstate.DirState.on_file('dirstate')
670
state._read_dirblocks_if_needed()
671
self.assertEqual(expected_blocks, state._dirblocks)
673
# Now modify the state, but mark it as inconsistent
674
state.add('a-dir', 'a-dir-id', 'directory', None, '')
675
state._changes_aborted = True
680
state = dirstate.DirState.on_file('dirstate')
683
state._read_dirblocks_if_needed()
684
self.assertEqual(expected_blocks, state._dirblocks)
689
650
class TestDirStateInitialize(TestCaseWithDirState):