/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/blackbox/test_ancestry.py

  • Committer: Jelmer Vernooij
  • Date: 2020-04-05 19:11:34 UTC
  • mto: (7490.7.16 work)
  • mto: This revision was merged to the branch mainline in revision 7501.
  • Revision ID: jelmer@jelmer.uk-20200405191134-0aebh8ikiwygxma5
Populate the .gitignore file.

Show diffs side-by-side

added added

removed removed

Lines of Context:
16
16
 
17
17
import os
18
18
 
19
 
from bzrlib.tests import TestCaseWithTransport
20
 
from bzrlib.workingtree import WorkingTree
21
 
from bzrlib.branch import Branch
 
19
from breezy.tests import TestCaseWithTransport
22
20
 
23
21
 
24
22
class TestAncestry(TestCaseWithTransport):
25
23
 
26
24
    def _build_branches(self):
27
25
        a_wt = self.make_branch_and_tree('A')
28
 
        self.build_tree_contents([('A/foo', '1111\n')])
 
26
        self.build_tree_contents([('A/foo', b'1111\n')])
29
27
        a_wt.add('foo')
30
 
        a_wt.commit('added foo',rev_id='A1')
31
 
 
32
 
        b_wt = a_wt.bzrdir.sprout('B').open_workingtree()
33
 
        self.build_tree_contents([('B/foo', '1111\n22\n')])
34
 
        b_wt.commit('modified B/foo',rev_id='B1')
35
 
 
36
 
        self.build_tree_contents([('A/foo', '000\n1111\n')])
37
 
        a_wt.commit('modified A/foo',rev_id='A2')
 
28
        a_wt.commit('added foo', rev_id=b'A1')
 
29
 
 
30
        b_wt = a_wt.controldir.sprout('B').open_workingtree()
 
31
        self.build_tree_contents([('B/foo', b'1111\n22\n')])
 
32
        b_wt.commit('modified B/foo', rev_id=b'B1')
 
33
 
 
34
        self.build_tree_contents([('A/foo', b'000\n1111\n')])
 
35
        a_wt.commit('modified A/foo', rev_id=b'A2')
38
36
 
39
37
        a_wt.merge_from_branch(b_wt.branch, b_wt.last_revision(),
40
 
            b_wt.branch.get_rev_id(1))
41
 
        a_wt.commit('merged B into A',rev_id='A3')
 
38
                               b_wt.branch.get_rev_id(1))
 
39
        a_wt.commit('merged B into A', rev_id=b'A3')
42
40
        return a_wt, b_wt
43
41
 
44
42
    def _check_ancestry(self, location='', result=None):
71
69
 
72
70
        self.make_repository('repo', shared=True)
73
71
 
74
 
        a_tree.bzrdir.sprout('repo/A')
 
72
        a_tree.controldir.sprout('repo/A')
75
73
        self._check_ancestry('repo/A')
76
74
 
77
75
    def test_ancestry_with_checkout(self):
79
77
        checkout of a repository branch."""
80
78
        a_tree = self._build_branches()[0]
81
79
        self.make_repository('repo', shared=True)
82
 
        repo_branch = a_tree.bzrdir.sprout('repo/A').open_branch()
 
80
        repo_branch = a_tree.controldir.sprout('repo/A').open_branch()
83
81
        repo_branch.create_checkout('A-checkout')
84
82
        self._check_ancestry('A-checkout')
85
83
 
88
86
        lightweight checkout of a repository branch."""
89
87
        a_tree = self._build_branches()[0]
90
88
        self.make_repository('repo', shared=True)
91
 
        repo_branch = a_tree.bzrdir.sprout('repo/A').open_branch()
 
89
        repo_branch = a_tree.controldir.sprout('repo/A').open_branch()
92
90
        repo_branch.create_checkout('A-checkout', lightweight=True)
93
91
        self._check_ancestry('A-checkout')
94
92
 
97
95
        checkout of a repository branch with a shortened revision history."""
98
96
        a_tree = self._build_branches()[0]
99
97
        self.make_repository('repo', shared=True)
100
 
        repo_branch = a_tree.bzrdir.sprout('repo/A').open_branch()
 
98
        repo_branch = a_tree.controldir.sprout('repo/A').open_branch()
101
99
        repo_branch.create_checkout('A-checkout',
102
100
                                    revision_id=repo_branch.get_rev_id(2))
103
101
        self._check_ancestry('A-checkout', "A1\nA2\n")
107
105
        checkout of a repository branch with a shortened revision history."""
108
106
        a_tree = self._build_branches()[0]
109
107
        self.make_repository('repo', shared=True)
110
 
        repo_branch = a_tree.bzrdir.sprout('repo/A').open_branch()
 
108
        repo_branch = a_tree.controldir.sprout('repo/A').open_branch()
111
109
        repo_branch.create_checkout('A-checkout',
112
110
                                    revision_id=repo_branch.get_rev_id(2),
113
111
                                    lightweight=True)