Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ENH: upload: --existing=overwrite-metadata to upload fresh metadata even if file already there #355

Closed
wants to merge 4 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
BF+RF: simplify logic for overwrite-metadata + allow to upload when n…
…o mtime known
  • Loading branch information
yarikoptic committed Feb 2, 2021
commit 91b2af717126d1e682479e46eb870af84cdb3236
24 changes: 13 additions & 11 deletions dandi/upload.py
Original file line number Diff line number Diff line change
Expand Up @@ -363,17 +363,16 @@ def ensure_folder():
yield skip_file(exists_msg)
return
# Logic below only for overwrite and reupload
if existing in ("overwrite", "overwrite-metadata"):
if existing == "overwrite":
if remote_file_status == "same":
if existing == "overwrite":
yield skip_file(exists_msg)
return
elif existing == "overwrite-metadata":
metadata_only = True
else:
raise RuntimeError(
f"Must have not got here with unknown {existing}"
)
yield skip_file(exists_msg)
return
elif existing == "overwrite-metadata":
if remote_file_status in ("same", "no mtime"):
metadata_only = True
else:
yield skip_file("File exists but known to differ")
return
elif existing == "refresh":
if not remote_file_status == "older":
yield skip_file(exists_msg)
Expand All @@ -396,7 +395,10 @@ def ensure_folder():
if not file_recs:
yield skip_file("File does not exist!")
return
if remote_file_status != "same":
if remote_file_status == "no mtime":
# just inform about the fact and proceed
yield {"message": "file is missing mtime info"}
elif remote_file_status != "same":
yield skip_file("File is not the same!")
return

Expand Down