Skip to content

Commit 198ab4a

Browse files
committed
fix(updating)!: do not run tasks after project update
Running tasks after an update mixes concerns with post-copy tasks and post-update migration tasks. BREAKING CHANGE: Copier no longer runs tasks after updating a project. Use post-update migration tasks instead.
1 parent 9968eda commit 198ab4a

3 files changed

Lines changed: 2 additions & 6 deletions

File tree

copier/_main.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1548,10 +1548,6 @@ def _apply_update(self) -> None: # noqa: C901
15481548
subproject_subdir / self.answers_relpath,
15491549
)
15501550

1551-
if not self.skip_tasks:
1552-
with Phase.use(Phase.TASKS):
1553-
self._execute_tasks(self.template.tasks)
1554-
15551551
# Run post-migration tasks.
15561552
with Phase.use(Phase.MIGRATE):
15571553
self._execute_tasks(

docs/updating.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ project_half("half migrated<br>project")
132132
project_updated("updated project")
133133
project_full("fully updated<br>and migrated project")
134134
135-
update["3-way merge<br>& run tasks again"]
135+
update["3-way merge"]
136136
regen_current["generate and run tasks"]
137137
regen_latest["generate and run tasks"]
138138

tests/test_legacy_migration.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ def test_migrations_and_tasks(tmp_path: Path, skip_tasks: bool) -> None:
7979
assert not (dst / "created-with-tasks.txt").exists()
8080
assert (dst / "delete-in-tasks.txt").exists()
8181
else:
82-
assert (dst / "created-with-tasks.txt").read_text() == "task 1\ntask 2\n" * 2
82+
assert (dst / "created-with-tasks.txt").read_text() == "task 1\ntask 2\n"
8383
assert not (dst / "delete-in-tasks.txt").exists()
8484
assert not (dst / "delete-in-migration-v2.txt").exists()
8585
assert not (dst / "migrations.py").exists()

0 commit comments

Comments
 (0)