Merge pull request #17 from philipbl/error_files
Make bad files available in exception
This commit is contained in:
commit
bfb73acc70
@ -137,5 +137,5 @@ Authors
|
|||||||
-------
|
-------
|
||||||
|
|
||||||
Glued together by `Łukasz Langa <mailto:lukasz@langa.pl>`_. Multiple
|
Glued together by `Łukasz Langa <mailto:lukasz@langa.pl>`_. Multiple
|
||||||
improvements by `Yang Zhang <mailto:yaaang@gmail.com>`_ and `Jean-Louis
|
improvements by `Yang Zhang <mailto:yaaang@gmail.com>`_, `Jean-Louis
|
||||||
Fuchs <mailto:ganwell@fangorn.ch>`_.
|
Fuchs <mailto:ganwell@fangorn.ch>`_ and `Phil Lundrigan <mailto:philipbl@cs.utah.edu>`_.
|
||||||
|
@ -178,7 +178,7 @@ class Bitrot(object):
|
|||||||
new_paths = []
|
new_paths = []
|
||||||
updated_paths = []
|
updated_paths = []
|
||||||
renamed_paths = []
|
renamed_paths = []
|
||||||
error_count = 0
|
errors = []
|
||||||
current_size = 0
|
current_size = 0
|
||||||
missing_paths = self.select_all_paths(cur)
|
missing_paths = self.select_all_paths(cur)
|
||||||
paths, total_size = list_existing_paths(
|
paths, total_size = list_existing_paths(
|
||||||
@ -251,7 +251,7 @@ class Bitrot(object):
|
|||||||
continue
|
continue
|
||||||
|
|
||||||
if stored_sha1 != new_sha1:
|
if stored_sha1 != new_sha1:
|
||||||
error_count += 1
|
errors.append(p)
|
||||||
print(
|
print(
|
||||||
'\rerror: SHA1 mismatch for {}: expected {}, got {}.'
|
'\rerror: SHA1 mismatch for {}: expected {}, got {}.'
|
||||||
' Last good hash checked on {}.'.format(
|
' Last good hash checked on {}.'.format(
|
||||||
@ -271,7 +271,7 @@ class Bitrot(object):
|
|||||||
self.report_done(
|
self.report_done(
|
||||||
total_size,
|
total_size,
|
||||||
all_count,
|
all_count,
|
||||||
error_count,
|
len(errors),
|
||||||
new_paths,
|
new_paths,
|
||||||
updated_paths,
|
updated_paths,
|
||||||
renamed_paths,
|
renamed_paths,
|
||||||
@ -280,9 +280,9 @@ class Bitrot(object):
|
|||||||
|
|
||||||
update_sha512_integrity()
|
update_sha512_integrity()
|
||||||
|
|
||||||
if error_count:
|
if errors:
|
||||||
raise BitrotException(
|
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):
|
def select_all_paths(self, cur):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user