Rev 5147: (andrew) Read-lock branches only once in cmd_missing. in file:///home/pqm/archives/thelove/bzr/%2Btrunk/

Canonical.com Patch Queue Manager pqm at pqm.ubuntu.com
Mon Apr 12 06:04:48 BST 2010


At file:///home/pqm/archives/thelove/bzr/%2Btrunk/

------------------------------------------------------------
revno: 5147 [merge]
revision-id: pqm at pqm.ubuntu.com-20100412050444-kmv724lkcq5r23kh
parent: pqm at pqm.ubuntu.com-20100412030946-4ahe008i86yibsmc
parent: andrew.bennetts at canonical.com-20100412022546-20jyd6iux6wqqx70
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Mon 2010-04-12 06:04:44 +0100
message:
  (andrew) Read-lock branches only once in cmd_missing.
modified:
  NEWS                           NEWS-20050323055033-4e00b5db738777ff
  bzrlib/builtins.py             builtins.py-20050830033751-fc01482b9ca23183
=== modified file 'NEWS'
--- a/NEWS	2010-04-12 03:09:46 +0000
+++ b/NEWS	2010-04-12 05:04:44 +0000
@@ -41,6 +41,9 @@
   generated by a template and not edited by the user.
   (Robert Collins, #530265)
 
+* ``bzr missing`` read-locks the branches 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-08 06:05:44 +0000
+++ b/bzrlib/builtins.py	2010-04-12 02:25:46 +0000
@@ -4346,6 +4346,9 @@
             restrict = 'remote'
 
         local_branch = Branch.open_containing(u".")[0]
+        local_branch.lock_read()
+        self.add_cleanup(local_branch.unlock)
+
         parent = local_branch.get_parent()
         if other_branch is None:
             other_branch = parent
@@ -4360,15 +4363,14 @@
         remote_branch = Branch.open(other_branch)
         if remote_branch.base == local_branch.base:
             remote_branch = local_branch
+        else:
+            remote_branch.lock_read()
+            self.add_cleanup(remote_branch.unlock)
 
-        local_branch.lock_read()
-        self.add_cleanup(local_branch.unlock)
         local_revid_range = _revision_range_to_revid_range(
             _get_revision_range(my_revision, local_branch,
                 self.name()))
 
-        remote_branch.lock_read()
-        self.add_cleanup(remote_branch.unlock)
         remote_revid_range = _revision_range_to_revid_range(
             _get_revision_range(revision,
                 remote_branch, self.name()))




More information about the bazaar-commits mailing list