-
-
Notifications
You must be signed in to change notification settings - Fork 182
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
Exclude on update #1725
Comments
I suppose it's like |
Yes, but also _skip_if_exist has other uses, like ignoring files when migrating a repo that already exists from another template like cookiecutter. |
Skip if exists should work for you here. Even if the file exists from a previous cookiecutter template, the point is that you want to do nothing with the file if it exists. In practical terms, you declare that the template doesn't care about that file contents. Where those contents come from, or whether you're copying or updating shouldn't make a difference here. If you really want that file from the template, then remove it before the first copy. Please feel free to reopen if you still find a valid use case for the requirement. Thank you! |
@yajo sorry, migrating from cookiecutter isn't my use case. I was just pointing out that _skip_if_exists does indeed work for that. My request is still the opposite of that use case. So I'm a bit confused, did you read the original request?
No, the point is I want to do nothing with the file after it was initially created, regardless if it exists. git itself actually does this, so it's a good example. When you run |
@yajo I can't reopen this. Should I submit another request? |
Ah sorry, I thought you had that permission. Quoting a solution from #1718 (comment):
I'll reopen here and close the other issue because this one is easier to follow IMHO. |
Yes, that solution would also work. It is more flexible then what I suggested, I'm just not sure when someone would want to exclude on copy and not on update. I've also never personally had to use recopy. A single |
Hi folks. Now that #1719 is merged, do you still see a use case for this issue? |
Yes. This feature enables two behaviors:
Both are required for generate-once dumb boilerplate to work as intended. |
Actually, I only see issues now with that merged. How do I force a file to be regenerated? What if a user accidently deletes a crucial config file? Here's a common scenario. My template uses tool A. Tool A has a config file to customize feature A. Feature A is optional, so user deletes config file. Tool A upgrades to include feature B. Feature B is critical for future scope of template. I update config file to use feature B. But now because the user deleted the config file, they don't get the updates on update and their repo is now broken and they don't why. They now have to recopy which adds a lot of pain. Do we now need a feature to ensure we always regenerate all the files when we make an update? This all seems silly. The previous behavior was correct. The files should exist or not based purely on the template, not the actions of the end user. |
Actual Situation
I have some files I want generated on copy, but then I want them to be ignored thereafter. I would like the files included on copy but excluded on update. I can do this now, with a regular
copier copy
then passing in exclude when running update,copier update -x files
, but it's an extra hassle to type out all the files to exclude on the command line everytime I update.Desired Situation
A user runs
copier copy
. Some template files are deleted, renamed, completely changed based on use case. User runscopier update
and those files are ignored.Proposed solution
If the copier.yml template included an
_exclude_on_update
option that would be ideal.The text was updated successfully, but these errors were encountered: