258
258
unstacked.fetch(stacked.branch.repository, 'rev2')
259
259
unstacked.get_revision('rev1')
260
260
unstacked.get_revision('rev2')
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')])
269
src_tree.commit('first commit')
271
# Make the stacked-on branch.
272
src_tree.bzrdir.sprout('stacked-on')
274
# Make a branch stacked on it.
275
target = self.make_branch('target')
277
target.set_stacked_on_url('../stacked-on')
278
except (errors.UnstackableRepositoryFormat,
279
errors.UnstackableBranchFormat):
280
raise TestNotApplicable('Format does not support stacking.')
282
# Change the source branch.
283
self.build_tree_contents([('src/a', 'new content')])
284
src_tree.commit('second commit', rev_id='rev2')
286
# Fetch changes to the target.
287
target.fetch(src_tree.branch)
288
rtree = target.repository.revision_tree('rev2')
290
self.addCleanup(rtree.unlock)
291
self.assertEqual('new content', rtree.get_file_by_path('a').read())