Rev 3234: Extend set_stacked_on to update the repository with the right external references. in http://people.ubuntu.com/~robertc/baz2.0/shallow-branch
Robert Collins
robertc at robertcollins.net
Mon Feb 25 04:18:51 GMT 2008
At http://people.ubuntu.com/~robertc/baz2.0/shallow-branch
------------------------------------------------------------
revno: 3234
revision-id:robertc at robertcollins.net-20080225041844-ftrxtegzo0yts6hv
parent: robertc at robertcollins.net-20080225022925-jo7ynu2gjgamp781
committer: Robert Collins <robertc at robertcollins.net>
branch nick: StackableBranch
timestamp: Mon 2008-02-25 15:18:44 +1100
message:
Extend set_stacked_on to update the repository with the right external references.
modified:
bzrlib/branch.py branch.py-20050309040759-e4baf4e0d046576e
bzrlib/tests/test_branch.py test_branch.py-20060116013032-97819aa07b8ab3b5
=== modified file 'bzrlib/branch.py'
--- a/bzrlib/branch.py 2008-02-22 01:53:18 +0000
+++ b/bzrlib/branch.py 2008-02-25 04:18:44 +0000
@@ -2017,6 +2017,15 @@
self._check_stackable_repo()
if not url:
url = ''
+ # repositories don't offer an interface to remove fallback
+ # repositories today; take the conceptually simpler option and just
+ # reopen it.
+ self.repository = self.bzrdir.find_repository()
+ else:
+ new_repo = bzrdir.BzrDir.open(url).open_branch().repository
+ self.repository.add_fallback_repository(new_repo)
+ # write this out after the repository is stacked to avoid setting a
+ # stacked config that doesn't work.
self.control_files.put_utf8('stacked-on', url + '\n')
def _get_append_revisions_only(self):
=== modified file 'bzrlib/tests/test_branch.py'
--- a/bzrlib/tests/test_branch.py 2008-02-22 01:58:39 +0000
+++ b/bzrlib/tests/test_branch.py 2008-02-25 04:18:44 +0000
@@ -356,11 +356,14 @@
def test_stack_and_unstack(self):
branch = self.make_branch('a', format=self.get_format_name())
- target = self.make_branch('b')
- branch.set_stacked_on(target.base)
- self.assertEqual(target.base, branch.get_stacked_on())
+ target = self.make_branch_and_tree('b', format=self.get_format_name())
+ branch.set_stacked_on(target.branch.base)
+ self.assertEqual(target.branch.base, branch.get_stacked_on())
+ revid = target.commit('foo')
+ self.assertTrue(branch.repository.has_revision(revid))
branch.set_stacked_on(None)
self.assertRaises(errors.NotStacked, branch.get_stacked_on)
+ self.assertFalse(branch.repository.has_revision(revid))
class TestBranchReference(TestCaseWithTransport):
More information about the bazaar-commits
mailing list