/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to breezy/tests/test_workingtree_4.py

  • Committer: Jelmer Vernooij
  • Date: 2019-08-11 13:33:45 UTC
  • mfrom: (7379 work)
  • mto: This revision was merged to the branch mainline in revision 7389.
  • Revision ID: jelmer@jelmer.uk-20190811133345-dp9j3c569vxj4l9y
merge trunk.

Show diffs side-by-side

added added

removed removed

Lines of Context:
538
538
                                          format=format_name)
539
539
        tree2 = self.make_branch_and_tree('tree2',
540
540
                                          format=format_name)
541
 
        self.assertNotEqual(tree1.get_root_id(), tree2.get_root_id())
 
541
        self.assertNotEqual(tree1.path2id(''), tree2.path2id(''))
542
542
        # when you branch, it inherits the same root id
543
543
        tree1.commit('first post')
544
544
        tree3 = tree1.controldir.sprout('tree3').open_workingtree()
545
 
        self.assertEqual(tree3.get_root_id(), tree1.get_root_id())
 
545
        self.assertEqual(tree3.path2id(''), tree1.path2id(''))
546
546
 
547
547
    def test_set_root_id(self):
548
548
        # similar to some code that fails in the dirstate-plus-subtree branch
549
549
        # -- setting the root id while adding a parent seems to scramble the
550
550
        # dirstate invariants. -- mbp 20070303
551
551
        def validate():
552
 
            wt.lock_read()
553
 
            try:
 
552
            with wt.lock_read():
554
553
                wt.current_dirstate()._validate()
555
 
            finally:
556
 
                wt.unlock()
557
554
        wt = self.make_workingtree('tree')
558
555
        wt.set_root_id(b'TREE-ROOTID')
559
556
        validate()
567
564
 
568
565
    def test_default_root_id(self):
569
566
        tree = self.make_branch_and_tree('tag', format='dirstate-tags')
570
 
        self.assertEqual(inventory.ROOT_ID, tree.get_root_id())
 
567
        self.assertEqual(inventory.ROOT_ID, tree.path2id(''))
571
568
        tree = self.make_branch_and_tree('subtree',
572
569
                                         format='development-subtree')
573
 
        self.assertNotEqual(inventory.ROOT_ID, tree.get_root_id())
 
570
        self.assertNotEqual(inventory.ROOT_ID, tree.path2id(''))
574
571
 
575
572
    def test_non_subtree_with_nested_trees(self):
576
573
        # prior to dirstate, st/diff/commit ignored nested trees.