~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/per_bzrdir/test_bzrdir.py

Merge cleanup into first-try

Show diffs side-by-side

added added

removed removed

Lines of Context:
1167
1167
        self.assertEqual(tree.branch.last_revision(),
1168
1168
                         target.open_branch().last_revision())
1169
1169
 
 
1170
    def test_sprout_with_revision_id_uses_default_stack_on(self):
 
1171
        # Make a branch with three commits to stack on.
 
1172
        builder = self.make_branch_builder('stack-on')
 
1173
        builder.start_series()
 
1174
        builder.build_commit(message='Rev 1.', rev_id='rev-1')
 
1175
        builder.build_commit(message='Rev 2.', rev_id='rev-2')
 
1176
        builder.build_commit(message='Rev 3.', rev_id='rev-3')
 
1177
        builder.finish_series()
 
1178
        stack_on = builder.get_branch()
 
1179
        # Make a bzrdir with a default stacking policy to stack on that branch.
 
1180
        config = self.make_bzrdir('policy-dir').get_config()
 
1181
        try:
 
1182
            config.set_default_stack_on(self.get_url('stack-on'))
 
1183
        except errors.BzrError:
 
1184
            raise TestNotApplicable('Only relevant for stackable formats.')
 
1185
        # Sprout the stacked-on branch into the bzrdir.
 
1186
        sprouted = stack_on.bzrdir.sprout(
 
1187
            self.get_url('policy-dir/sprouted'), revision_id='rev-3')
 
1188
        # Not all revisions are copied into the sprouted repository.
 
1189
        repo = sprouted.open_repository()
 
1190
        self.addCleanup(repo.lock_read().unlock)
 
1191
        self.assertEqual(None, repo.get_parent_map(['rev-1']).get('rev-1'))
 
1192
 
1170
1193
    def test_format_initialize_find_open(self):
1171
1194
        # loopback test to check the current format initializes to itself.
1172
1195
        if not self.bzrdir_format.is_supported():