~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_dirstate.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2008-02-06 16:38:04 UTC
  • mfrom: (3207.1.2 jam-integration)
  • Revision ID: pqm@pqm.ubuntu.com-20080206163804-6zyjbbfpsm8txfdm
(Lukas) give a better error when using version-info --custom without
        --template

Show diffs side-by-side

added added

removed removed

Lines of Context:
646
646
        finally:
647
647
            state.unlock()
648
648
 
649
 
    def test_save_refuses_if_changes_aborted(self):
650
 
        self.build_tree(['a-file', 'a-dir/'])
651
 
        state = dirstate.DirState.initialize('dirstate')
652
 
        try:
653
 
            # No stat and no sha1 sum.
654
 
            state.add('a-file', 'a-file-id', 'file', None, '')
655
 
            state.save()
656
 
        finally:
657
 
            state.unlock()
658
 
 
659
 
        # The dirstate should include TREE_ROOT and 'a-file' and nothing else
660
 
        expected_blocks = [
661
 
            ('', [(('', '', 'TREE_ROOT'),
662
 
                   [('d', '', 0, False, dirstate.DirState.NULLSTAT)])]),
663
 
            ('', [(('', 'a-file', 'a-file-id'),
664
 
                   [('f', '', 0, False, dirstate.DirState.NULLSTAT)])]),
665
 
        ]
666
 
 
667
 
        state = dirstate.DirState.on_file('dirstate')
668
 
        state.lock_write()
669
 
        try:
670
 
            state._read_dirblocks_if_needed()
671
 
            self.assertEqual(expected_blocks, state._dirblocks)
672
 
 
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
676
 
            state.save()
677
 
        finally:
678
 
            state.unlock()
679
 
 
680
 
        state = dirstate.DirState.on_file('dirstate')
681
 
        state.lock_read()
682
 
        try:
683
 
            state._read_dirblocks_if_needed()
684
 
            self.assertEqual(expected_blocks, state._dirblocks)
685
 
        finally:
686
 
            state.unlock()
687
 
 
688
649
 
689
650
class TestDirStateInitialize(TestCaseWithDirState):
690
651