Rev 2158: Lazily fetch file contents, to avoid consuming too much memory. in http://people.samba.org/bzr/jelmer/bzr-svn/0.5
Jelmer Vernooij
jelmer at samba.org
Thu Dec 4 20:52:55 GMT 2008
At http://people.samba.org/bzr/jelmer/bzr-svn/0.5
------------------------------------------------------------
revno: 2158
revision-id: jelmer at samba.org-20081204205252-anocnnwco3dfo9kq
parent: jelmer at samba.org-20081204200609-fomeo3ti1msiad5o
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: 0.5
timestamp: Thu 2008-12-04 21:52:52 +0100
message:
Lazily fetch file contents, to avoid consuming too much memory.
modified:
commit.py commit.py-20060607190346-qvq128wgfubhhgm2-1
=== modified file 'commit.py'
--- a/commit.py 2008-12-03 19:12:18 +0000
+++ b/commit.py 2008-12-04 20:52:52 +0000
@@ -263,7 +263,7 @@
# handle the file
if child_ie.file_id in modified_files:
file_editor_send_changes(child_ie.file_id,
- modified_files[child_ie.file_id], child_editor)
+ modified_files[child_ie.file_id](child_ie), child_editor)
if child_editor is not None:
child_editor.close()
@@ -701,10 +701,14 @@
if (ie.file_id in self.old_inv and ie == self.old_inv[ie.file_id] and
(ie.kind != 'directory' or ie.children == self.old_inv[ie.file_id].children)):
return self._get_delta(ie, self.old_inv, self.new_inventory.id2path(ie.file_id)), version_recorded
+ def get_symlink_contents(ie):
+ return "link %s" % ie.symlink_target
+ def get_file_contents(ie):
+ return tree.get_file_text(ie.file_id)
if ie.kind == 'file':
- self.modified_files[ie.file_id] = tree.get_file_text(ie.file_id)
+ self.modified_files[ie.file_id] = get_file_contents
elif ie.kind == 'symlink':
- self.modified_files[ie.file_id] = "link %s" % ie.symlink_target
+ self.modified_files[ie.file_id] = get_symlink_contents
elif ie.kind == 'directory':
self.visit_dirs.add(ie.file_id)
fid = ie.parent_id
More information about the bazaar-commits
mailing list