Rev 3589: Remove the needs_read_lock decorators for Repository.is_shared in http://bzr.arbash-meinel.com/branches/bzr/1.7-dev/no_lock_for_is_shared
John Arbash Meinel
john at arbash-meinel.com
Tue Jul 29 16:52:08 BST 2008
At http://bzr.arbash-meinel.com/branches/bzr/1.7-dev/no_lock_for_is_shared
------------------------------------------------------------
revno: 3589
revision-id: john at arbash-meinel.com-20080729155145-cg7pxcp1a0on2kx4
parent: pqm at pqm.ubuntu.com-20080729093250-b1g7zu2k1pj0mswe
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: no_lock_for_is_shared
timestamp: Tue 2008-07-29 10:51:45 -0500
message:
Remove the needs_read_lock decorators for Repository.is_shared
-------------- next part --------------
=== modified file 'NEWS'
--- a/NEWS 2008-07-29 09:32:50 +0000
+++ b/NEWS 2008-07-29 15:51:45 +0000
@@ -71,6 +71,13 @@
* The ``put_on_disk`` and ``get_tar_item`` methods in
``InventoryEntry`` were deprecated. (Ian Clatworthy)
+ * ``Repository.is_shared`` doesn't take a read lock. It didn't
+ need one in the first place (nobody cached the value, and
+ ``RemoteRepository`` wasn't taking one either). This saves a round
+ trip when probing Pack repositories, as they read the ``pack-names``
+ file when locked. And during probe, locking the repo isn't very
+ useful. (John Arbash Meinel)
+
INTERNALS:
=== modified file 'bzrlib/repofmt/weaverepo.py'
--- a/bzrlib/repofmt/weaverepo.py 2008-07-28 09:12:28 +0000
+++ b/bzrlib/repofmt/weaverepo.py 2008-07-29 15:51:45 +0000
@@ -148,7 +148,6 @@
return self.inventories.add_lines((revision_id,), final_parents, lines,
check_content=check_content)[0]
- @needs_read_lock
def is_shared(self):
"""AllInOne repositories cannot be shared."""
return False
=== modified file 'bzrlib/repository.py'
--- a/bzrlib/repository.py 2008-07-29 09:32:50 +0000
+++ b/bzrlib/repository.py 2008-07-29 15:51:45 +0000
@@ -1626,7 +1626,6 @@
else:
return self.get_inventory(revision_id)
- @needs_read_lock
def is_shared(self):
"""Return True if this repository is flagged as a shared repository."""
raise NotImplementedError(self.is_shared)
@@ -2006,7 +2005,6 @@
super(MetaDirRepository, self).__init__(_format, a_bzrdir, control_files)
self._transport = control_files._transport
- @needs_read_lock
def is_shared(self):
"""Return True if this repository is flagged as a shared repository."""
return self._transport.has('shared-storage')
More information about the bazaar-commits
mailing list