~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-30 01:29:45 UTC
  • mfrom: (3590.2.1 bzr.ab.integration)
  • Revision ID: pqm@pqm.ubuntu.com-20080730012945-o1jetsqxklmxzgt2
Fetch into stacked branches works correctly (abentley, jml)

Show diffs side-by-side

added added

removed removed

Lines of Context:
258
258
        unstacked.fetch(stacked.branch.repository, 'rev2')
259
259
        unstacked.get_revision('rev1')
260
260
        unstacked.get_revision('rev2')
 
261
 
 
262
    def test_fetch_revisions_with_file_changes(self):
 
263
        # Fetching revisions including file changes into a stacked branch
 
264
        # works without error.
 
265
        # Make the source tree.
 
266
        src_tree = self.make_branch_and_tree('src')
 
267
        self.build_tree_contents([('src/a', 'content')])
 
268
        src_tree.add('a')
 
269
        src_tree.commit('first commit')
 
270
 
 
271
        # Make the stacked-on branch.
 
272
        src_tree.bzrdir.sprout('stacked-on')
 
273
 
 
274
        # Make a branch stacked on it.
 
275
        target = self.make_branch('target')
 
276
        try:
 
277
            target.set_stacked_on_url('../stacked-on')
 
278
        except (errors.UnstackableRepositoryFormat,
 
279
                errors.UnstackableBranchFormat):
 
280
            raise TestNotApplicable('Format does not support stacking.')
 
281
 
 
282
        # Change the source branch.
 
283
        self.build_tree_contents([('src/a', 'new content')])
 
284
        src_tree.commit('second commit', rev_id='rev2')
 
285
 
 
286
        # Fetch changes to the target.
 
287
        target.fetch(src_tree.branch)
 
288
        rtree = target.repository.revision_tree('rev2')
 
289
        rtree.lock_read()
 
290
        self.addCleanup(rtree.unlock)
 
291
        self.assertEqual('new content', rtree.get_file_by_path('a').read())