~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_workingtree_4.py

  • Committer: Martin Pool
  • Date: 2007-03-03 02:21:25 UTC
  • mto: (2255.2.180 subtree)
  • mto: This revision was merged to the branch mainline in revision 2322.
  • Revision ID: mbp@sourcefrog.net-20070303022125-m66a0pccahokfj2k
Add more dirstate root-id-changing tests

Show diffs side-by-side

added added

removed removed

Lines of Context:
434
434
        self.assertEqual('b', tree.id2path('b-id'))
435
435
        self.assertEqual(None, tree.id2path('c-id'))
436
436
 
 
437
    def test_set_root_id(self):
 
438
        # similar to some code that fails in the dirstate-plus-subtree branch
 
439
        # -- setting the root id while adding a parent seems to scramble the
 
440
        # dirstate invariants. -- mbp 20070303
 
441
        def validate():
 
442
            wt.lock_read()
 
443
            try:
 
444
                wt.current_dirstate()._validate()
 
445
            finally:
 
446
                wt.unlock()
 
447
        wt = self.make_workingtree('tree')
 
448
        wt.set_root_id('TREE-ROOTID')
 
449
        validate()
 
450
        wt.commit('somenthing')
 
451
        validate()
 
452
        # now switch and commit again
 
453
        wt.set_root_id('tree-rootid')
 
454
        validate()
 
455
        wt.commit('again')
 
456
        validate()