/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/per_workingtree/test_workingtree.py

  • Committer: Breezy landing bot
  • Author(s): Jelmer Vernooij
  • Date: 2017-06-10 18:39:27 UTC
  • mfrom: (6653.6.7 rename-controldir)
  • Revision ID: breezy.the.bot@gmail.com-20170610183927-8yn4wmsk1ki92xc3
Rename ``bzrdir`` attribute to ``controldir``.

Merged from https://code.launchpad.net/~jelmer/brz/rename-controldir/+merge/325433

Show diffs side-by-side

added added

removed removed

Lines of Context:
65
65
        test_branch = self.make_branch('test-branch')
66
66
        try:
67
67
            # if there is a working tree now, this is not supported.
68
 
            test_branch.bzrdir.open_workingtree()
 
68
            test_branch.controldir.open_workingtree()
69
69
            raise TestNotApplicable("only on trees that can be separate"
70
70
                " from their branch.")
71
71
        except (errors.NoWorkingTree, errors.NotLocalUrl):
143
143
 
144
144
    def test_open_containing(self):
145
145
        local_wt = self.make_branch_and_tree('.')
146
 
        local_url = local_wt.bzrdir.root_transport.base
 
146
        local_url = local_wt.controldir.root_transport.base
147
147
        local_base = urlutils.local_path_from_url(local_url)
148
148
        del local_wt
149
149
 
332
332
 
333
333
    def test_clone_trivial(self):
334
334
        wt = self.make_branch_and_tree('source')
335
 
        cloned_dir = wt.bzrdir.clone('target')
 
335
        cloned_dir = wt.controldir.clone('target')
336
336
        cloned = cloned_dir.open_workingtree()
337
337
        self.assertEqual(cloned.get_parent_ids(), wt.get_parent_ids())
338
338
 
339
339
    def test_clone_empty(self):
340
340
        wt = self.make_branch_and_tree('source')
341
 
        cloned_dir = wt.bzrdir.clone('target', revision_id=_mod_revision.NULL_REVISION)
 
341
        cloned_dir = wt.controldir.clone('target', revision_id=_mod_revision.NULL_REVISION)
342
342
        cloned = cloned_dir.open_workingtree()
343
343
        self.assertEqual(cloned.get_parent_ids(), wt.get_parent_ids())
344
344
 
396
396
    def test_clone_and_commit_preserves_last_revision(self):
397
397
        """Doing a commit into a clone tree does not affect the source."""
398
398
        wt = self.make_branch_and_tree('source')
399
 
        cloned_dir = wt.bzrdir.clone('target')
 
399
        cloned_dir = wt.controldir.clone('target')
400
400
        wt.commit('A', allow_pointless=True, rev_id='A')
401
401
        self.assertNotEqual(cloned_dir.open_workingtree().get_parent_ids(),
402
402
                            wt.get_parent_ids())
404
404
    def test_clone_preserves_content(self):
405
405
        wt = self.make_branch_and_tree('source')
406
406
        self.build_tree(['added', 'deleted', 'notadded'],
407
 
                        transport=wt.bzrdir.transport.clone('..'))
 
407
                        transport=wt.controldir.transport.clone('..'))
408
408
        wt.add('deleted', 'deleted')
409
409
        wt.commit('add deleted')
410
410
        wt.remove('deleted')
411
411
        wt.add('added', 'added')
412
 
        cloned_dir = wt.bzrdir.clone('target')
 
412
        cloned_dir = wt.controldir.clone('target')
413
413
        cloned = cloned_dir.open_workingtree()
414
 
        cloned_transport = cloned.bzrdir.transport.clone('..')
 
414
        cloned_transport = cloned.controldir.transport.clone('..')
415
415
        self.assertFalse(cloned_transport.has('deleted'))
416
416
        self.assertTrue(cloned_transport.has('added'))
417
417
        self.assertFalse(cloned_transport.has('notadded'))
577
577
        self.build_tree_contents([('b1/a', 'a test\n'), ('b1/b', 'b test\n')])
578
578
        this.add(['a', 'b'])
579
579
        this.commit(message='')
580
 
        base = this.bzrdir.clone('b2').open_workingtree()
 
580
        base = this.controldir.clone('b2').open_workingtree()
581
581
        self.build_tree_contents([('b2/a', 'b test\n')])
582
 
        other = this.bzrdir.clone('b3').open_workingtree()
 
582
        other = this.controldir.clone('b3').open_workingtree()
583
583
        self.build_tree_contents([('b3/a', 'c test\n'), ('b3/c', 'c test\n')])
584
584
        other.add('c')
585
585
 
968
968
            raise TestNotApplicable("get_format_string is only available "
969
969
                                    "on bzr working trees")
970
970
        # now we cheat, and make a file that matches the case-sensitive name
971
 
        t = tree.bzrdir.get_workingtree_transport(None)
 
971
        t = tree.controldir.get_workingtree_transport(None)
972
972
        try:
973
973
            content = tree._format.get_format_string()
974
974
        except NotImplementedError:
975
975
            # All-in-one formats didn't have a separate format string.
976
 
            content = tree.bzrdir._format.get_format_string()
 
976
            content = tree.controldir._format.get_format_string()
977
977
        t.put_bytes(tree._format.case_sensitive_filename, content)
978
 
        tree = tree.bzrdir.open_workingtree()
 
978
        tree = tree.controldir.open_workingtree()
979
979
        self.assertFalse(tree.case_sensitive)
980
980
 
981
981
    def test_supports_executable(self):
1022
1022
            # or may not raise an exception.  But if it does, it must be
1023
1023
            # HardLinkNotSupported
1024
1024
            try:
1025
 
                source.bzrdir.sprout('target', accelerator_tree=source,
 
1025
                source.controldir.sprout('target', accelerator_tree=source,
1026
1026
                                     hardlink=True)
1027
1027
            except errors.HardLinkNotSupported:
1028
1028
                pass
1077
1077
            branch_revid = master_revid
1078
1078
        final_branch = builder.get_branch()
1079
1079
        # The master branch
1080
 
        master = final_branch.bzrdir.sprout(master_path,
 
1080
        master = final_branch.controldir.sprout(master_path,
1081
1081
                                            master_revid).open_branch()
1082
1082
        # The checkout
1083
1083
        wt = self.make_branch_and_tree(wt_path)