This commit fixes#119. Summary:
- Depend on packaging to get a good implementation of PEP 440.
- Document new behaviors.
- Add support for migrations.
- Checkout by default the most modern git tag available in the template.
- Reuse `run_tasks` to run migrations too.
- Use `git describe --tags --always` to obtain template commit, to get a version parseable by PEP 440.
- Update `test_updatediff` to with new behaviors.
@Tecnativa TT20357
As explained in #110, the dangling parameters for methods keep on complicating development.
A full code refactoring is too much work for now, but I did a little refactoring which consists in:
- Merge `Flags` into `ConfigData`, and remove anything related exclusively to flags.
- Any method that uses arguments from `ConfigData` gets instead a `conf: ConfigData` argument.
- `get_jinja_renderer()` removed; it's not useful as its little work can easily be done by `Renderer` itself.
This way, whenever we need a new config, we can just add it to `ConfigData` and use it more widely.
A full refactoring is still needed IMHO, where we have a main `Copier` class which handles its state and everything it needs (or it could be `CopierApp` instead), but that's more a design decision to be taken by the project leader.
@Tecnativa TT20357
Otherwise in recent versions it could just produce an error when running, just like this:
```
Traceback (most recent call last):
File "/home/yajo/Documentos/prodevel/doodba-scaffolding/.venv/bin/copier", line 5, in <module>
from copier.cli import CopierApp
File "/home/yajo/Documentos/prodevel/doodba-scaffolding/.venv/lib/python3.7/site-packages/copier/__init__.py", line 3, in <module>
from .main import * # noqa
File "/home/yajo/Documentos/prodevel/doodba-scaffolding/.venv/lib/python3.7/site-packages/copier/main.py", line 14, in <module>
from .config import make_config
File "/home/yajo/Documentos/prodevel/doodba-scaffolding/.venv/lib/python3.7/site-packages/copier/config/__init__.py", line 1, in <module>
from .factory import Flags, make_config # noqa
File "/home/yajo/Documentos/prodevel/doodba-scaffolding/.venv/lib/python3.7/site-packages/copier/config/factory.py", line 9, in <module>
from .user_data import load_answersfile_data, load_config_data, query_user_data
File "/home/yajo/Documentos/prodevel/doodba-scaffolding/.venv/lib/python3.7/site-packages/copier/config/user_data.py", line 7, in <module>
import yaml
ModuleNotFoundError: No module named 'yaml'
```
@Tecnativa TT20357
Fix#88 the easiest way possible. Changes summary:
- A new `--vcs-ref` flag that indicates which commit/ref you want to copy, and only applies when the source directory is git-versioned.
- A new `--no-diff` flag to `copier update` skips the smartypants diff behavior.
What it does?
- Checks you are updating a git-versioned destination from a git-versioned source.
- Clones the destination into temp dir.
- Does a `copier copy -f tmp_src tmp_dst` (yes, a temp dir also).
- Gets the git diff between `tmp_dst` and `dst_path`.
- Performs a normal `copier update dst_path`.
- Applies the git diff at the end, to try to respect downstream project evolution.
@Tecnativa TT20357