Skip to content
Snippets Groups Projects

ENH: treat case of removed files

Merged Henrik tom Wörden requested to merge f-move into dev
All threads resolved!
@@ -63,14 +63,20 @@ def rename(changes, chunksize=10):
@@ -63,14 +63,20 @@ def rename(changes, chunksize=10):
cont = db.Container()
cont = db.Container()
for _, (old, new) in chunk.iterrows():
for _, (old, new) in chunk.iterrows():
cont.append(db.File(path=old))
try:
fi = db.File(path=old)
cont.retrieve()
fi.retrieve()
for fi, (_, (old, new)) in zip(cont, chunk.iterrows()):
if not fi.is_valid():
assert fi.path == old
continue
fi.path = new
assert fi.path == old
cont.update()
fi.path = new
 
cont.append(fi)
 
except Exception as e:
 
print(e)
 
 
if len(cont) > 0:
 
cont.update(unique=False)
i += 1
i += 1
Loading