diff options
author | Lars Wirzenius <liw@liw.fi> | 2012-03-31 02:26:45 +0100 |
---|---|---|
committer | Lars Wirzenius <liw@liw.fi> | 2012-03-31 02:26:45 +0100 |
commit | a745839d69613e49e032922fa12c41214470d9b2 (patch) | |
tree | 9537afa0d54ebca751ecf8b8fe373f4bef94aa1b /obnamlib/plugins/restore_plugin.py | |
parent | 0698d186a1a5b68233c661bf755a4b4800d27ba9 (diff) | |
download | obnam-a745839d69613e49e032922fa12c41214470d9b2.tar.gz |
Store file data in B-tree if file is short enough
Diffstat (limited to 'obnamlib/plugins/restore_plugin.py')
-rw-r--r-- | obnamlib/plugins/restore_plugin.py | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/obnamlib/plugins/restore_plugin.py b/obnamlib/plugins/restore_plugin.py index 6e68c8ce..9f90a70c 100644 --- a/obnamlib/plugins/restore_plugin.py +++ b/obnamlib/plugins/restore_plugin.py @@ -193,8 +193,15 @@ class RestorePlugin(obnamlib.ObnamPlugin): if self.write_ok: f = self.fs.open('./' + filename, 'wb') summer = self.repo.new_checksummer() - chunkids = self.repo.get_file_chunks(gen, filename) - self.restore_chunks(f, chunkids, summer) + + contents = self.repo.get_file_data(gen, filename) + if contents is None: + chunkids = self.repo.get_file_chunks(gen, filename) + self.restore_chunks(f, chunkids, summer) + else: + f.write(contents) + summer.update(contents) + f.close() correct_checksum = metadata.md5 |