---
myst:
  html_meta:
    "description": "Upgrade a repository from repoplone 1 to repoplone 2, and migrate its repository.toml from specification 1 to specification 2."
    "property=og:description": "Upgrade a repository from repoplone 1 to repoplone 2, and migrate its repository.toml from specification 1 to specification 2."
    "property=og:title": "Migrate from repoplone 1"
    "keywords": "Plone, repoplone, upgrade, migrate, repository.toml, specification 2"
---

(how-to-migrate-from-1x)=

# Migrate from repoplone 1

This guide shows you how to move a repository from repoplone 1 to repoplone 2.
The move has two independent steps: upgrade the tool, then migrate `repository.toml` when you are ready.

(how-to-migrate-from-1x-upgrade)=

## Upgrade repoplone

Run repoplone 2 against the repository as it is.

```shell
uvx repoplone@2.0.0a2 versions current
```

A `repository.toml` without a `spec_version` key follows specification 1.
repoplone 2 reads it as repoplone 1 did, with the same release steps, the same changelog headings, and the same version labels.

repoplone warns about settings that specification 2 drops: `repository.managed_by_uv`, `backend.path`, `frontend.path`, and a `repository.compose` written as a string.
The warnings block nothing.
They list what the migration will change.

(how-to-migrate-from-1x-preview)=

## Preview the migration

Print the migrated file without writing it.

```shell
uvx repoplone settings migrate --dry-run
```

The command lists every change it makes.
It does the following.

- It adds `spec_version = "2"` at the top of the file.
- It turns `[backend.package]` and `[frontend.package]` into `[[package]]` tables, each with its `type` and `primary = true`.
- It turns `compose` into a list.
- It removes `repository.managed_by_uv`, `backend.path`, and `frontend.path`.
- It moves each package's `towncrier_settings` and `section` into its `towncrier` table, as `towncrier.settings` and `towncrier.section`.
- It removes `repository.towncrier.enabled`, and removes a `[repository.towncrier]` table that names no settings file, because specification 1 treated such a table as off.
- It renames the release step ids `release_backend` and `release_frontend` to `release_python` and `release_node`.

It keeps the comments and the layout of the file.
It leaves tables it does not know, such as `[cookieplone]`, alone.

(how-to-migrate-from-1x-apply)=

## Migrate the file

Write the migrated file, then validate it.

```shell
uvx repoplone settings migrate
uvx repoplone settings sanity-check
```

The command validates the result against the specification 2 schema before it writes anything.

(how-to-migrate-from-1x-review)=

## Review the result

Check these points before you commit the new file.

Release step ids
: A specification 2 file accepts only `release_python` and `release_node`.
  Update scripts and CI jobs that pass `--start-step release_backend` or `--start-step release_frontend`.
  `--start-step` still accepts the old ids.

Changelog headings
: In the repository changelog, package sections are now titled with the package name instead of `Backend` and `Frontend`.
  To keep an old heading, add `towncrier.section = "Backend"` or `towncrier.section = "Frontend"` to the package.

Comments
: A comment between the end of `[frontend.package]` and the next table can be lost.
  The command reports each such comment so you can restore it.

Release hooks
: `settings.backend` and `settings.frontend` still return the primary package of each family.
  Existing `local_step` hooks keep working.

(how-to-migrate-from-1x-components)=

## Declare components

To develop the packages in more than one app, add components after the migration.
`--components` writes the derived `backend` and `frontend` components as tables.
It works on a file that is already in specification 2.

```shell
uvx repoplone settings migrate --components
```

```{seealso}
- {doc}`declare-several-frontends`, to go on from there.
- {doc}`/reference/repository-toml-spec-1`, for each specification 1 key and its specification 2 form.
- {doc}`/explanation/repository-model`, for why specification 2 exists.
```
