Skip to content
Snippets Groups Projects
Commit fe139b51 authored by Sebastien Luttringer's avatar Sebastien Luttringer
Browse files

repository check now display corrupted files

parent e14f4680
No related branches found
No related tags found
No related merge requests found
...@@ -232,18 +232,27 @@ class Repository(object): ...@@ -232,18 +232,27 @@ class Repository(object):
if not istools.isfile(self.config.path): if not istools.isfile(self.config.path):
raise Exception("Repository must be local") raise Exception("Repository must be local")
local_files = set(os.listdir(self.config.path)) local_files = set(os.listdir(self.config.path))
local_files.remove(self.config.dbname)
local_files.remove(self.config.lastname)
db_files = set(self.getallmd5()) db_files = set(self.getallmd5())
db_files.add(self.config.dbname) # check missing files
db_files.add( self.config.lastname) arrow("Checking missing files")
# compute missing and unref files list
missing_files = db_files - local_files missing_files = db_files - local_files
unref_files = local_files - db_files
if len(missing_files) > 0: if len(missing_files) > 0:
arrow("Missing files:")
out(os.linesep.join(missing_files)) out(os.linesep.join(missing_files))
# check unreferenced files
arrow("Checking unreferenced files")
unref_files = local_files - db_files
if len(unref_files) > 0: if len(unref_files) > 0:
arrow("Unreferenced files:")
out(os.linesep.join(unref_files)) out(os.linesep.join(unref_files))
# check corruption of local files
arrow("Checking corrupted files")
for f in local_files:
fo = PipeFile(f)
fo.consume()
fo.close()
if fo.md5 != f:
out(f)
def clean(self): def clean(self):
''' '''
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment