Skip to content
Snippets Groups Projects
Commit 8a7d617e authored by Henrik tom Wörden's avatar Henrik tom Wörden
Browse files

ENH: treat case of removed files

parent 7869272c
Branches
Tags
1 merge request!5ENH: treat case of removed files
Pipeline #5618 failed
This commit is part of merge request !5. Comments created here will be created in the context of that merge request.
...@@ -62,15 +62,28 @@ def rename(changes, chunksize=10): ...@@ -62,15 +62,28 @@ def rename(changes, chunksize=10):
continue continue
cont = db.Container() cont = db.Container()
for _, (old, new) in chunk.iterrows(): cmap = {}
cont.append(db.File(path=old))
for ii, (old, new) in chunk.iterrows():
cont.retrieve() try:
fi = db.File(path=old)
for fi, (_, (old, new)) in zip(cont, chunk.iterrows()): fi.retrieve()
assert fi.path == old
fi.path = new if not fi.is_valid():
cont.update() continue
cont.append(fi)
cmap[ii] = len(cont)-1
except Exception as e:
print(e)
for ii, (old, new) in chunk.iterrows():
if ii not in cmap:
continue
assert cont[cmap[ii]].path == old
cont[cmap[ii]].path = new
if len(cont) > 0:
cont.update(unique=False)
i += 1 i += 1
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment