~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2008-07-16 23:23:13 UTC
  • mfrom: (1551.19.47 Aaron's mergeable stuff)
  • Revision ID: pqm@pqm.ubuntu.com-20080716232313-9pcoze89hualg5qn
Fetch copies all required data even with stacking (abentley, #248506)

Show diffs side-by-side

added added

removed removed

Lines of Context:
172
172
                errors.UnstackableRepositoryFormat):
173
173
            # not a testable combination.
174
174
            return
175
 
        try:
176
 
            cloned_unstacked_bzrdir = stacked_bzrdir.clone('cloned-unstacked',
177
 
                preserve_stacking=False)
178
 
        except errors.NoSuchRevision:
179
 
            raise KnownFailure(
180
 
                'Pack-to-pack fetch does not handle stacking properly.'
181
 
                ' (#248506)')
182
 
        else:
183
 
            self.fail('Expected a failure due to broken fetching.')
 
175
        cloned_unstacked_bzrdir = stacked_bzrdir.clone('cloned-unstacked',
 
176
            preserve_stacking=False)
184
177
        unstacked_branch = cloned_unstacked_bzrdir.open_branch()
185
178
        self.assertRaises((errors.NotStacked, errors.UnstackableBranchFormat),
186
179
                          unstacked_branch.get_stacked_on_url)
215
208
            self.assertEqual('../stack-on', target.get_stacked_on_url())
216
209
        except errors.UnstackableBranchFormat:
217
210
            pass
 
211
 
 
212
    def prepare_stacked_on_fetch(self):
 
213
        stack_on = self.make_branch_and_tree('stack-on')
 
214
        stack_on.commit('first commit', rev_id='rev1')
 
215
        try:
 
216
            stacked_dir = stack_on.bzrdir.sprout('stacked', stacked=True)
 
217
        except (errors.UnstackableRepositoryFormat,
 
218
                errors.UnstackableBranchFormat):
 
219
            raise TestNotApplicable('Format does not support stacking.')
 
220
        unstacked = self.make_repository('unstacked')
 
221
        return stacked_dir.open_workingtree(), unstacked
 
222
 
 
223
    def test_fetch_copies_from_stacked_on(self):
 
224
        stacked, unstacked = self.prepare_stacked_on_fetch()
 
225
        unstacked.fetch(stacked.branch.repository, 'rev1')
 
226
        unstacked.get_revision('rev1')
 
227
 
 
228
    def test_fetch_copies_from_stacked_on_and_stacked(self):
 
229
        stacked, unstacked = self.prepare_stacked_on_fetch()
 
230
        stacked.commit('second commit', rev_id='rev2')
 
231
        unstacked.fetch(stacked.branch.repository, 'rev2')
 
232
        unstacked.get_revision('rev1')
 
233
        unstacked.get_revision('rev2')