## upgrade.apply_upgrade()


Execute a plan from [plan_upgrade](upgrade.plan_upgrade.md#tether.upgrade.plan_upgrade).


Usage

``` python
upgrade.apply_upgrade(
    repo,
    plan,
)
```


One migration brings any older format to the current version; its parts run on what the dataset shows, `tether.toml` records the version once at the end, and one VCS commit lands it. A part that renames native refs fails *closed*: if any store rename fails, it stops before rewriting history or the manifests, so both sides keep naming the old refs; the renames that did succeed are logged and skipped on the next run. Rewriting history changes commit ids: every other clone must re-sync.


## Raises


`ConfigError`  
Not an upgrade plan, or the dataset's version differs from the plan's.

`TetherError`  
The dataset's manifests have uncommitted changes, or a store rename failed (nothing else was changed).
