Rev 5677: (jelmer) Add BranchFormat.supports_leaving_lock and in file:///home/pqm/archives/thelove/bzr/%2Btrunk/
Canonical.com Patch Queue Manager
pqm at pqm.ubuntu.com
Tue Feb 22 16:53:18 UTC 2011
At file:///home/pqm/archives/thelove/bzr/%2Btrunk/
------------------------------------------------------------
revno: 5677 [merge]
revision-id: pqm at pqm.ubuntu.com-20110222165315-o04d6ofm8hqjc0ay
parent: pqm at pqm.ubuntu.com-20110222145131-azoy8b20eeo4utcq
parent: jelmer at samba.org-20110222115959-3qzxjkg657oiu4u1
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Tue 2011-02-22 16:53:15 +0000
message:
(jelmer) Add BranchFormat.supports_leaving_lock and
RepositoryFormat.supports_leaving_lock flags. (Jelmer Vernooij)
modified:
bzrlib/branch.py branch.py-20050309040759-e4baf4e0d046576e
bzrlib/repofmt/weaverepo.py presplitout.py-20070125045333-wfav3tsh73oxu3zk-1
bzrlib/repository.py rev_storage.py-20051111201905-119e9401e46257e3
bzrlib/tests/per_branch/test_push.py test_push.py-20070130153159-fhfap8uoifevg30j-1
bzrlib/tests/per_branch/test_stacking.py test_stacking.py-20080214020755-msjlkb7urobwly0f-1
bzrlib/tests/per_repository/test_repository.py test_repository.py-20060131092128-ad07f494f5c9d26c
doc/en/release-notes/bzr-2.4.txt bzr2.4.txt-20110114053217-k7ym9jfz243fddjm-1
=== modified file 'bzrlib/branch.py'
--- a/bzrlib/branch.py 2011-02-19 17:37:45 +0000
+++ b/bzrlib/branch.py 2011-02-21 22:43:53 +0000
@@ -1783,6 +1783,10 @@
"""True if this format records a stacked-on branch."""
return False
+ def supports_leaving_lock(self):
+ """True if this format supports leaving locks in place."""
+ return False # by default
+
@classmethod
def unregister_format(klass, format):
del klass._formats[format.get_format_string()]
@@ -2083,6 +2087,9 @@
def __str__(self):
return "Bazaar-NG branch format 4"
+ def supports_leaving_lock(self):
+ return False
+
class BranchFormatMetadir(BranchFormat):
"""Common logic for meta-dir based branch formats."""
@@ -2129,6 +2136,9 @@
def supports_tags(self):
return True
+ def supports_leaving_lock(self):
+ return True
+
class BzrBranchFormat5(BranchFormatMetadir):
"""Bzr branch format 5.
=== modified file 'bzrlib/repofmt/weaverepo.py'
--- a/bzrlib/repofmt/weaverepo.py 2011-02-08 13:34:52 +0000
+++ b/bzrlib/repofmt/weaverepo.py 2011-02-21 22:43:53 +0000
@@ -277,6 +277,7 @@
_fetch_order = 'topological'
_fetch_reconcile = True
fast_deltas = False
+ supports_leaving_lock = False
def initialize(self, a_bzrdir, shared=False, _internal=False):
"""Create a weave repository."""
=== modified file 'bzrlib/repository.py'
--- a/bzrlib/repository.py 2011-02-21 22:11:57 +0000
+++ b/bzrlib/repository.py 2011-02-22 16:53:15 +0000
@@ -3063,6 +3063,8 @@
# Does this repository format escape funky characters, or does it create files with
# similar names as the versioned files in its contents on disk ?
supports_funky_characters = True
+ # Does this repository format support leaving locks?
+ supports_leaving_lock = True
def __repr__(self):
return "%s()" % self.__class__.__name__
@@ -3207,6 +3209,7 @@
rich_root_data = False
supports_tree_reference = False
supports_external_lookups = False
+ supports_leaving_lock = True
@property
def _matchingbzrdir(self):
=== modified file 'bzrlib/tests/per_branch/test_push.py'
--- a/bzrlib/tests/per_branch/test_push.py 2011-01-14 20:52:48 +0000
+++ b/bzrlib/tests/per_branch/test_push.py 2011-02-21 22:43:53 +0000
@@ -350,9 +350,9 @@
raise tests.TestNotApplicable(
'Does not apply when remote backing branch is also '
'a smart branch')
- if isinstance(self.branch_format, branch.BzrBranchFormat4):
+ if not self.branch_format.supports_leaving_lock():
raise tests.TestNotApplicable(
- 'Branch format 4 is not usable via HPSS.')
+ 'Branch format is not usable via HPSS.')
super(EmptyPushSmartEffortTests, self).setUp()
# Create a smart server that publishes whatever the backing VFS server
# does.
=== modified file 'bzrlib/tests/per_branch/test_stacking.py'
--- a/bzrlib/tests/per_branch/test_stacking.py 2011-02-09 06:36:35 +0000
+++ b/bzrlib/tests/per_branch/test_stacking.py 2011-02-21 22:43:53 +0000
@@ -363,8 +363,8 @@
def test_sprout_to_smart_server_stacking_policy_handling(self):
"""Obey policy where possible, ignore otherwise."""
- if isinstance(self.branch_format, branch.BzrBranchFormat4):
- raise TestNotApplicable('Branch format 4 is not usable via HPSS.')
+ if not self.branch_format.supports_leaving_lock():
+ raise TestNotApplicable('Branch format is not usable via HPSS.')
source = self.make_branch('source')
stack_on = self.make_stacked_on_matching(source)
parent_bzrdir = self.make_bzrdir('.', format='default')
=== modified file 'bzrlib/tests/per_repository/test_repository.py'
--- a/bzrlib/tests/per_repository/test_repository.py 2011-01-27 14:27:18 +0000
+++ b/bzrlib/tests/per_repository/test_repository.py 2011-02-21 22:43:53 +0000
@@ -865,12 +865,9 @@
def test_sprout_branch_from_hpss_preserves_repo_format(self):
"""branch.sprout from a smart server preserves the repository format.
"""
- weave_formats = [weaverepo.RepositoryFormat5(),
- weaverepo.RepositoryFormat6(),
- weaverepo.RepositoryFormat7()]
- if self.repository_format in weave_formats:
+ if not self.repository_format.supports_leaving_lock:
raise tests.TestNotApplicable(
- "Cannot fetch weaves over smart protocol.")
+ "Format can not be used over HPSS")
remote_repo = self.make_remote_repository('remote')
remote_branch = remote_repo.bzrdir.create_branch()
try:
@@ -887,12 +884,9 @@
"""branch.sprout from a smart server preserves the repository format of
a branch from a shared repository.
"""
- weave_formats = [weaverepo.RepositoryFormat5(),
- weaverepo.RepositoryFormat6(),
- weaverepo.RepositoryFormat7()]
- if self.repository_format in weave_formats:
+ if not self.repository_format.supports_leaving_lock:
raise tests.TestNotApplicable(
- "Cannot fetch weaves over smart protocol.")
+ "Format can not be used over HPSS")
# Make a shared repo
remote_repo = self.make_remote_repository('remote', shared=True)
remote_backing_repo = bzrdir.BzrDir.open(
@@ -916,9 +910,7 @@
self.assertEqual(remote_backing_repo._format, local_repo._format)
def test_clone_to_hpss(self):
- pre_metadir_formats = [weaverepo.RepositoryFormat5(),
- weaverepo.RepositoryFormat6()]
- if self.repository_format in pre_metadir_formats:
+ if not self.repository_format.supports_leaving_lock:
raise tests.TestNotApplicable(
"Cannot lock pre_metadir_formats remotely.")
remote_transport = self.make_smart_server('remote')
=== modified file 'doc/en/release-notes/bzr-2.4.txt'
--- a/doc/en/release-notes/bzr-2.4.txt 2011-02-19 17:37:45 +0000
+++ b/doc/en/release-notes/bzr-2.4.txt 2011-02-22 11:59:59 +0000
@@ -120,6 +120,10 @@
* All methods and arguments that were deprecated before 2.0
have been removed. (Jelmer Vernooij)
+* ``BranchFormat.supports_leaving_lock()`` and
+ ``RepositoryFormat.supports_leaving_lock`` flags have been added.
+ (Jelmer Vernooij)
+
* ``Branch.fetch`` implementations must now accept an optional
``fetch_spec`` keyword argument. (Andrew Bennetts)
More information about the bazaar-commits
mailing list