19 Commits

Author SHA1 Message Date
Sigurd Spieckermann
ef5ea4b212 refactor: rename internal modules with a _ prefix 2025-04-22 13:52:51 +02:00
Sigurd Spieckermann
ede686561d test: use helper function to load answers file data 2025-03-07 12:21:36 +01:00
Chris Brown
44e67289c8
fix: ignore $file if $file.tmpl exists when subdirectory is used 2025-02-26 17:20:02 +01:00
Sigurd Spieckermann
0258635da7 fix: support Git config without user identity 2024-07-30 13:40:17 +02:00
Timothée Mazzucotelli
c47ce39157 tests: Move git_init function into helpers 2023-11-22 15:34:24 +00:00
Sigurd Spieckermann
bc1dfc0419 build(typing): add missing type hints 2023-10-01 07:43:04 +01:00
Sigurd Spieckermann
a82c0ad6bf
refactor: drop support for Python 3.7 (#1252) 2023-07-18 19:59:05 +01:00
Sigurd Spieckermann
295d35ac88 style: use Literal with multiple args instead of union of Literal 2023-07-17 11:56:47 +02: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
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
Jairo Llopis
0ff512e87b refactor(inline): smarter inline conflict markers algorithm
Instead of 2 completely different implementations, just reuse the good old rej one.

However, now, after updating, search for `.rej` files and 3-way-merge those (and only those).

This will save a lot of loops, time, memory and disk I/O. Also it's shorter. Good!

Fixes https://github.com/copier-org/copier/issues/883.
2023-01-15 17:54:50 +00:00
Barry Hart
504301c28e
feat: experimental inline conflict markers when updating
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>
2022-11-14 05:09:23 +00:00
Timo Furrer
5ab752c11f
feat: keep trailing newlines for Jinja templates by default (#465)
Closes #464
2021-10-31 07:28:43 +00:00
Yajo
ee684ee6fa fix: make test more explicit 2021-10-23 18:19:02 +01:00
Brian Burgin
78e8e90208 feat: support subdirectory update 2021-10-23 18:19:02 +01:00
Dennis Roche
a1fcccf906 test: Replace force=True with defaults=True, overwrite=True 2021-07-02 15:34:51 +01:00
Jairo Llopis
1482de4972
wip 2021-03-05 17:33:11 +00:00
Jairo Llopis
0441b86f0c
Refactor (#314)
* Refactor
* Fix #110.
* Rewrite test_config_exclude, test_config_exclude_overridden and test_config_include. These tests were badly designed, using a monkeypatch that would never happen in the real world, and actually producing false positives. I moved them to test_exclude.py and rewritten to test the what and not the how.
* Fix #214 by removing skip option. Relevant tests use the better skip_if_exists=["**"].
* Remove subdirectory flag from API/CLI. It was confusing and could lead to bad maintenance situations. Fixes #315.
* Remove extra_paths and fix #321
* Remember that you cannot use _copier_conf.src_path as a path now
* use dataclasses
* Create errors module, simplify some tests, fix many others
* Fix some tests, complete EnvOps removal
* Fix #214 and some tests related to it
* Reorder code
* Update docs and imports
* Modularize test_complex_questions
* Interlink worker and questionary a bit better
* Removal of Questionary class, which only had 1 meaningful method that is now merged into Worker to avoid circular dependencies.
* Fix #280 in a simple way: only user answers are type-casted inside API, and CLI transforms all `--data` using YAML always. Predictable.
* Use prereleases correctly.
* Reorder AnswersMap to have a more significative repr.
* Simpler cache for old `Question.get_choices()` method (renamed now).
* fix wrong test
* Fix test_subdirectory
* Fix test_tasks (and remove tests/demo_tasks)
* Fix path filter tests, and move it to test_exclude, where it belongs
* Make test_config pass
* Fix more wrongly designed tests
* Use cached_property backport if needed
* xfail test known to fail on mac
* force posix paths on windows
* Add typing_extensions for python < 3.8
* Sort dependencies in pyproject.toml
* Support python 3.6 str-to-datetime conversion
* Workaround https://bugs.python.org/issue43095
* xfail test_path_filter on windows
* Upgrade mkdocs and other dependencies to fix https://github.com/pawamoy/mkdocstrings/issues/222
* Add missing reference docs.
* Add workaround for https://github.com/pawamoy/mkdocstrings/pull/209
* Docs.
* Remove validators module
* Add workaround for https://github.com/pawamoy/mkdocstrings/issues/225
* Restore docs autorefs as explained in https://github.com/pawamoy/mkdocstrings/issues/226#issuecomment-775413562.
* Workaround https://github.com/pawamoy/pytkdocs/issues/86
2021-02-09 18:22:47 +00:00
Timothée Mazzucotelli
c4b38a1ec6 Add subdirectory option
Co-authored-by: Jairo Llopis <Yajo@users.noreply.github.com>
2020-05-20 19:41:10 +02:00