At file:///home/pqm/archives/thelove/bzr/%2Btrunk/
------------------------------------------------------------
revno: 3870
revision-id: [EMAIL PROTECTED]
parent: [EMAIL PROTECTED]
parent: [EMAIL PROTECTED]
committer: Canonical.com Patch Queue Manager <[EMAIL PROTECTED]>
branch nick: +trunk
timestamp: Fri 2008-11-28 03:17:39 +0000
message:
(mbp, for jam) bzr branch opens source branch only once
modified:
bzrlib/btree_index.py index.py-20080624222253-p0x5f92uyh5hw734-7
bzrlib/builtins.py builtins.py-20050830033751-fc01482b9ca23183
bzrlib/bzrdir.py bzrdir.py-20060131065624-156dfea39c4387cb
------------------------------------------------------------
revno: 3868.1.1
revision-id: [EMAIL PROTECTED]
parent: [EMAIL PROTECTED]
parent: [EMAIL PROTECTED]
committer: Martin Pool <[EMAIL PROTECTED]>
branch nick: integration
timestamp: Fri 2008-11-28 13:32:40 +1100
message:
merge John's patch to avoid re-reading pack-names file
modified:
bzrlib/btree_index.py index.py-20080624222253-p0x5f92uyh5hw734-7
bzrlib/builtins.py builtins.py-20050830033751-fc01482b9ca23183
bzrlib/bzrdir.py bzrdir.py-20060131065624-156dfea39c4387cb
------------------------------------------------------------
revno: 3823.5.2
revision-id: [EMAIL PROTECTED]
parent: [EMAIL PROTECTED]
committer: John Arbash Meinel <[EMAIL PROTECTED]>
branch nick: branch_startup
timestamp: Fri 2008-11-07 17:34:46 -0600
message:
It turns out that we read the pack-names file 3-times because
of inefficiencies in the BTree logic.
1) iter_all_entries() reads the root node, and then proceeds to read all
leaf nodes, but for pack-names, there is only the root node.
2) _read_nodes() reads the whole file when it doesn't know the page size,
but only does so to get the size, and then continues on to read the
requested nodes. Instead, just use what we read.
modified:
bzrlib/btree_index.py index.py-20080624222253-p0x5f92uyh5hw734-7
------------------------------------------------------------
revno: 3823.5.1
revision-id: [EMAIL PROTECTED]
parent: [EMAIL PROTECTED]
committer: John Arbash Meinel <[EMAIL PROTECTED]>
branch nick: branch_startup
timestamp: Fri 2008-11-07 17:17:05 -0600
message:
Allow the source branch to pass itself into BzrDir.sprout.
This allows us to avoid opening the source branch 2 times, which also
causes
problems with the lifetime of repository and branch locks during the
sprout.
modified:
bzrlib/builtins.py builtins.py-20050830033751-fc01482b9ca23183
bzrlib/bzrdir.py bzrdir.py-20060131065624-156dfea39c4387cb
=== modified file 'bzrlib/btree_index.py'
--- a/bzrlib/btree_index.py 2008-11-25 18:55:38 +0000
+++ b/bzrlib/btree_index.py 2008-11-28 02:32:40 +0000
@@ -885,6 +885,15 @@
"iter_all_entries scales with size of history.")
if not self.key_count():
return
+ if self._row_offsets[-1] == 1:
+ # There is only the root node, and we read that via key_count()
+ if self.node_ref_lists:
+ for key, (value, refs) in sorted(self._root_node.keys.items()):
+ yield (self, key, value, refs)
+ else:
+ for key, (value, refs) in sorted(self._root_node.keys.items()):
+ yield (self, key, value)
+ return
start_of_leaves = self._row_offsets[-2]
end_of_leaves = self._row_offsets[-1]
needed_offsets = range(start_of_leaves, end_of_leaves)
@@ -1251,14 +1260,17 @@
"""Read some nodes from disk into the LRU cache.
This performs a readv to get the node data into memory, and parses each
- node, the yields it to the caller. The nodes are requested in the
+ node, then yields it to the caller. The nodes are requested in the
supplied order. If possible doing sort() on the list before requesting
a read may improve performance.
:param nodes: The nodes to read. 0 - first node, 1 - second node etc.
:return: None
"""
+ # may be the byte string of the whole file
bytes = None
+ # list of (offset, length) regions of the file that should, evenually
+ # be read in to data_ranges, either from 'bytes' or from the transport
ranges = []
for index in nodes:
offset = index * _PAGE_SIZE
@@ -1272,6 +1284,7 @@
# small indexes. So we read the whole thing
bytes = self._transport.get_bytes(self._name)
self._size = len(bytes)
+ # the whole thing should be parsed out of 'bytes'
ranges.append((0, len(bytes)))
break
else:
@@ -1283,9 +1296,10 @@
ranges.append((offset, size))
if not ranges:
return
- if bytes:
- data_ranges = [(offset, bytes[offset:offset+_PAGE_SIZE])
- for offset in xrange(0, len(bytes), _PAGE_SIZE)]
+ elif bytes is not None:
+ # already have the whole file
+ data_ranges = [(start, bytes[start:start+_PAGE_SIZE])
+ for start in xrange(0, len(bytes), _PAGE_SIZE)]
elif self._file is None:
data_ranges = self._transport.readv(self._name, ranges)
else:
=== modified file 'bzrlib/builtins.py'
--- a/bzrlib/builtins.py 2008-11-25 03:08:14 +0000
+++ b/bzrlib/builtins.py 2008-11-28 02:32:40 +0000
@@ -977,7 +977,8 @@
possible_transports=[to_transport],
accelerator_tree=accelerator_tree,
hardlink=hardlink, stacked=stacked,
- force_new_repo=standalone)
+ force_new_repo=standalone,
+ source_branch=br_from)
branch = dir.open_branch()
except errors.NoSuchRevision:
to_transport.delete_tree('.')
=== modified file 'bzrlib/bzrdir.py'
--- a/bzrlib/bzrdir.py 2008-10-28 22:19:31 +0000
+++ b/bzrlib/bzrdir.py 2008-11-07 23:17:05 +0000
@@ -1061,7 +1061,8 @@
def sprout(self, url, revision_id=None, force_new_repo=False,
recurse='down', possible_transports=None,
- accelerator_tree=None, hardlink=False, stacked=False):
+ accelerator_tree=None, hardlink=False, stacked=False,
+ source_branch=None):
"""Create a copy of this bzrdir prepared for use as a new line of
development.
@@ -1088,22 +1089,25 @@
cloning_format = self.cloning_metadir(stacked)
# Create/update the result branch
result = cloning_format.initialize_on_transport(target_transport)
- try:
- source_branch = self.open_branch()
- source_repository = source_branch.repository
+ # if a stacked branch wasn't requested, we don't create one
+ # even if the origin was stacked
+ stacked_branch_url = None
+ if source_branch is not None:
if stacked:
stacked_branch_url = self.root_transport.base
- else:
- # if a stacked branch wasn't requested, we don't create one
- # even if the origin was stacked
- stacked_branch_url = None
- except errors.NotBranchError:
- source_branch = None
+ source_repository = source_branch.repository
+ else:
try:
- source_repository = self.open_repository()
- except errors.NoRepositoryPresent:
- source_repository = None
- stacked_branch_url = None
+ source_branch = self.open_branch()
+ source_repository = source_branch.repository
+ if stacked:
+ stacked_branch_url = self.root_transport.base
+ except errors.NotBranchError:
+ source_branch = None
+ try:
+ source_repository = self.open_repository()
+ except errors.NoRepositoryPresent:
+ source_repository = None
repository_policy = result.determine_repository_policy(
force_new_repo, stacked_branch_url, require_stacking=stacked)
result_repo = repository_policy.acquire_repository()
--
bazaar-commits mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/bazaar-commits