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
Don't checkout anything by default on local templates #184
Comments
This is important because copier uses git tags to handle upgrades. Also, copier needs a ref to be saved into the However, I agree this is a little pain point for template development. One thing I do is:
For unit tests, however, I simply use this pytest fixture, which clones the current template into a temporary directory, including dirty changes, applies a Copier could include a |
That would be great 🙂 I totally get why the checkouts are important for being able to update the generated projects, though if users could disable it it could really facilitate the development! |
It's especially annoying when you have tests for your template: you must commit before running the tests 🤣 ! |
Not with that fixture provided above. Although you're right this should be fixed. |
Oh yes, thank you! I happen to have written my tests in a simple shell script though 😅 But I'll use your fixture if I convert them to a pytest suite. |
You can also emulate that fixture as a bash function, it's quite easy. |
I'm thinking that a good fix might be to supply that fixture with Copier, so downstream templates can reuse it. |
As suggested in #412, could we make these two commands behave differently?
use the local changes instead of the git repo if
as-is If that isn't possible (or what you prefer) then perhaps a flag As a user I want to be able to test templates quickly/iteratively using existing cli tool (not via pytest fixture) |
Yes, well that makes sense indeed. However, I cannot predict what you want to test. Is it a copy, a recopy or an update? Besides, when copying a non-git template, the results and features are different, so you could get to unexpected results when comparing your dev with production environments. However I guess that we can make this assumption: if the template is a local directory and it is dirty, you're developing the template, so you're going to want to test those dirty changes, so Copier could take the freedom to do the wip commit dance automatically and print a warning so you are aware of that. |
I'd also really like to see this feature in some kind.
This should only be relevant during development of templates. Depending on your workflow there is still the option to run a commit as soon as you assume you are finshed and run a "real life test with git" before publishing. |
Those are OK until somebody creates a branch named I think I still prefer the suggestion from #184 (comment). |
- if a template is vcs-tracked and dirty, the changes are committed automatically with a "wip" commit and propagated to the subproject - user is warned in this scenario - tests for copy and update on dirty templates fixes #184
I'm currently translating a cookiecutter template to a copier one, and each time I change something, I have to commit the change for copier to pick it up. At first it was confusing ("why did files that I removed were copied??"), and now it's annoying (a "wip" commit for every change, and then I'll have to squash them or something).
I think it's because copier tries to checkout the latest tag? I'd like it not to do anything if I don't specify the
-r, --vcs-ref
option.The text was updated successfully, but these errors were encountered: