Files
kopia/cli
Ali Dowair c4d722d2c5 feat(cli): Make format upgrade command idempotent (#2824)
This commit changes the behavior of the command
`kopia repo upgrade begin...` to not fail (exit code 1) when the repository is already using the latest format version. Instead, a helpful message is output and the program exits with zero code. In effect the command becomes idempotent-successive upgrades would return the same exit code. Such an idempotent api is desirable, especially in cases where we build automation around format upgrades.

Before this change, an error code 1 is returned when upgrading a repository that is already up to date:

```
$ kopia repo status | grep "Format Version"
Format version:      3
$ kopia repo upgrade begin --upgrade-owner-id admin
[1] ERROR error setting the upgrade lock intent: repository is using version 3, and version 3 is the maximum
```

and after this change, a 0 code is returned:

```
$ kopia repo upgrade begin --upgrade-owner-id admin
[0] Repository format is already upto date.
```
2023-03-27 12:37:16 +03:00
..
2021-05-03 10:28:00 -07:00
2021-05-03 10:28:00 -07:00