* Makes `exclude` configuration templatable.
* Adds a `_copier_operation` variable to the rendering contexts for `exclude` and `tasks`, representing the current operation - either `copy`~~, `recopy`~~ or `update`.
This was proposed here: https://github.com/copier-org/copier/issues/1718#issuecomment-2282643624
When composing templates, it's often needed to be able to load answers from other templates that you know are usually combined with yours. Or any other kind of external data.
@moduon MT-8282
Previously, paths that matched a pattern in `skip_if_exists` and that were deleted in the generated project were recreated during each update. This was expected, because the file now didn't exist, and thus it's considered new. However, it might be surprising to some, so docs are updated and a test now makes that an officially supported use case.
For the rest of files, they shouldn't be recreated, even if the template changed. A user that deletes the file is kind of expressing their will to ignore that file from now on. To recover it, they can just recopy the template.
BREAKING CHANGE: If you delete a file in your subproject, it will not be recreated if it changes in the template and you update the subproject. Recopy if you need it back.
Users should be able to pass CLI data arguments and use a `--data-file` at the same time. Let's just take inspiration from the [helm values file](https://helm.sh/docs/chart_template_guide/values_files/) and give highest priority to data values passed at the command line.
BREAKING CHANGE: Changes the return code for unsafe template error from
2 to 4 to avoid return code collision with Plumbum's `SwitchError` type
errors which use return code 2.
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.
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
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.
* 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