/breezy/unstable

To get this branch, use:
bzr branch https://code.breezy-vcs.org/breezy/unstable

« back to all changes in this revision

Viewing changes to breezy/tests/per_controldir/test_controldir.py

  • Committer: Jelmer Vernooij
  • Date: 2017-05-24 01:39:33 UTC
  • mfrom: (3815.3776.6)
  • Revision ID: jelmer@jelmer.uk-20170524013933-ir4y4tqtrsiz2ka2
New upstream snapshot.

Show diffs side-by-side

added added

removed removed

Lines of Context:
18
18
 
19
19
from itertools import izip
20
20
 
21
 
import bzrlib.branch
22
 
from bzrlib import (
 
21
import breezy.branch
 
22
from breezy import (
23
23
    bzrdir as _mod_bzrdir,
24
24
    check,
25
25
    controldir,
32
32
    urlutils,
33
33
    workingtree,
34
34
    )
35
 
from bzrlib.tests import (
 
35
from breezy.tests import (
36
36
    fixtures,
37
37
    ChrootedTestCase,
38
38
    TestNotApplicable,
39
39
    TestSkipped,
40
40
    )
41
 
from bzrlib.tests.per_controldir import TestCaseWithControlDir
42
 
from bzrlib.transport.local import LocalTransport
43
 
from bzrlib.ui import (
 
41
from breezy.tests.per_controldir import TestCaseWithControlDir
 
42
from breezy.transport.local import LocalTransport
 
43
from breezy.ui import (
44
44
    CannedInputUIFactory,
45
45
    )
46
 
from bzrlib.remote import (
 
46
from breezy.remote import (
47
47
    RemoteBzrDir,
48
48
    RemoteBzrDirFormat,
49
49
    RemoteRepository,
304
304
 
305
305
    def test_clone_bzrdir_branch_and_repo_fixed_user_id(self):
306
306
        # Bug #430868 is about an email containing '.sig'
307
 
        self.overrideEnv('BZR_EMAIL', 'murphy@host.sighup.org')
 
307
        self.overrideEnv('BRZ_EMAIL', 'murphy@host.sighup.org')
308
308
        tree = self.make_branch_and_tree('commit_tree')
309
309
        self.build_tree(['commit_tree/foo'])
310
310
        tree.add('foo')
371
371
            format = None
372
372
        source_branch = self.make_branch('source', format=format)
373
373
        # Ensure no format data is cached
374
 
        a_dir = bzrlib.branch.Branch.open_from_transport(
 
374
        a_dir = breezy.branch.Branch.open_from_transport(
375
375
            self.get_transport('source')).bzrdir
376
376
        target_transport = self.get_transport('target')
377
377
        target_bzrdir = a_dir.clone_on_transport(target_transport)
378
378
        target_repo = target_bzrdir.open_repository()
379
 
        source_branch = bzrlib.branch.Branch.open(
 
379
        source_branch = breezy.branch.Branch.open(
380
380
            self.get_vfs_only_url('source'))
381
381
        if isinstance(target_repo, RemoteRepository):
382
382
            target_repo._ensure_real()
1194
1194
        made_control = self.bzrdir_format.initialize(t.base)
1195
1195
        made_repo = made_control.create_repository()
1196
1196
        made_branch = made_control.create_branch()
1197
 
        self.assertIsInstance(made_branch, bzrlib.branch.Branch)
 
1197
        self.assertIsInstance(made_branch, breezy.branch.Branch)
1198
1198
        self.assertEqual(made_control, made_branch.bzrdir)
1199
1199
 
1200
1200
    def test_create_branch_append_revisions_only(self):
1213
1213
        except errors.UpgradeRequired:
1214
1214
            raise TestNotApplicable("format does not support "
1215
1215
                "append_revisions_only setting")
1216
 
        self.assertIsInstance(made_branch, bzrlib.branch.Branch)
 
1216
        self.assertIsInstance(made_branch, breezy.branch.Branch)
1217
1217
        self.assertEqual(True, made_branch.get_append_revisions_only())
1218
1218
        self.assertEqual(made_control, made_branch.bzrdir)
1219
1219
 
1618
1618
            raise TestNotApplicable("format does not physically lock")
1619
1619
        # only one yes needed here: it should only be unlocking
1620
1620
        # the repo
1621
 
        bzrlib.ui.ui_factory = CannedInputUIFactory([True])
 
1621
        breezy.ui.ui_factory = CannedInputUIFactory([True])
1622
1622
        try:
1623
1623
            repo.bzrdir.break_lock()
1624
1624
        except NotImplementedError:
1649
1649
            # two yes's : branch and repository. If the repo in this
1650
1650
            # dir is inappropriately accessed, 3 will be needed, and
1651
1651
            # we'll see that because the stream will be fully consumed
1652
 
            bzrlib.ui.ui_factory = CannedInputUIFactory([True, True, True])
 
1652
            breezy.ui.ui_factory = CannedInputUIFactory([True, True, True])
1653
1653
            # determine if the repository will have been locked;
1654
1654
            this_repo_locked = \
1655
1655
                thisdir.open_repository().get_physical_lock_status()
1657
1657
            if this_repo_locked:
1658
1658
                # only two ys should have been read
1659
1659
                self.assertEqual([True],
1660
 
                    bzrlib.ui.ui_factory.responses)
 
1660
                    breezy.ui.ui_factory.responses)
1661
1661
            else:
1662
1662
                # only one y should have been read
1663
1663
                self.assertEqual([True, True],
1664
 
                    bzrlib.ui.ui_factory.responses)
 
1664
                    breezy.ui.ui_factory.responses)
1665
1665
            # we should be able to lock a newly opened branch now
1666
1666
            branch = master.bzrdir.open_branch()
1667
1667
            branch.lock_write()
1685
1685
        tree = self.make_branch_and_tree('.')
1686
1686
        tree.lock_write()
1687
1687
        # three yes's : tree, branch and repository.
1688
 
        bzrlib.ui.ui_factory = CannedInputUIFactory([True, True, True])
 
1688
        breezy.ui.ui_factory = CannedInputUIFactory([True, True, True])
1689
1689
        try:
1690
1690
            tree.bzrdir.break_lock()
1691
1691
        except (NotImplementedError, errors.LockActive):
1696
1696
            tree.unlock()
1697
1697
            raise TestNotApplicable("format does not support breaking locks")
1698
1698
        self.assertEqual([True],
1699
 
                bzrlib.ui.ui_factory.responses)
 
1699
                breezy.ui.ui_factory.responses)
1700
1700
        lock_tree = tree.bzrdir.open_workingtree()
1701
1701
        lock_tree.lock_write()
1702
1702
        lock_tree.unlock()
1710
1710
        config = my_dir.get_config()
1711
1711
        try:
1712
1712
            config.set_default_stack_on('http://example.com')
1713
 
        except errors.BzrError, e:
 
1713
        except errors.BzrError as e:
1714
1714
            if 'Cannot set config' in str(e):
1715
1715
                self.assertFalse(
1716
1716
                    isinstance(my_dir, (_mod_bzrdir.BzrDirMeta1, RemoteBzrDir)),