~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/branch_implementations/test_branch.py

  • Committer: John Arbash Meinel
  • Date: 2006-07-28 00:17:55 UTC
  • mto: (1904.2.2 bzr.mbp.release)
  • mto: This revision was merged to the branch mainline in revision 1913.
  • Revision ID: john@arbash-meinel.com-20060728001755-43e42832fd5ffca7
Test that we copy the parent across properly (if it is available)

Show diffs side-by-side

added added

removed removed

Lines of Context:
173
173
        br_b = wt_a.bzrdir.open_branch().sprout(repo_b.bzrdir, revision_id='1')
174
174
        self.assertEqual(br_b.last_revision(), '1')
175
175
 
 
176
    def get_parented_branch(self):
 
177
        wt_a = self.make_branch_and_tree('a')
 
178
        self.build_tree(['a/one'])
 
179
        wt_a.add(['one'])
 
180
        wt_a.commit('commit one', rev_id='1')
 
181
 
 
182
        branch_b = wt_a.bzrdir.sprout('b', revision_id='1').open_branch()
 
183
        self.assertEqual(wt_a.branch.base, branch_b.get_parent())
 
184
        return branch_b
 
185
 
176
186
    def test_clone_branch_nickname(self):
177
187
        # test the nick name is preserved always
178
188
        raise TestSkipped('XXX branch cloning is not yet tested..')
179
189
 
180
190
    def test_clone_branch_parent(self):
181
191
        # test the parent is preserved always
182
 
        raise TestSkipped('XXX branch cloning is not yet tested..')
183
 
        
 
192
        branch_b = self.get_parented_branch()
 
193
        repo_c = self.make_repository('c')
 
194
        branch_b.repository.copy_content_into(repo_c)
 
195
        branch_c = branch_b.clone(repo_c.bzrdir)
 
196
        self.assertNotEqual(None, branch_c.get_parent())
 
197
        self.assertEqual(branch_b.get_parent(), branch_c.get_parent())
 
198
 
 
199
        # We can also set a specific parent, and it should be honored
 
200
        random_parent = 'http://bazaar-vcs.org/path/to/branch'
 
201
        branch_b.set_parent(random_parent)
 
202
        repo_d = self.make_repository('d')
 
203
        branch_b.repository.copy_content_into(repo_d)
 
204
        branch_d = branch_b.clone(repo_d.bzrdir)
 
205
        self.assertEqual(random_parent, branch_d.get_parent())
 
206
 
184
207
    def test_sprout_branch_nickname(self):
185
208
        # test the nick name is reset always
186
209
        raise TestSkipped('XXX branch sprouting is not yet tested..')