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)
function[source]
function[source]
vcspull.cli.migrate.create_migrate_subparser(parser)

Create vcspull migrate argument subparser.

Parameters:

parser (ArgumentParser)

Return type:

None

vcspull.cli.migrate.migrate_config(config_data, *, dropped_shallow=None)
function[source]
function[source]
vcspull.cli.migrate.migrate_config(config_data, *, dropped_shallow=None)

Separate legacy checkout, backend, and policy settings in every entry.

Parameters:
  • config_data (dict) – Raw configuration data (workspace root → repo name → entry).

  • dropped_shallow (list[tuple[str, str, str]] | None) – Optional accumulator receiving (workspace, repo_name, backend) tuples for stripped non-Git shallow: True settings.

Returns:

The migrated configuration and the number of entries rewritten.

Return type:

tuple[dict, int]

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)
function[source]
function[source]
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:

True if the file was processed successfully, False otherwise.

Return type:

bool

vcspull.cli.migrate.migrate_config_file(config_file_path_str, write, migrate_all=False, *, include_project=True, trust_project=False)
function[source]
function[source]
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:

int