diff options
author | Lars Wirzenius <liw@liw.fi> | 2015-12-06 16:07:49 +0100 |
---|---|---|
committer | Lars Wirzenius <liw@liw.fi> | 2015-12-06 16:40:16 +0100 |
commit | 94803f3ebd6d13e56469e025ae5414658566bc42 (patch) | |
tree | 413b215acfadd636405482e29eeb27b612c8678a | |
parent | f3f76551bc80ac501040a5b3b9900efc897f669d (diff) | |
download | obnam-94803f3ebd6d13e56469e025ae5414658566bc42.tar.gz |
Refactor: Move metadata.md5 assignment into method
-rw-r--r-- | obnamlib/plugins/backup_plugin.py | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/obnamlib/plugins/backup_plugin.py b/obnamlib/plugins/backup_plugin.py index 2f20154d..88134a2d 100644 --- a/obnamlib/plugins/backup_plugin.py +++ b/obnamlib/plugins/backup_plugin.py @@ -443,8 +443,7 @@ class BackupPlugin(obnamlib.ObnamPlugin): self.backup_metadata(pathname, metadata) if stat.S_ISREG(metadata.st_mode): - assert metadata.md5 is None - metadata.md5 = self.backup_file_contents(pathname, metadata) + self.backup_file_contents(pathname, metadata) self.backup_metadata(pathname, metadata) def open_fs(self, root_url): @@ -708,7 +707,7 @@ class BackupPlugin(obnamlib.ObnamPlugin): def backup_file_contents(self, filename, metadata): '''Back up contents of a regular file. - Return MD5 checksum of file's complete data. + Sets the whole-file MD5 checksum in metadata as a side effect. ''' @@ -759,7 +758,7 @@ class BackupPlugin(obnamlib.ObnamPlugin): self.app.dump_memory_profile('at end of file content backup for %s' % filename) tracing.trace('done backing up file contents') - return summer.digest() + metadata.md5 = summer.digest() def backup_file_chunk(self, data): '''Back up a chunk of data by putting it into the repository.''' |