diff options
author | Lars Wirzenius <liw@liw.fi> | 2015-08-20 21:42:13 +0200 |
---|---|---|
committer | Lars Wirzenius <liw@liw.fi> | 2015-08-20 21:42:13 +0200 |
commit | cdbdd7b8d001a7fb7dab492d7cd870b93473cb41 (patch) | |
tree | 62e731b187a8aa5a0773503ae454f681488d6124 /obnamlib/fmt_ga/client.py | |
parent | 20f5a4cfbf9d8b9f8facba05f92ced708b034814 (diff) | |
download | obnam-cdbdd7b8d001a7fb7dab492d7cd870b93473cb41.tar.gz |
Avoid double check due to call to _require_file_exists
Instead, raise the error if it happens when doing the actual work.
Diffstat (limited to 'obnamlib/fmt_ga/client.py')
-rw-r--r-- | obnamlib/fmt_ga/client.py | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/obnamlib/fmt_ga/client.py b/obnamlib/fmt_ga/client.py index 66a71ab5..00c1cd3f 100644 --- a/obnamlib/fmt_ga/client.py +++ b/obnamlib/fmt_ga/client.py @@ -300,10 +300,13 @@ class GAClient(object): def append_file_chunk_id(self, gen_number, filename, chunk_id): self._load_data() - self._require_file_exists(gen_number, filename) generation = self._lookup_generation_by_gen_number(gen_number) metadata = generation.get_file_metadata() - metadata.append_file_chunk_id(filename, chunk_id) + if not metadata.append_file_chunk_id(filename, chunk_id): + raise obnamlib.RepositoryFileDoesNotExistInGeneration( + client_name=self._client_name, + genspec=gen_number, + filename=filename) def clear_file_chunk_ids(self, gen_number, filename): self._load_data() @@ -650,10 +653,12 @@ class GAFileMetadata(object): def append_file_chunk_id(self, filename, chunk_id): if filename in self._added_files: self._added_files.append_file_chunk_id(filename, chunk_id) - return + return True dir_obj, basename = self._get_mutable_dir_obj(filename) if dir_obj: dir_obj.append_file_chunk_id(basename, chunk_id) + return True + return False def clear_file_chunk_ids(self, filename): if filename in self._added_files: |