Rev 5574: Fix the test case that was checking we refused to create a commit_builder in http://bazaar.launchpad.net/~jameinel/bzr/2.3-commit-to-stacked
John Arbash Meinel
john at arbash-meinel.com
Wed Jan 12 16:41:15 UTC 2011
At http://bazaar.launchpad.net/~jameinel/bzr/2.3-commit-to-stacked
------------------------------------------------------------
revno: 5574
revision-id: john at arbash-meinel.com-20110112164108-yq4sxxsb5t3zn8i5
parent: john at arbash-meinel.com-20110112155012-i8gi0bwj9krnjyxu
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: 2.3-commit-to-stacked
timestamp: Wed 2011-01-12 10:41:08 -0600
message:
Fix the test case that was checking we refused to create a commit_builder
for specific formats.
-------------- next part --------------
=== modified file 'bzrlib/repository.py'
--- a/bzrlib/repository.py 2011-01-12 01:01:53 +0000
+++ b/bzrlib/repository.py 2011-01-12 16:41:08 +0000
@@ -187,8 +187,9 @@
if not self.repository._fallback_repositories:
return
if not self.repository._format.supports_chks:
- raise errors.BzrError('Stacked commit does not support'
- ' repositories earlier that 2a')
+ raise errors.BzrError("Cannot commit directly to a stacked branch"
+ " in pre-2a formats. See "
+ "https://bugs.launchpad.net/bzr/+bug/375013 for details.")
# This is a stacked repo, we need to make sure we have the parent
# inventories for the parents.
parent_keys = [(p,) for p in self.parents]
@@ -1796,6 +1797,10 @@
:param revprops: Optional dictionary of revision properties.
:param revision_id: Optional revision id.
"""
+ if self._fallback_repositories and not self._format.supports_chks:
+ raise errors.BzrError("Cannot commit directly to a stacked branch"
+ " in pre-2a formats. See "
+ "https://bugs.launchpad.net/bzr/+bug/375013 for details.")
result = self._commit_builder_class(self, parents, config,
timestamp, timezone, committer, revprops, revision_id)
self.start_write_group()
=== modified file 'bzrlib/tests/per_repository/test_commit_builder.py'
--- a/bzrlib/tests/per_repository/test_commit_builder.py 2011-01-10 22:20:12 +0000
+++ b/bzrlib/tests/per_repository/test_commit_builder.py 2011-01-12 16:41:08 +0000
@@ -1300,8 +1300,8 @@
def test_stacked_repositories_reject_commit_builder(self):
# As per bug 375013, committing to stacked repositories is currently
- # broken, so repositories with fallbacks refuse to hand out a commit
- # builder.
+ # broken if we aren't in a chk repository. So old repositories with
+ # fallbacks refuse to hand out a commit builder.
repo_basis = self.make_repository('basis')
branch = self.make_branch('local')
repo_local = branch.repository
@@ -1309,10 +1309,14 @@
repo_local.add_fallback_repository(repo_basis)
except errors.UnstackableRepositoryFormat:
raise tests.TestNotApplicable("not a stackable format.")
- repo_local.lock_write()
- self.addCleanup(repo_local.unlock)
- self.assertRaises(errors.BzrError, repo_local.get_commit_builder,
- branch, [], branch.get_config())
+ self.addCleanup(repo_local.lock_write().unlock)
+ if not repo_local._format.supports_chks:
+ self.assertRaises(errors.BzrError, repo_local.get_commit_builder,
+ branch, [], branch.get_config())
+ else:
+ builder = repo_local.get_commit_builder(branch, [],
+ branch.get_config())
+ builder.abort()
def test_committer_no_username(self):
# Ensure that when no username is available but a committer is
More information about the bazaar-commits
mailing list