/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_interbranch/__init__.py

  • Committer: Jelmer Vernooij
  • Date: 2019-03-04 00:16:27 UTC
  • mfrom: (7293 work)
  • mto: This revision was merged to the branch mainline in revision 7318.
  • Revision ID: jelmer@jelmer.uk-20190304001627-v6u7o6pf97tukhek
Merge trunk.

Show diffs side-by-side

added added

removed removed

Lines of Context:
29
29
    branchbuilder,
30
30
    )
31
31
from breezy.branch import (
32
 
                           GenericInterBranch,
33
 
                           InterBranch,
34
 
                           )
 
32
    GenericInterBranch,
 
33
    InterBranch,
 
34
    )
35
35
from breezy.tests import (
36
36
    TestCaseWithTransport,
37
37
    multiply_tests,
47
47
    result = []
48
48
    for interbranch_class, branch_format_from, branch_format_to in test_list:
49
49
        id = '%s,%s,%s' % (interbranch_class.__name__,
50
 
                            branch_format_from.__class__.__name__,
51
 
                            branch_format_to.__class__.__name__)
 
50
                           branch_format_from.__class__.__name__,
 
51
                           branch_format_to.__class__.__name__)
52
52
        scenario = (id,
53
 
            {
54
 
             "branch_format_from": branch_format_from,
55
 
             "interbranch_class": interbranch_class,
56
 
             "branch_format_to": branch_format_to,
57
 
             })
 
53
                    {
 
54
                        "branch_format_from": branch_format_from,
 
55
                        "interbranch_class": interbranch_class,
 
56
                        "branch_format_to": branch_format_to,
 
57
                        })
58
58
        result.append(scenario)
59
59
    return result
60
60
 
66
66
    # default format.
67
67
    for optimiser_class in InterBranch._optimisers:
68
68
        for format_from_test, format_to_test in \
69
 
            optimiser_class._get_branch_formats_to_test():
 
69
                optimiser_class._get_branch_formats_to_test():
70
70
            result.append((optimiser_class, format_from_test, format_to_test))
71
71
    # if there are specific combinations we want to use, we can add them
72
72
    # here.
92
92
            self.branch_format_from._matchingcontroldir.get_branch_format(),
93
93
            self.branch_format_from)
94
94
        return self.make_branch_and_tree(relpath,
95
 
            format=self.branch_format_from._matchingcontroldir)
 
95
                                         format=self.branch_format_from._matchingcontroldir)
96
96
 
97
97
    def make_from_branch_builder(self, relpath):
98
98
        self.assertEqual(
99
99
            self.branch_format_from._matchingcontroldir.get_branch_format(),
100
100
            self.branch_format_from)
101
101
        return branchbuilder.BranchBuilder(self.get_transport(relpath),
102
 
            format=self.branch_format_from._matchingcontroldir)
 
102
                                           format=self.branch_format_from._matchingcontroldir)
103
103
 
104
104
    def make_to_branch(self, relpath):
105
105
        self.assertEqual(
121
121
            self.branch_format_to._matchingcontroldir.get_branch_format(),
122
122
            self.branch_format_to)
123
123
        return self.make_branch_and_tree(relpath,
124
 
            format=self.branch_format_to._matchingcontroldir)
 
124
                                         format=self.branch_format_to._matchingcontroldir)
125
125
 
126
126
    def _sprout(self, origdir, to_url, format):
127
127
        if format.supports_workingtrees:
128
128
            newbranch = self.make_branch(to_url, format=format)
129
129
        else:
130
 
            newbranch = self.make_branch(to_url+".branch", format=format)
 
130
            newbranch = self.make_branch(to_url + ".branch", format=format)
131
131
        origbranch = origdir.open_branch()
132
132
        newbranch.repository.fetch(origbranch.repository)
133
133
        origbranch.copy_content_into(newbranch)
139
139
 
140
140
    def sprout_to(self, origdir, to_url):
141
141
        """Sprout a bzrdir, using to_format for the new branch."""
142
 
        wt = self._sprout(origdir, to_url, self.branch_format_to._matchingcontroldir)
 
142
        wt = self._sprout(
 
143
            origdir, to_url, self.branch_format_to._matchingcontroldir)
143
144
        self.assertEqual(wt.branch._format, self.branch_format_to)
144
145
        return wt.controldir
145
146
 
146
147
    def sprout_from(self, origdir, to_url):
147
148
        """Sprout a bzrdir, using from_format for the new bzrdir."""
148
149
        wt = self._sprout(origdir, to_url,
149
 
            self.branch_format_from._matchingcontroldir)
 
150
                          self.branch_format_from._matchingcontroldir)
150
151
        self.assertEqual(wt.branch._format, self.branch_format_from)
151
152
        return wt.controldir
152
153