From 18bf67317eb246746c1b109ef931043410b60433 Mon Sep 17 00:00:00 2001 From: Philip Lundrigan Date: Wed, 13 Jul 2016 12:58:20 -0600 Subject: [PATCH 1/3] Make error files available in exception --- src/bitrot.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/bitrot.py b/src/bitrot.py index cd92af9..bb0336c 100644 --- a/src/bitrot.py +++ b/src/bitrot.py @@ -178,7 +178,7 @@ class Bitrot(object): new_paths = [] updated_paths = [] renamed_paths = [] - error_count = 0 + errors = [] current_size = 0 missing_paths = self.select_all_paths(cur) paths, total_size = list_existing_paths( @@ -251,7 +251,7 @@ class Bitrot(object): continue if stored_sha1 != new_sha1: - error_count += 1 + errors.append(p) print( '\rerror: SHA1 mismatch for {}: expected {}, got {}.' ' Last good hash checked on {}.'.format( @@ -271,7 +271,7 @@ class Bitrot(object): self.report_done( total_size, all_count, - error_count, + len(errors), new_paths, updated_paths, renamed_paths, @@ -280,9 +280,9 @@ class Bitrot(object): update_sha512_integrity() - if error_count: + if len(errors) > 0: raise BitrotException( - 1, 'There were {} errors found.'.format(error_count), + 1, 'There were {} errors found.'.format(len(errors)), errors, ) def select_all_paths(self, cur): From 6405beaebaf9c3978b9e5450c5f5fdb3f056c46e Mon Sep 17 00:00:00 2001 From: Philip Lundrigan Date: Thu, 14 Jul 2016 08:28:05 -0600 Subject: [PATCH 2/3] Fix if condition --- src/bitrot.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/bitrot.py b/src/bitrot.py index bb0336c..f80cef2 100644 --- a/src/bitrot.py +++ b/src/bitrot.py @@ -280,7 +280,7 @@ class Bitrot(object): update_sha512_integrity() - if len(errors) > 0: + if errors: raise BitrotException( 1, 'There were {} errors found.'.format(len(errors)), errors, ) From 49912e9c9c4e6aaab6304024ae230d999107a847 Mon Sep 17 00:00:00 2001 From: Philip Lundrigan Date: Thu, 14 Jul 2016 08:28:20 -0600 Subject: [PATCH 3/3] Add Phil to authors --- README.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.rst b/README.rst index c4b3303..7d4bbd2 100644 --- a/README.rst +++ b/README.rst @@ -137,5 +137,5 @@ Authors ------- Glued together by `Ɓukasz Langa `_. Multiple -improvements by `Yang Zhang `_ and `Jean-Louis -Fuchs `_. +improvements by `Yang Zhang `_, `Jean-Louis +Fuchs `_ and `Phil Lundrigan `_.