~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/per_tree/__init__.py

  • Committer: Patch Queue Manager
  • Date: 2012-09-19 08:27:25 UTC
  • mfrom: (6562.1.1 2.6-merge-up-2.5)
  • Revision ID: pqm@pqm.ubuntu.com-20120919082725-dzvmca37zj5xx2hh
(jam) Merge bzr-2.5.2-dev into bzr trunk to get the ConnectionReset
        fixes.

Show diffs side-by-side

added added

removed removed

Lines of Context:
29
29
    errors,
30
30
    tests,
31
31
    transform,
 
32
    transport,
32
33
    )
33
34
from bzrlib.tests.per_controldir.test_controldir import TestCaseWithControlDir
34
35
from bzrlib.tests.per_workingtree import (
99
100
class TestCaseWithTree(TestCaseWithControlDir):
100
101
 
101
102
    def make_branch_and_tree(self, relpath):
102
 
        made_control = self.make_bzrdir(relpath, format=
103
 
            self.workingtree_format._matchingbzrdir)
 
103
        bzrdir_format = self.workingtree_format.get_controldir_for_branch()
 
104
        made_control = self.make_bzrdir(relpath, format=bzrdir_format)
104
105
        made_control.create_repository()
105
 
        made_control.create_branch()
106
 
        return self.workingtree_format.initialize(made_control)
 
106
        b = made_control.create_branch()
 
107
        if getattr(self, 'repo_is_remote', False):
 
108
            # If the repo is remote, then we just create a local lightweight
 
109
            # checkout
 
110
            # XXX: This duplicates a lot of Branch.create_checkout, but we know
 
111
            #      we want a) lightweight, and b) a specific WT format. We also
 
112
            #      know that nothing should already exist, etc.
 
113
            t = transport.get_transport(relpath)
 
114
            t.ensure_base()
 
115
            wt_dir = bzrdir_format.initialize_on_transport(t)
 
116
            branch_ref = wt_dir.set_branch_reference(b)
 
117
            wt = wt_dir.create_workingtree(None, from_branch=branch_ref)
 
118
        else:
 
119
            wt = self.workingtree_format.initialize(made_control)
 
120
        return wt
107
121
 
108
122
    def workingtree_to_test_tree(self, tree):
109
123
        return self._workingtree_to_test_tree(self, tree)