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

improve workspace.remove_file/remove_group, #245 #409

Merged
merged 4 commits into from
Jan 21, 2020

Conversation

kba
Copy link
Member

@kba kba commented Jan 16, 2020

This changes the semantics of the kwargs/CLI params:

remove

  • --keep-file: Whether to keep local file on disk. Defaults to false, so files on disk are deleted by default
  • --force: Do not abort if the file is not found in METS or on disk

remove-group

  • --recursive: also delete containing files. Required for non-empty group
  • --keep-files: Passed as --keep-file to remove
  • --force: Continue removing even if group or containing mets:files not found in METS or any files not found on HDD
# Remove a fileGrp, no matter what:
ocrd workspace remove-group -rf DEFAULT
# Remove mets:file and local file
ocrd workspace remove -f page1_img
# Remove mets:file but keep local file (but don't fail if page1_img doesn't exist in METS)
ocrd wworkspace remove -f -k page1_img

This is not yet finished but I'd appreciate feedback whether this is the right direction, esp. @bertsky @mikegerber E.g. do you want a --recursive option (as it is now) or a --non-recursive option so the default is to remove recursively (empty fileGrp are unlikely).

TODO:

  • remove empty dirs after remove-group
  • remove empty page entries in the structMap after remove

@kba kba requested a review from bertsky January 16, 2020 17:33
@codecov-io
Copy link

codecov-io commented Jan 16, 2020

Codecov Report

Merging #409 into master will increase coverage by 0.41%.
The diff coverage is 93.75%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #409      +/-   ##
==========================================
+ Coverage   84.31%   84.73%   +0.41%     
==========================================
  Files          32       32              
  Lines        1906     1919      +13     
  Branches      372      376       +4     
==========================================
+ Hits         1607     1626      +19     
+ Misses        237      233       -4     
+ Partials       62       60       -2
Impacted Files Coverage Δ
ocrd_models/ocrd_models/ocrd_mets.py 94.54% <87.5%> (+0.87%) ⬆️
ocrd/ocrd/workspace.py 55.83% <95.83%> (+2.85%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 65e3b55...6e9a718. Read the comment docs.

@kba kba merged commit 5944d9e into OCR-D:master Jan 21, 2020
@kba kba deleted the improve-remove-group branch January 21, 2020 14:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants