7 Commits

Author SHA1 Message Date
Sigurd Spieckermann
0258635da7 fix: support Git config without user identity 2024-07-30 13:40:17 +02:00
Jairo Llopis
6dde037423 refactor: overwrite always on updates
Updates not only overwrite files when actually updating, but also when applying the git diff.

Since only git-tracked subprojects can be updated, in reality there's no problem when overwriting. I find myself always overwriting and later fixing stuff with git tools.

BREAKING CHANGE: Updates will overwrite existing files always. If you need to select only some files, just use `git mergetool` or `git difftool` after updating.

BREAKING CHANGE: Flag `--overwrite/-w` disappeared from `copier update`. It is now implicit.

BREAKING CHANGE: To update via API, `overwrite=True` is now required.

Fix https://github.com/copier-org/copier/issues/741.
2023-05-30 07:34:22 +01:00
Jairo Llopis
6996b9cc7a feat: add recopy command and function
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
2023-05-17 11:56:13 +01:00
Sigurd Spieckermann
a1539c9592
fix: delete conditionally created file when answer changes (#982)
In reality, this is just a test to make sure the feature isn't lost. However, the issue got fixed in some recent refactoring.

Fixes https://github.com/copier-org/copier/issues/686
2023-04-01 14:17:04 +01:00
Sigurd Spieckermann
b352841046 test: add return type hints 2023-03-31 06:27:36 +01:00
Sigurd Spieckermann
5029b6e7a9
test: add type hints and clean up (#985)
* refactor(tests): add type hints and clean up

* fix: import `Protocol` from `typing-extensions` when using Python 3.7

* fix: import `Literal` from `typing-extensions` when using Python 3.7

* refactor(tests): create template and subproject directory using `tmp_path_factory` fixture

* refactor(tests): use OS-agnostic file path separator

* refactor(tests): use `/` separator for `skip_if_exists` paths

* style: fix formatting error

* refactor(tests): expect POSIX path for local repo URL
2023-03-21 16:31:11 +00:00
Raphael Krupinski
7e0def6729
fix: don't attempt to render a file if its name is empty
* Fix: remove template_suffix from rendered name before checking for empty parts.

Fixes #929

* Use is_template

Co-authored-by: Jairo Llopis <973709+yajo@users.noreply.github.com>

* style(main): format code

* test(test_conditional): rename test_conditional.py to more specific name

---------

Co-authored-by: Jairo Llopis <973709+yajo@users.noreply.github.com>
2023-01-28 16:56:02 +00:00