Commit 04da30f
committed
feat(update): keep developer-owned regions with
Replaced the literal comment-marker approach with a language-agnostic Jinja
`{% ignore %}` / `{% endignore %}` tag. The block renders on `copier copy`
but is omitted from the renders Copier produces internally during
`copier update`, so its content stays developer-owned while no Copier syntax
leaks into rendered files.
Because the region is absent from both the old and new template renders that
feed the 3-way merge, template changes inside it never reach the diff and the
developer's own version survives, degrading to a normal Copier conflict only
when the template edits lines directly adjacent to the block.
- Added `IgnoreExtension`, compiling the tag to the equivalent of
`{% if _copier_operation != 'update' %}...{% endif %}`.
- Expose `_copier_operation` in the file render context and merge it with
per-call extra context to avoid duplicate-keyword render errors.
- Removed `copier/_preserve.py` and its `_apply_update` wiring.
- Updated the `updating.md` docs and replaced the tests.{% ignore %} tag (#2184)1 parent 9170be0 commit 04da30f
6 files changed
Lines changed: 293 additions & 591 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
122 | 122 | | |
123 | 123 | | |
124 | 124 | | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
125 | 178 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
45 | 45 | | |
46 | 46 | | |
47 | 47 | | |
48 | | - | |
49 | | - | |
50 | | - | |
51 | | - | |
52 | | - | |
53 | | - | |
| 48 | + | |
54 | 49 | | |
55 | 50 | | |
56 | 51 | | |
| |||
473 | 468 | | |
474 | 469 | | |
475 | 470 | | |
| 471 | + | |
476 | 472 | | |
477 | 473 | | |
478 | 474 | | |
| |||
712 | 708 | | |
713 | 709 | | |
714 | 710 | | |
| 711 | + | |
715 | 712 | | |
716 | 713 | | |
717 | 714 | | |
| |||
857 | 854 | | |
858 | 855 | | |
859 | 856 | | |
860 | | - | |
| 857 | + | |
861 | 858 | | |
862 | 859 | | |
863 | 860 | | |
| |||
1180 | 1177 | | |
1181 | 1178 | | |
1182 | 1179 | | |
1183 | | - | |
| 1180 | + | |
1184 | 1181 | | |
1185 | 1182 | | |
1186 | 1183 | | |
| |||
1400 | 1397 | | |
1401 | 1398 | | |
1402 | 1399 | | |
1403 | | - | |
1404 | | - | |
1405 | | - | |
1406 | | - | |
1407 | | - | |
1408 | | - | |
1409 | | - | |
1410 | | - | |
1411 | | - | |
1412 | | - | |
1413 | | - | |
1414 | | - | |
1415 | | - | |
1416 | | - | |
1417 | 1400 | | |
1418 | 1401 | | |
1419 | 1402 | | |
| |||
1467 | 1450 | | |
1468 | 1451 | | |
1469 | 1452 | | |
1470 | | - | |
1471 | | - | |
1472 | | - | |
1473 | | - | |
1474 | 1453 | | |
1475 | 1454 | | |
1476 | 1455 | | |
| |||
1491 | 1470 | | |
1492 | 1471 | | |
1493 | 1472 | | |
1494 | | - | |
1495 | | - | |
1496 | | - | |
1497 | | - | |
1498 | 1473 | | |
1499 | 1474 | | |
1500 | 1475 | | |
| |||
This file was deleted.
0 commit comments