Rev 5150: (andrew) Read-lock the branches and tree only once in cmd_pull. in file:///home/pqm/archives/thelove/bzr/%2Btrunk/
Canonical.com Patch Queue Manager
pqm at pqm.ubuntu.com
Tue Apr 13 09:04:46 BST 2010
At file:///home/pqm/archives/thelove/bzr/%2Btrunk/
------------------------------------------------------------
revno: 5150 [merge]
revision-id: pqm at pqm.ubuntu.com-20100413080445-hkhc3li89jzhp5eq
parent: pqm at pqm.ubuntu.com-20100413064948-k2rocqzj4whtoze7
parent: andrew.bennetts at canonical.com-20100413021959-7xum2r8x7os38mzf
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Tue 2010-04-13 09:04:45 +0100
message:
(andrew) Read-lock the branches and tree only once in cmd_pull.
modified:
NEWS NEWS-20050323055033-4e00b5db738777ff
bzrlib/builtins.py builtins.py-20050830033751-fc01482b9ca23183
=== modified file 'NEWS'
--- a/NEWS 2010-04-13 05:21:59 +0000
+++ b/NEWS 2010-04-13 08:04:45 +0000
@@ -48,6 +48,9 @@
* ``bzr missing`` read-locks the branches only once.
(Andrew Bennetts)
+* ``bzr pull`` locks the branches and tree only once.
+ (Andrew Bennetts)
+
* Index lookups in pack repositories search recently hit pack files first.
In repositories with many pack files this can greatly reduce the
number of files accessed, the number of bytes read, and the number of
=== modified file 'bzrlib/builtins.py'
--- a/bzrlib/builtins.py 2010-04-12 02:25:46 +0000
+++ b/bzrlib/builtins.py 2010-04-13 02:19:59 +0000
@@ -988,10 +988,14 @@
try:
tree_to = WorkingTree.open_containing(directory)[0]
branch_to = tree_to.branch
+ tree_to.lock_write()
+ self.add_cleanup(tree_to.unlock)
except errors.NoWorkingTree:
tree_to = None
branch_to = Branch.open_containing(directory)[0]
-
+ branch_to.lock_write()
+ self.add_cleanup(branch_to.unlock)
+
if local and not branch_to.get_bound_location():
raise errors.LocalRequiresBoundBranch()
@@ -1027,18 +1031,15 @@
else:
branch_from = Branch.open(location,
possible_transports=possible_transports)
+ branch_from.lock_read()
+ self.add_cleanup(branch_from.unlock)
if branch_to.get_parent() is None or remember:
branch_to.set_parent(branch_from.base)
- if branch_from is not branch_to:
- branch_from.lock_read()
- self.add_cleanup(branch_from.unlock)
if revision is not None:
revision_id = revision.as_revision_id(branch_from)
- branch_to.lock_write()
- self.add_cleanup(branch_to.unlock)
if tree_to is not None:
view_info = _get_view_info_for_change_reporter(tree_to)
change_reporter = delta._ChangeReporter(
More information about the bazaar-commits
mailing list