~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/__init__.py

  • Committer: Jelmer Vernooij
  • Date: 2012-02-23 19:45:15 UTC
  • mto: This revision was merged to the branch mainline in revision 6486.
  • Revision ID: jelmer@samba.org-20120223194515-1ctgfzj362m0tu0k
Use bzrdir.controldir for generic access to control directories.

Show diffs side-by-side

added added

removed removed

Lines of Context:
60
60
import bzrlib
61
61
from bzrlib import (
62
62
    branchbuilder,
63
 
    bzrdir,
 
63
    controldir,
64
64
    chk_map,
65
65
    commands as _mod_commands,
66
66
    config,
247
247
    different types of display.
248
248
 
249
249
    When a test finishes, in whatever way, it calls one of the addSuccess,
250
 
    addFailure or addError classes.  These in turn may redirect to a more
 
250
    addFailure or addError methods.  These in turn may redirect to a more
251
251
    specific case for the special test results supported by our extended
252
252
    tests.
253
253
 
1328
1328
        # hook into bzr dir opening. This leaves a small window of error for
1329
1329
        # transport tests, but they are well known, and we can improve on this
1330
1330
        # step.
1331
 
        bzrdir.BzrDir.hooks.install_named_hook("pre_open",
 
1331
        controldir.ControlDir.hooks.install_named_hook("pre_open",
1332
1332
            self._preopen_isolate_transport, "Check bzr directories are safe.")
1333
1333
 
1334
1334
    def _ndiff_strings(self, a, b):
2603
2603
        # http://pad.lv/825027).
2604
2604
        self.assertIs(None, os.environ.get('BZR_HOME', None))
2605
2605
        os.environ['BZR_HOME'] = root
2606
 
        wt = bzrdir.BzrDir.create_standalone_workingtree(root)
 
2606
        wt = controldir.ControlDir.create_standalone_workingtree(root)
2607
2607
        del os.environ['BZR_HOME']
2608
2608
        # Hack for speed: remember the raw bytes of the dirstate file so that
2609
2609
        # we don't need to re-open the wt to check it hasn't changed.
2658
2658
        self.test_home_dir = self.test_dir + "/MemoryTransportMissingHomeDir"
2659
2659
        self.permit_dir(self.test_dir)
2660
2660
 
2661
 
    def make_branch(self, relpath, format=None):
 
2661
    def make_branch(self, relpath, format=None, name=None):
2662
2662
        """Create a branch on the transport at relpath."""
2663
2663
        repo = self.make_repository(relpath, format=format)
2664
 
        return repo.bzrdir.create_branch(append_revisions_only=False)
 
2664
        return repo.bzrdir.create_branch(append_revisions_only=False,
 
2665
                                         name=name)
2665
2666
 
2666
2667
    def get_default_format(self):
2667
2668
        return 'default'
2679
2680
        if format is None:
2680
2681
            format = self.get_default_format()
2681
2682
        if isinstance(format, basestring):
2682
 
            format = bzrdir.format_registry.make_bzrdir(format)
 
2683
            format = controldir.format_registry.make_bzrdir(format)
2683
2684
        return format
2684
2685
 
2685
2686
    def make_bzrdir(self, relpath, format=None):
2999
3000
            if self.vfs_transport_factory is test_server.LocalURLServer:
3000
3001
                # the branch is colocated on disk, we cannot create a checkout.
3001
3002
                # hopefully callers will expect this.
3002
 
                local_controldir= bzrdir.BzrDir.open(self.get_vfs_only_url(relpath))
 
3003
                local_controldir = controldir.ControlDir.open(
 
3004
                    self.get_vfs_only_url(relpath))
3003
3005
                wt = local_controldir.create_workingtree()
3004
3006
                if wt.branch._format != b._format:
3005
3007
                    wt._branch = b