Migrate command internals¶
vcspull.cli.migrate is the implementation behind
vcspull migrate — it rewrites deprecated configuration
shapes in place.
Migrate configuration to checkout targets and backend option blocks.
-
vcspull.cli.migrate.create_migrate_subparser(parser)¶vcspull.cli.migrate.create_migrate_subparser(parser)¶
Create
vcspull migrateargument subparser.- Parameters:
parser (
ArgumentParser)- Return type:
-
vcspull.cli.migrate.migrate_config(config_data, *, dropped_shallow=None)¶vcspull.cli.migrate.migrate_config(config_data, *, dropped_shallow=None)¶
Separate legacy checkout, backend, and policy settings in every entry.
- Parameters:
- Returns:
The migrated configuration and the number of entries rewritten.
- Return type:
Examples
>>> migrate_config( ... {"~/code/": {"flask": {"repo": "git+ssh://x", "shallow": True}}} ... ) ({'~/code/': {'flask': {'repo': 'git+ssh://x', 'git': {'depth': 1}}}}, 1)
An already-migrated config is returned unchanged:
>>> migrate_config( ... {"~/code/": {"flask": {"repo": "git+ssh://x", "git": {"depth": 1}}}} ... ) ({'~/code/': {'flask': {'repo': 'git+ssh://x', 'git': {'depth': 1}}}}, 0)
-
vcspull.cli.migrate.migrate_single_config(config_file_path, write, *, trust_project=False, explicit=True)¶vcspull.cli.migrate.migrate_single_config(config_file_path, write, *, trust_project=False, explicit=True)¶
Migrate a single vcspull configuration file.
- Parameters:
config_file_path (
pathlib.Path) – Path to config file.write (
bool) – Whether to write changes back to file.trust_project (
bool) – Trust an escaping project config without prompting.explicit (
bool) – The caller named this file with--file.
- Returns:
Trueif the file was processed successfully,Falseotherwise.- Return type:
-
vcspull.cli.migrate.migrate_config_file(config_file_path_str, write, migrate_all=False, *, include_project=True, trust_project=False)¶vcspull.cli.migrate.migrate_config_file(config_file_path_str, write, migrate_all=False, *, include_project=True, trust_project=False)¶
Migrate configuration files and return zero when every file succeeds.
- Parameters:
config_file_path_str (
str|None) – Path to config file, or None to use the default.write (
bool) – Whether to write changes back to file.migrate_all (
bool) – If True, migrate all discovered config files.include_project (
bool) – Include.vcspull.*files found above the working directory.trust_project (
bool) – Trust escaping project configs without prompting.
- Returns:
Zero on success, one when discovery or any migration fails.
- Return type: