/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: 2018-03-31 17:16:06 UTC
  • mto: (6883.23.7 bundle-git)
  • mto: This revision was merged to the branch mainline in revision 6955.
  • Revision ID: jelmer@jelmer.uk-20180331171606-kc0lxw0uoxinxx4p
add --lossy option to 'bzr push'.

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