diff options
author | Daniel Schadt <kingdread@gmx.de> | 2022-09-24 15:09:58 +0200 |
---|---|---|
committer | Daniel Schadt <kingdread@gmx.de> | 2022-09-24 15:09:58 +0200 |
commit | 7e60a117d854bd569a7aafbd09dff4bf4e425115 (patch) | |
tree | 00fe4170c711a6cd8e4b9d38964cca857ec7d7cb | |
parent | 914843fa1eb8d557d6c0d7b50030f7f7645d200a (diff) | |
download | fietsboek-7e60a117d854bd569a7aafbd09dff4bf4e425115.tar.gz fietsboek-7e60a117d854bd569a7aafbd09dff4bf4e425115.tar.bz2 fietsboek-7e60a117d854bd569a7aafbd09dff4bf4e425115.zip |
fix downgrade not picking the right revisions
If we apply a migration that takes us from "v1" to "v2", then a
downgrade needs to apply the reverse of this migration - not the one
that goes from "v1" to "v0", and not "no migration".
The previous code managed to not do this, as it would see "v1-v2" as
applied and therefore skip it.
-rw-r--r-- | fietsboek/updater/__init__.py | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/fietsboek/updater/__init__.py b/fietsboek/updater/__init__.py index 6c154e7..8ca4991 100644 --- a/fietsboek/updater/__init__.py +++ b/fietsboek/updater/__init__.py @@ -124,7 +124,7 @@ class Updater: def _reverse_versions(self): all_versions = set(script.id for script in self.scripts.values()) - return (all_versions - self._transitive_versions()) | set(self.current_versions()) + return (all_versions - self._transitive_versions()) def stamp(self, versions): """Stampts the given version into the version file. @@ -201,6 +201,7 @@ class Updater: # dependencies instead. applied_versions = self._reverse_versions() to_apply = self._pick_updates(target, applied_versions, self.backward_dependencies) + to_apply -= {target} application_queue = self._make_schedule(to_apply, self.backward_dependencies) LOGGER.debug("Planned downgrade: %s", application_queue) for downgrade in application_queue: |