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

  • Committer: Robert Collins
  • Date: 2010-05-05 00:05:29 UTC
  • mto: This revision was merged to the branch mainline in revision 5206.
  • Revision ID: robertc@robertcollins.net-20100505000529-ltmllyms5watqj5u
Make 'pydoc bzrlib.tests.build_tree_shape' useful.

Show diffs side-by-side

added added

removed removed

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