Merge lp:~jelmer/brz/revisiontree-chunks into lp:brz/3.1

Proposed by Jelmer Vernooij
Status: Superseded
Proposed branch: lp:~jelmer/brz/revisiontree-chunks
Merge into: lp:brz/3.1
Diff against target: 64 lines (+7/-7)
3 files modified
breezy/bzr/vf_repository.py (+1/-1)
breezy/git/object_store.py (+2/-2)
breezy/revisiontree.py (+4/-4)
To merge this branch: bzr merge lp:~jelmer/brz/revisiontree-chunks
Reviewer Review Type Date Requested Status
Jelmer Vernooij Approve
Review via email: mp+384917@code.launchpad.net

This proposal supersedes a proposal from 2020-02-09.

This proposal has been superseded by a proposal from 2022-07-07.

Commit message

Don't keep file in memory in Tree.get_file.

Description of the change

Don't keep file in memory in Tree.get_file.

To post a comment you must log in.
Revision history for this message
Jelmer Vernooij (jelmer) : Posted in a previous version of this proposal
review: Approve
Revision history for this message
The Breezy Bot (the-breezy-bot) wrote : Posted in a previous version of this proposal
Revision history for this message
The Breezy Bot (the-breezy-bot) wrote : Posted in a previous version of this proposal
Revision history for this message
The Breezy Bot (the-breezy-bot) wrote : Posted in a previous version of this proposal
Revision history for this message
Jelmer Vernooij (jelmer) :
review: Approve
Revision history for this message
The Breezy Bot (the-breezy-bot) wrote :
Revision history for this message
The Breezy Bot (the-breezy-bot) wrote :
Revision history for this message
The Breezy Bot (the-breezy-bot) wrote :
Revision history for this message
The Breezy Bot (the-breezy-bot) wrote :

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'breezy/bzr/vf_repository.py'
2--- breezy/bzr/vf_repository.py 2020-08-06 01:40:59 +0000
3+++ breezy/bzr/vf_repository.py 2021-02-19 14:54:58 +0000
4@@ -1279,7 +1279,7 @@
5 for record in self.texts.get_record_stream(text_keys, 'unordered', True):
6 if record.storage_kind == 'absent':
7 raise errors.RevisionNotPresent(record.key[1], record.key[0])
8- yield text_keys[record.key], record.get_bytes_as('chunked')
9+ yield text_keys[record.key], record.iter_bytes_as('chunked')
10
11 def _generate_text_key_index(self, text_key_references=None,
12 ancestors=None):
13
14=== modified file 'breezy/git/object_store.py'
15--- breezy/git/object_store.py 2020-06-27 14:48:19 +0000
16+++ breezy/git/object_store.py 2021-02-19 14:54:58 +0000
17@@ -312,7 +312,7 @@
18 for (path, file_id), chunks in tree.iter_files_bytes(
19 [(path, (path, file_id)) for (path, file_id) in new_blobs]):
20 obj = Blob()
21- obj.chunked = chunks
22+ obj.chunked = list(chunks)
23 if add_cache_entry is not None:
24 add_cache_entry(obj, (file_id, tree.get_file_revision(path)), path)
25 yield path, obj, (file_id, tree.get_file_revision(path))
26@@ -573,7 +573,7 @@
27 ((key[0], key[1], key) for key in keys))
28 for (file_id, revision, expected_sha), chunks in stream:
29 blob = Blob()
30- blob.chunked = chunks
31+ blob.chunked = list(chunks)
32 if blob.id != expected_sha and blob.data == b"":
33 # Perhaps it's a symlink ?
34 tree = self.tree_cache.revision_tree(revision)
35
36=== modified file 'breezy/revisiontree.py'
37--- breezy/revisiontree.py 2018-11-16 18:33:17 +0000
38+++ breezy/revisiontree.py 2021-02-19 14:54:58 +0000
39@@ -18,9 +18,9 @@
40
41 from __future__ import absolute_import
42
43-from io import BytesIO
44 from . import (
45 lock,
46+ iterablefile,
47 revision,
48 tree,
49 )
50@@ -67,11 +67,11 @@
51
52 def get_file_text(self, path):
53 for (identifier, content) in self.iter_files_bytes([(path, None)]):
54- ret = b"".join(content)
55- return ret
56+ return b"".join(content)
57
58 def get_file(self, path):
59- return BytesIO(self.get_file_text(path))
60+ for (identifier, content) in self.iter_files_bytes([(path, None)]):
61+ return iterablefile.IterableFile(content)
62
63 def is_locked(self):
64 return self._repository.is_locked()

Subscribers

People subscribed via source and target branches