Skip to content
Snippets Groups Projects
Commit 89ded707 authored by Seblu's avatar Seblu
Browse files

better display during repo cleaning

parent 12a4b4ae
No related branches found
No related tags found
No related merge requests found
...@@ -193,10 +193,18 @@ class Repository(object): ...@@ -193,10 +193,18 @@ class Repository(object):
repofiles = set(os.listdir(self.config.path)) - set([self.config.dbname, self.config.lastname]) repofiles = set(os.listdir(self.config.path)) - set([self.config.dbname, self.config.lastname])
dirtyfiles = repofiles - allmd5 dirtyfiles = repofiles - allmd5
if len(dirtyfiles) > 0: if len(dirtyfiles) > 0:
# print dirty files
arrow("Dirty files:")
for f in dirtyfiles:
arrow(f, 1)
# ask confirmation
if not confirm("Remove dirty files? (yes) "): if not confirm("Remove dirty files? (yes) "):
raise Exception("Aborted!") raise Exception("Aborted!")
# start cleaning
arrow("Cleaning")
for f in dirtyfiles: for f in dirtyfiles:
p = os.path.join(self.config.path, f) p = os.path.join(self.config.path, f)
arrow("Removing %s" % p, 1)
try: try:
if os.path.isdir(p): if os.path.isdir(p):
os.rmdir(p) os.rmdir(p)
...@@ -204,6 +212,8 @@ class Repository(object): ...@@ -204,6 +212,8 @@ class Repository(object):
os.unlink(p) os.unlink(p)
except: except:
raise Exception("Removing %s failed" % p) raise Exception("Removing %s failed" % p)
else:
arrow("Nothing to clean")
def delete(self, name, version): def delete(self, name, version):
''' '''
......
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