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

Allow creation of a bag if the directory already exists. #12

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

RKrahl
Copy link
Contributor

@RKrahl RKrahl commented Oct 26, 2015

Resolve #7.

This is a minimal version of a possible implementation. For the moment, it only adds a "create" flag to the constructor, as discussed in the issue, and ignores OSErrors from mkdir if the directory already exists in _create_bag(). It does not check whether any of the meta files (bagit.txt, ...) in the bag directory already exist and boldly overwrites them. Thanks to the constructor flag, it does not change the behavior of pybagit, unless explicitly requested.

I think, there are three possible ways to proceed from here:

  1. Take the PR as it is now. It does the job and fits at least for my use case. I care only for using already existing data, but not for meta files. This works now.
  2. Check if any meta file exists in the bag directory and throw an error if this is the case. This would prevent overwriting existing files.
  3. If any meta file exists, read it and adapt the newly created bag accordingly rather then writing this file.

Nr. 3 could become cumbersome and I'm not sure whether there is any real use case for it.

Any opinions?

@RKrahl
Copy link
Contributor Author

RKrahl commented Nov 25, 2015

Ping!

Could you have a look at the PR and comment on which variant you would prefer?

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.

1 participant