I've disabled the use of unsafe features (Jinja extensions, migrations, and tasks) by default and added a new CLI switch `--UNSAFE` which enables them. Templates that don't use unsafe features are unaffected by this change. But Copier will raise an error for templates that do use unsafe features unless the `--UNSAFE` flag is passed.
I've not added an interactive prompt that asks for consent for using unsafe features because I think it's not clear how to distinguish between interactive prompting and raising an error when `--UNSAFE` is not passed. For this, I think Copier would need a switch that clearly states whether interactive or non-interactive mode is desired. Currently, `--defaults` implies this for questions.
Fixes https://github.com/copier-org/copier/issues/1137
BREAKING CHANGE: Copier raises an error when a template uses unsafe features unless the `--UNSAFE` switch is passed
Now that the inline mode is out of experimental, it turns out to provide a better default behavior than the good old rej mode. Mostly when context is increased to 3 lines or more.
BREAKING CHANGE: The default update conflict mode is now `inline` instead of `rej`.
BREAKING CHANGE: By default, updates now consider 3 lines of context instead of just 1.
This new command allows to reapply a template, keeping old answers but discarding subproject evolution.
It is useful when there are bugs replaying an old version of the template, or when the subproject has drifted too much from the template and you need to reset it.
BREAKING CHANGE: All CLI calls to Copier must now include the subcommand as the 1st argument. For example, `copier` must become now `copier update`; also `copier ./tpl ./dst` must become `copier copy ./tpl ./dst`.
BREAKING CHANGE: All flags must go after the subcommand now. For example, `copier -r HEAD update ./dst` must now become `copier update -r HEAD ./dst` or `copier update ./dst -r HEAD`.
BREAKING CHANGE: Automatic mode removed. Since now subcommands are required, the automatic mode is removed.
BREAKING CHANGE: Deprecated `copier.copy` function is removed. Use `copier.run_copy`, `copier.run_update` or `copier.run_recopy` explicitly as needed.
Fix https://github.com/copier-org/copier/issues/1081
Close https://github.com/copier-org/copier/issues/1082
Until today, the updatediff algorithm always used just 1 line of context when detecting conflicts. This was because:
- Solving conflicts wasn't very ergonomic with those `.rej` files around.
- More lines meant too many conflicts usually.
However, it made the diff detection less accurate.
With this change, we allow the users to configure that algorithm. Since they have now the `--context inline` option, more conflicts isn't so much of a problem.
@moduon MT-2638
Many folks are not very comfortable with nix yet, so let's document how they can use it in their pipelines with more widely-known tools such as Docker and Podman.
Fixes https://github.com/copier-org/copier/issues/457.
This was the intended and documented behavior, but at some point it got broken.
Well, now it's tested and it works.
Besides, there's a new FAQ to avoid further surprises.
Fixes https://github.com/copier-org/copier/issues/787
When questions didn't have a default answer, the interactive behavior was confusing.
Fixes https://github.com/copier-org/copier/issues/355.
BREAKING CHANGE: All default answers must be explicit now.
* refactor: check if the repository is a shallow clone
* refactor: emit a warning for shallow clones
* docs: add faq entry for high resource consumption with shallow clone
* refactor: define a specific warning for shallow clones
* fix: lint after rebase
* feat(Worker): make sure the parent directory of the target file exists before writing to it
* feat(_copier_conf): add directory separator (os.sep) to _copier_conf
Fix#692
Fixes#613
Based on #627, but:
* Supports both old (`.rej` files) and new (inline markers) conflict behavior
* Update a test to test both rej and inline conflict resolution
* Update some tests to explicitly specify "rej" conflict mode
* Add documentation for the two conflict modes
* keeping only 3-way merge
Co-authored-by: Oleh Prypin <oprypin@users.noreply.github.com>
Co-authored-by:
Thierry Guillemot <tguillemot@users.noreply.github.com>
Co-authored-by: Barry Hart <barry.hart@zoro.com>
Co-authored-by: Jairo Llopis <yajo.sk8@gmail.com>
Co-authored-by: Timothée Mazzucotelli <pawamoy@pm.me>
* docs: add note to docstring
* feat: print spawn logs on failure, and fix failure in test
The test was failing because it turns out that `tui` won't print letters that must not change, when running an interactive TUI.
I changed the error message for something that will force all letters to change. This way it works as expected.
Co-authored-by: Jairo Llopis <yajo.sk8@gmail.com>