From 4ff9b9771a2e3d464d3e4de8e1a44b1aff69e159 Mon Sep 17 00:00:00 2001 From: Stephan Kulow Date: Wed, 2 Nov 2022 07:20:53 +0100 Subject: [PATCH] Split out Flat generator to be able to test it --- lib/abstract_walker.py | 6 + lib/flat_walker.py | 57 +++++ lib/importer.py | 65 +---- lib/tree_builder.py | 7 + .../000update-repos-expected-list.yaml | 12 + tests/fixtures/2048-cli-expected-list.yaml | 3 + tests/fixtures/CoreFreq-expected-list.yaml | 38 +++ tests/fixtures/clapper-expected-list.yaml | 10 + tests/fixtures/llvm13-expected-list.yaml | 38 +++ tests/fixtures/zsh-expected-list.yaml | 232 ++++++++++++++++++ tests/tree_test.py | 14 ++ 11 files changed, 421 insertions(+), 61 deletions(-) create mode 100644 lib/abstract_walker.py create mode 100644 lib/flat_walker.py create mode 100644 tests/fixtures/000update-repos-expected-list.yaml create mode 100644 tests/fixtures/2048-cli-expected-list.yaml create mode 100644 tests/fixtures/CoreFreq-expected-list.yaml create mode 100644 tests/fixtures/clapper-expected-list.yaml create mode 100644 tests/fixtures/llvm13-expected-list.yaml create mode 100644 tests/fixtures/zsh-expected-list.yaml diff --git a/lib/abstract_walker.py b/lib/abstract_walker.py new file mode 100644 index 0000000..e1370ba --- /dev/null +++ b/lib/abstract_walker.py @@ -0,0 +1,6 @@ +class AbstractWalker: + """Just a duck type, most likely not needed by python, but I + find interface classes preferable (java school)""" + + def call(self, node, is_source): + pass diff --git a/lib/flat_walker.py b/lib/flat_walker.py new file mode 100644 index 0000000..7b2df52 --- /dev/null +++ b/lib/flat_walker.py @@ -0,0 +1,57 @@ +from lib.abstract_walker import AbstractWalker + + +class FlatNode: + def __init__(self, branch, commit, parent1=None, parent2=None) -> None: + self.branch = branch + self.commit = commit + self.parent1 = parent1 + self.parent2 = parent2 + + def __str__(self) -> str: + p1_str = "" + if self.parent1: + p1_str = f" p1:{self.parent1.short_string()}" + p2_str = "" + if self.parent2: + p2_str = f" p2:{self.parent2.short_string()}" + return f"{self.branch} c:{self.commit.short_string()}{p1_str}{p2_str}" + + +class FlatTreeWalker(AbstractWalker): + """While walking the tree, record the commits to do one after the other. These + FlatNodes are in the end in the flats array.""" + + def __init__(self, rebase_devel=False) -> None: + super().__init__() + self.flats = [] + # the rebase_devel won't work as such as rebasing the branch needs an explicit action + self.rebase_devel = rebase_devel + # remember the last merge point so we can know the parent of it for the root of the sources + self.last_merge = None + + def add(self, branch, commit, parent1=None, parent2=None): + self.flats.append(FlatNode(branch, commit, parent1, parent2)) + + def handle_source_node(self, node) -> None: + if self.rebase_devel and node.parent and node.parent.merged_into: + self.add("devel", node.revision, node.parent.merged_into.revision) + return + if node.parent: + self.add("devel", node.revision, node.parent.revision) + elif self.last_merge: + self.add("devel", node.revision, self.last_merge.parent.revision) + + def call(self, node, is_source) -> None: + if is_source: + self.handle_source_node(node) + return + if not node.parent: + self.add("factory", node.revision) + return + if not node.merged: + self.add("factory", node.revision, node.parent.revision) + return + self.add("factory", node.revision, node.parent.revision, node.merged.revision) + + self.last_merge = node diff --git a/lib/importer.py b/lib/importer.py index df0efd0..5e752e9 100644 --- a/lib/importer.py +++ b/lib/importer.py @@ -10,8 +10,8 @@ from lib.db_revision import DBRevision from lib.git import Git from lib.obs import OBS from lib.obs_revision import OBSRevision -from lib.proxy_sha256 import ProxySHA256, md5, sha256 -from lib.tree_builder import AbstractWalker, TreeBuilder, TreeNode +from lib.proxy_sha256 import ProxySHA256, md5 +from lib.tree_builder import AbstractWalker, TreeBuilder from lib.user import User @@ -251,65 +251,8 @@ class Importer: def export_as_git(self): db = DB() tree = TreeBuilder(db).build(self.package) + flats = tree.as_flat_list() - class FlatNode: - def __init__(self, branch, commit, parent1=None, parent2=None) -> None: - self.branch = branch - self.commit = commit - self.parent1 = parent1 - self.parent2 = parent2 - - def __str__(self) -> str: - p1_str = "" - if self.parent1: - p1_str = f" p1:{self.parent1.short_string()}" - p2_str = "" - if self.parent2: - p2_str = f" p2:{self.parent2.short_string()}" - return f"{self.branch} c:{self.commit.short_string()}{p1_str}{p2_str}" - - class FlatTreeWalker(AbstractWalker): - """While walking the tree, record the commits to do one after the other. These - FlatNodes are in the end in the flats array.""" - - def __init__(self, rebase_devel=False) -> None: - super().__init__() - self.flats = [] - # the rebase_devel won't work as such as rebasing the branch needs an explicit action - self.rebase_devel = rebase_devel - # remember the last merge point so we can know the parent of it for the root of the sources - self.last_merge = None - - def add(self, branch, commit, parent1=None, parent2=None): - self.flats.append(FlatNode(branch, commit, parent1, parent2)) - - def handle_source_node(self, node) -> None: - if self.rebase_devel and node.parent and node.parent.merged_into: - self.add("devel", node.revision, node.parent.merged_into.revision) - return - if node.parent: - self.add("devel", node.revision, node.parent.revision) - elif self.last_merge: - self.add("devel", node.revision, self.last_merge.parent.revision) - - def call(self, node, is_source) -> None: - if is_source: - self.handle_source_node(node) - return - if not node.parent: - self.add("factory", node.revision) - return - if not node.merged: - self.add("factory", node.revision, node.parent.revision) - return - self.add( - "factory", node.revision, node.parent.revision, node.merged.revision - ) - - self.last_merge = node - - ftw = FlatTreeWalker() - tree.walk(ftw) branch_state = {"factory": None, "devel": None} state_data = dict() if os.path.exists(self.state_file): @@ -318,7 +261,7 @@ class Importer: if type(state_data) != dict: state_data = {} left_to_commit = [] - for flat in reversed(ftw.flats): + for flat in reversed(flats): found_state = False for branch in ["factory", "devel"]: if flat.commit.dbid == state_data.get(branch): diff --git a/lib/tree_builder.py b/lib/tree_builder.py index 9cdd9e8..f3cc11d 100644 --- a/lib/tree_builder.py +++ b/lib/tree_builder.py @@ -2,6 +2,7 @@ from typing import Dict from xmlrpc.client import Boolean from lib.db_revision import DBRevision +from lib.flat_walker import FlatTreeWalker from lib.request import Request @@ -50,6 +51,12 @@ class TreeNode: def print(self): self.walk(PrintWalker()) + def as_flat_list(self): + """Return the tree as git commits to do""" + ftw = FlatTreeWalker() + self.walk(ftw) + return ftw.flats + def as_list(self): """Return a list for test cases""" node = self diff --git a/tests/fixtures/000update-repos-expected-list.yaml b/tests/fixtures/000update-repos-expected-list.yaml new file mode 100644 index 0000000..389df55 --- /dev/null +++ b/tests/fixtures/000update-repos-expected-list.yaml @@ -0,0 +1,12 @@ +- factory c:openSUSE:Factory/000update-repos/12.0 p1:openSUSE:Factory/000update-repos/11.0 +- factory c:openSUSE:Factory/000update-repos/11.0 p1:openSUSE:Factory/000update-repos/10.0 +- factory c:openSUSE:Factory/000update-repos/10.0 p1:openSUSE:Factory/000update-repos/9.0 +- factory c:openSUSE:Factory/000update-repos/9.0 p1:openSUSE:Factory/000update-repos/8.0 +- factory c:openSUSE:Factory/000update-repos/8.0 p1:openSUSE:Factory/000update-repos/7.0 +- factory c:openSUSE:Factory/000update-repos/7.0 p1:openSUSE:Factory/000update-repos/6.0 +- factory c:openSUSE:Factory/000update-repos/6.0 p1:openSUSE:Factory/000update-repos/5.0 +- factory c:openSUSE:Factory/000update-repos/5.0 p1:openSUSE:Factory/000update-repos/4.0 +- factory c:openSUSE:Factory/000update-repos/4.0 p1:openSUSE:Factory/000update-repos/3.0 +- factory c:openSUSE:Factory/000update-repos/3.0 p1:openSUSE:Factory/000update-repos/2.0 +- factory c:openSUSE:Factory/000update-repos/2.0 p1:openSUSE:Factory/000update-repos/1.0 +- factory c:openSUSE:Factory/000update-repos/1.0 diff --git a/tests/fixtures/2048-cli-expected-list.yaml b/tests/fixtures/2048-cli-expected-list.yaml new file mode 100644 index 0000000..2f65352 --- /dev/null +++ b/tests/fixtures/2048-cli-expected-list.yaml @@ -0,0 +1,3 @@ +- factory c:openSUSE:Factory/2048-cli/1.0 p1:games/2048-cli/2.0 +- factory c:games/2048-cli/2.0 p1:games/2048-cli/1.0 +- factory c:games/2048-cli/1.0 diff --git a/tests/fixtures/CoreFreq-expected-list.yaml b/tests/fixtures/CoreFreq-expected-list.yaml new file mode 100644 index 0000000..e800508 --- /dev/null +++ b/tests/fixtures/CoreFreq-expected-list.yaml @@ -0,0 +1,38 @@ +- factory c:openSUSE:Factory/CoreFreq/15.0 p1:openSUSE:Factory/CoreFreq/14.0 p2:hardware/CoreFreq/32.0 +- devel c:hardware/CoreFreq/32.0 p1:hardware/CoreFreq/31.0 +- devel c:hardware/CoreFreq/31.0 p1:hardware/CoreFreq/29.0 +- factory c:openSUSE:Factory/CoreFreq/14.0 p1:openSUSE:Factory/CoreFreq/13.0 p2:hardware/CoreFreq/29.0 +- devel c:hardware/CoreFreq/29.0 p1:hardware/CoreFreq/27.0 +- factory c:openSUSE:Factory/CoreFreq/13.0 p1:openSUSE:Factory/CoreFreq/12.0 p2:hardware/CoreFreq/27.0 +- devel c:hardware/CoreFreq/27.0 p1:hardware/CoreFreq/26.0 +- devel c:hardware/CoreFreq/26.0 p1:hardware/CoreFreq/25.0 +- factory c:openSUSE:Factory/CoreFreq/12.0 p1:openSUSE:Factory/CoreFreq/11.0 p2:hardware/CoreFreq/25.0 +- devel c:hardware/CoreFreq/25.0 p1:hardware/CoreFreq/24.0 +- devel c:hardware/CoreFreq/24.0 p1:hardware/CoreFreq/23.0 +- factory c:openSUSE:Factory/CoreFreq/11.0 p1:openSUSE:Factory/CoreFreq/10.0 p2:hardware/CoreFreq/23.0 +- devel c:hardware/CoreFreq/23.0 p1:hardware/CoreFreq/22.0 +- factory c:openSUSE:Factory/CoreFreq/10.0 p1:openSUSE:Factory/CoreFreq/9.0 p2:hardware/CoreFreq/22.0 +- devel c:hardware/CoreFreq/22.0 p1:hardware/CoreFreq/21.0 +- factory c:openSUSE:Factory/CoreFreq/9.0 p1:openSUSE:Factory/CoreFreq/8.0 p2:hardware/CoreFreq/21.0 +- devel c:hardware/CoreFreq/21.0 p1:hardware/CoreFreq/20.0 +- factory c:openSUSE:Factory/CoreFreq/8.0 p1:openSUSE:Factory/CoreFreq/7.0 p2:hardware/CoreFreq/20.0 +- devel c:hardware/CoreFreq/20.0 p1:hardware/CoreFreq/18.0 +- factory c:openSUSE:Factory/CoreFreq/7.0 p1:openSUSE:Factory/CoreFreq/6.0 p2:hardware/CoreFreq/18.0 +- devel c:hardware/CoreFreq/18.0 p1:hardware/CoreFreq/16.0 +- factory c:openSUSE:Factory/CoreFreq/6.0 p1:openSUSE:Factory/CoreFreq/5.0 p2:hardware/CoreFreq/16.0 +- devel c:hardware/CoreFreq/16.0 p1:hardware/CoreFreq/15.0 +- devel c:hardware/CoreFreq/15.0 p1:hardware/CoreFreq/13.0 +- factory c:openSUSE:Factory/CoreFreq/5.0 p1:openSUSE:Factory/CoreFreq/4.0 p2:hardware/CoreFreq/13.0 +- devel c:hardware/CoreFreq/13.0 p1:hardware/CoreFreq/11.0 +- factory c:openSUSE:Factory/CoreFreq/4.0 p1:openSUSE:Factory/CoreFreq/3.0 p2:hardware/CoreFreq/11.0 +- devel c:hardware/CoreFreq/11.0 p1:hardware/CoreFreq/9.0 +- factory c:openSUSE:Factory/CoreFreq/3.0 p1:openSUSE:Factory/CoreFreq/2.0 p2:hardware/CoreFreq/9.0 +- devel c:hardware/CoreFreq/9.0 p1:hardware/CoreFreq/8.0 +- devel c:hardware/CoreFreq/8.0 p1:hardware/CoreFreq/7.0 +- devel c:hardware/CoreFreq/7.0 p1:hardware/CoreFreq/6.0 +- devel c:hardware/CoreFreq/6.0 p1:hardware/CoreFreq/4.0 +- factory c:openSUSE:Factory/CoreFreq/2.0 p1:openSUSE:Factory/CoreFreq/1.0 p2:hardware/CoreFreq/4.0 +- devel c:hardware/CoreFreq/4.0 p1:openSUSE:Factory/CoreFreq/1.0 +- factory c:openSUSE:Factory/CoreFreq/1.0 p1:hardware/CoreFreq/2.0 +- factory c:hardware/CoreFreq/2.0 p1:hardware/CoreFreq/1.0 +- factory c:hardware/CoreFreq/1.0 diff --git a/tests/fixtures/clapper-expected-list.yaml b/tests/fixtures/clapper-expected-list.yaml new file mode 100644 index 0000000..64a39ca --- /dev/null +++ b/tests/fixtures/clapper-expected-list.yaml @@ -0,0 +1,10 @@ +- factory c:openSUSE:Factory/clapper/3.0 p1:openSUSE:Factory/clapper/2.0 p2:multimedia:apps/clapper/9.0 +- devel c:multimedia:apps/clapper/9.0 p1:multimedia:apps/clapper/7.0 +- factory c:openSUSE:Factory/clapper/2.0 p1:openSUSE:Factory/clapper/1.0 p2:multimedia:apps/clapper/7.0 +- devel c:multimedia:apps/clapper/7.0 p1:multimedia:apps/clapper/6.0 +- devel c:multimedia:apps/clapper/6.0 p1:multimedia:apps/clapper/5.0 +- devel c:multimedia:apps/clapper/5.0 p1:openSUSE:Factory/clapper/1.0 +- factory c:openSUSE:Factory/clapper/1.0 p1:multimedia:apps/clapper/3.0 +- factory c:multimedia:apps/clapper/3.0 p1:multimedia:apps/clapper/2.0 +- factory c:multimedia:apps/clapper/2.0 p1:multimedia:apps/clapper/1.0 +- factory c:multimedia:apps/clapper/1.0 diff --git a/tests/fixtures/llvm13-expected-list.yaml b/tests/fixtures/llvm13-expected-list.yaml new file mode 100644 index 0000000..e34a11e --- /dev/null +++ b/tests/fixtures/llvm13-expected-list.yaml @@ -0,0 +1,38 @@ +- factory c:openSUSE:Factory/llvm13/12.0 p1:openSUSE:Factory/llvm13/11.0 p2:devel:tools:compiler/llvm13/30.0 +- devel c:devel:tools:compiler/llvm13/30.0 p1:devel:tools:compiler/llvm13/28.0 +- factory c:openSUSE:Factory/llvm13/11.0 p1:openSUSE:Factory/llvm13/10.0 p2:devel:tools:compiler/llvm13/28.0 +- devel c:devel:tools:compiler/llvm13/28.0 p1:devel:tools:compiler/llvm13/26.0 +- factory c:openSUSE:Factory/llvm13/10.0 p1:openSUSE:Factory/llvm13/9.0 p2:devel:tools:compiler/llvm13/26.0 +- devel c:devel:tools:compiler/llvm13/26.0 p1:devel:tools:compiler/llvm13/25.0 +- devel c:devel:tools:compiler/llvm13/25.0 p1:devel:tools:compiler/llvm13/24.0 +- devel c:devel:tools:compiler/llvm13/24.0 p1:devel:tools:compiler/llvm13/22.0 +- factory c:openSUSE:Factory/llvm13/9.0 p1:openSUSE:Factory/llvm13/8.0 p2:devel:tools:compiler/llvm13/22.0 +- devel c:devel:tools:compiler/llvm13/22.0 p1:devel:tools:compiler/llvm13/21.0 +- devel c:devel:tools:compiler/llvm13/21.0 p1:devel:tools:compiler/llvm13/20.0 +- devel c:devel:tools:compiler/llvm13/20.0 p1:devel:tools:compiler/llvm13/19.0 +- devel c:devel:tools:compiler/llvm13/19.0 p1:devel:tools:compiler/llvm13/18.0 +- devel c:devel:tools:compiler/llvm13/18.0 p1:devel:tools:compiler/llvm13/17.0 +- devel c:devel:tools:compiler/llvm13/17.0 p1:devel:tools:compiler/llvm13/16.0 +- devel c:devel:tools:compiler/llvm13/16.0 p1:devel:tools:compiler/llvm13/15.0 +- devel c:devel:tools:compiler/llvm13/15.0 p1:devel:tools:compiler/llvm13/14.0 +- devel c:devel:tools:compiler/llvm13/14.0 p1:devel:tools:compiler/llvm13/13.0 +- factory c:openSUSE:Factory/llvm13/8.0 p1:openSUSE:Factory/llvm13/7.0 p2:devel:tools:compiler/llvm13/13.0 +- devel c:devel:tools:compiler/llvm13/13.0 p1:devel:tools:compiler/llvm13/12.0 +- devel c:devel:tools:compiler/llvm13/12.0 p1:devel:tools:compiler/llvm13/11.0 +- devel c:devel:tools:compiler/llvm13/11.0 p1:devel:tools:compiler/llvm13/10.0 +- factory c:openSUSE:Factory/llvm13/7.0 p1:openSUSE:Factory/llvm13/6.0 p2:devel:tools:compiler/llvm13/10.0 +- devel c:devel:tools:compiler/llvm13/10.0 p1:devel:tools:compiler/llvm13/9.0 +- factory c:openSUSE:Factory/llvm13/6.0 p1:openSUSE:Factory/llvm13/5.0 p2:devel:tools:compiler/llvm13/9.0 +- devel c:devel:tools:compiler/llvm13/9.0 p1:devel:tools:compiler/llvm13/8.0 +- devel c:devel:tools:compiler/llvm13/8.0 p1:devel:tools:compiler/llvm13/7.0 +- factory c:openSUSE:Factory/llvm13/5.0 p1:openSUSE:Factory/llvm13/4.0 p2:devel:tools:compiler/llvm13/7.0 +- devel c:devel:tools:compiler/llvm13/7.0 p1:devel:tools:compiler/llvm13/6.0 +- factory c:openSUSE:Factory/llvm13/4.0 p1:openSUSE:Factory/llvm13/3.0 p2:devel:tools:compiler/llvm13/6.0 +- devel c:devel:tools:compiler/llvm13/6.0 p1:devel:tools:compiler/llvm13/5.0 +- factory c:openSUSE:Factory/llvm13/3.0 p1:openSUSE:Factory/llvm13/2.0 p2:devel:tools:compiler/llvm13/5.0 +- devel c:devel:tools:compiler/llvm13/5.0 p1:devel:tools:compiler/llvm13/4.0 +- factory c:openSUSE:Factory/llvm13/2.0 p1:openSUSE:Factory/llvm13/1.0 p2:devel:tools:compiler/llvm13/4.0 +- devel c:devel:tools:compiler/llvm13/4.0 p1:devel:tools:compiler/llvm13/3.0 +- devel c:devel:tools:compiler/llvm13/3.0 p1:openSUSE:Factory/llvm13/1.0 +- factory c:openSUSE:Factory/llvm13/1.0 p1:devel:tools:compiler/llvm13/1.0 +- factory c:devel:tools:compiler/llvm13/1.0 diff --git a/tests/fixtures/zsh-expected-list.yaml b/tests/fixtures/zsh-expected-list.yaml new file mode 100644 index 0000000..d11ba0d --- /dev/null +++ b/tests/fixtures/zsh-expected-list.yaml @@ -0,0 +1,232 @@ +- factory c:openSUSE:Factory/zsh/98.0 p1:openSUSE:Factory/zsh/97.0 p2:shells/zsh/236.0 +- devel c:shells/zsh/236.0 p1:shells/zsh/234.0 +- factory c:openSUSE:Factory/zsh/97.0 p1:openSUSE:Factory/zsh/96.0 p2:shells/zsh/234.0 +- devel c:shells/zsh/234.0 p1:shells/zsh/232.0 +- factory c:openSUSE:Factory/zsh/96.0 p1:openSUSE:Factory/zsh/95.0 p2:shells/zsh/232.0 +- devel c:shells/zsh/232.0 p1:shells/zsh/230.0 +- factory c:openSUSE:Factory/zsh/95.0 p1:openSUSE:Factory/zsh/94.0 p2:shells/zsh/230.0 +- devel c:shells/zsh/230.0 p1:shells/zsh/228.0 +- factory c:openSUSE:Factory/zsh/94.0 p1:openSUSE:Factory/zsh/93.0 p2:shells/zsh/228.0 +- devel c:shells/zsh/228.0 p1:shells/zsh/227.0 +- devel c:shells/zsh/227.0 p1:shells/zsh/225.0 +- factory c:openSUSE:Factory/zsh/93.0 p1:openSUSE:Factory/zsh/92.0 p2:shells/zsh/225.0 +- devel c:shells/zsh/225.0 p1:shells/zsh/224.0 +- devel c:shells/zsh/224.0 p1:shells/zsh/223.0 +- devel c:shells/zsh/223.0 p1:shells/zsh/221.0 +- factory c:openSUSE:Factory/zsh/92.0 p1:openSUSE:Factory/zsh/91.0 p2:shells/zsh/221.0 +- devel c:shells/zsh/221.0 p1:shells/zsh/219.0 +- factory c:openSUSE:Factory/zsh/91.0 p1:openSUSE:Factory/zsh/90.0 p2:shells/zsh/219.0 +- devel c:shells/zsh/219.0 p1:shells/zsh/217.0 +- factory c:openSUSE:Factory/zsh/90.0 p1:openSUSE:Factory/zsh/89.0 p2:shells/zsh/217.0 +- devel c:shells/zsh/217.0 p1:shells/zsh/215.0 +- factory c:openSUSE:Factory/zsh/89.0 p1:openSUSE:Factory/zsh/88.0 p2:shells/zsh/215.0 +- devel c:shells/zsh/215.0 p1:shells/zsh/214.0 +- devel c:shells/zsh/214.0 p1:shells/zsh/212.0 +- factory c:openSUSE:Factory/zsh/88.0 p1:openSUSE:Factory/zsh/87.0 p2:shells/zsh/212.0 +- devel c:shells/zsh/212.0 p1:shells/zsh/210.0 +- factory c:openSUSE:Factory/zsh/87.0 p1:openSUSE:Factory/zsh/86.0 p2:shells/zsh/210.0 +- devel c:shells/zsh/210.0 p1:shells/zsh/209.0 +- devel c:shells/zsh/209.0 p1:shells/zsh/208.0 +- devel c:shells/zsh/208.0 p1:shells/zsh/207.0 +- devel c:shells/zsh/207.0 p1:shells/zsh/205.0 +- factory c:openSUSE:Factory/zsh/86.0 p1:openSUSE:Factory/zsh/85.0 p2:shells/zsh/205.0 +- devel c:shells/zsh/205.0 p1:shells/zsh/204.0 +- devel c:shells/zsh/204.0 p1:shells/zsh/202.0 +- factory c:openSUSE:Factory/zsh/85.0 p1:openSUSE:Factory/zsh/84.0 p2:shells/zsh/202.0 +- devel c:shells/zsh/202.0 p1:shells/zsh/201.0 +- devel c:shells/zsh/201.0 p1:shells/zsh/199.0 +- factory c:openSUSE:Factory/zsh/84.0 p1:openSUSE:Factory/zsh/83.0 p2:shells/zsh/199.0 +- devel c:shells/zsh/199.0 p1:shells/zsh/198.0 +- devel c:shells/zsh/198.0 p1:shells/zsh/197.0 +- devel c:shells/zsh/197.0 p1:shells/zsh/195.0 +- factory c:openSUSE:Factory/zsh/83.0 p1:openSUSE:Factory/zsh/82.0 p2:shells/zsh/195.0 +- devel c:shells/zsh/195.0 p1:shells/zsh/194.0 +- devel c:shells/zsh/194.0 p1:shells/zsh/193.0 +- devel c:shells/zsh/193.0 p1:shells/zsh/192.0 +- devel c:shells/zsh/192.0 p1:shells/zsh/191.0 +- devel c:shells/zsh/191.0 p1:shells/zsh/189.0 +- factory c:openSUSE:Factory/zsh/82.0 p1:openSUSE:Factory/zsh/81.0 p2:shells/zsh/189.0 +- devel c:shells/zsh/189.0 p1:shells/zsh/187.0 +- factory c:openSUSE:Factory/zsh/81.0 p1:openSUSE:Factory/zsh/80.0 p2:shells/zsh/187.0 +- devel c:shells/zsh/187.0 p1:shells/zsh/186.0 +- devel c:shells/zsh/186.0 p1:shells/zsh/184.0 +- factory c:openSUSE:Factory/zsh/80.0 p1:openSUSE:Factory/zsh/79.0 p2:shells/zsh/184.0 +- devel c:shells/zsh/184.0 p1:shells/zsh/182.0 +- factory c:openSUSE:Factory/zsh/79.0 p1:openSUSE:Factory/zsh/78.0 p2:shells/zsh/182.0 +- devel c:shells/zsh/182.0 p1:shells/zsh/180.0 +- factory c:openSUSE:Factory/zsh/78.0 p1:openSUSE:Factory/zsh/77.0 p2:shells/zsh/180.0 +- devel c:shells/zsh/180.0 p1:shells/zsh/178.0 +- factory c:openSUSE:Factory/zsh/77.0 p1:openSUSE:Factory/zsh/76.0 p2:shells/zsh/178.0 +- devel c:shells/zsh/178.0 p1:shells/zsh/177.0 +- devel c:shells/zsh/177.0 p1:shells/zsh/175.0 +- factory c:openSUSE:Factory/zsh/76.0 p1:openSUSE:Factory/zsh/75.0 p2:shells/zsh/175.0 +- devel c:shells/zsh/175.0 p1:shells/zsh/173.0 +- factory c:openSUSE:Factory/zsh/75.0 p1:openSUSE:Factory/zsh/74.0 p2:shells/zsh/173.0 +- devel c:shells/zsh/173.0 p1:shells/zsh/171.0 +- factory c:openSUSE:Factory/zsh/74.0 p1:openSUSE:Factory/zsh/73.0 p2:shells/zsh/171.0 +- devel c:shells/zsh/171.0 p1:shells/zsh/170.0 +- devel c:shells/zsh/170.0 p1:shells/zsh/168.0 +- factory c:openSUSE:Factory/zsh/73.0 p1:openSUSE:Factory/zsh/72.0 p2:shells/zsh/168.0 +- devel c:shells/zsh/168.0 p1:shells/zsh/166.0 +- factory c:openSUSE:Factory/zsh/72.0 p1:openSUSE:Factory/zsh/71.0 p2:shells/zsh/166.0 +- devel c:shells/zsh/166.0 p1:shells/zsh/164.0 +- factory c:openSUSE:Factory/zsh/71.0 p1:openSUSE:Factory/zsh/70.0 p2:shells/zsh/164.0 +- devel c:shells/zsh/164.0 p1:shells/zsh/162.0 +- factory c:openSUSE:Factory/zsh/70.0 p1:openSUSE:Factory/zsh/69.0 p2:shells/zsh/162.0 +- devel c:shells/zsh/162.0 p1:shells/zsh/160.0 +- factory c:openSUSE:Factory/zsh/69.0 p1:openSUSE:Factory/zsh/68.0 p2:shells/zsh/160.0 +- devel c:shells/zsh/160.0 p1:shells/zsh/159.0 +- devel c:shells/zsh/159.0 p1:shells/zsh/158.0 +- devel c:shells/zsh/158.0 p1:shells/zsh/156.0 +- factory c:openSUSE:Factory/zsh/68.0 p1:openSUSE:Factory/zsh/67.0 p2:shells/zsh/156.0 +- devel c:shells/zsh/156.0 p1:shells/zsh/154.0 +- factory c:openSUSE:Factory/zsh/67.0 p1:openSUSE:Factory/zsh/66.0 p2:shells/zsh/154.0 +- devel c:shells/zsh/154.0 p1:shells/zsh/153.0 +- devel c:shells/zsh/153.0 p1:shells/zsh/151.0 +- factory c:openSUSE:Factory/zsh/66.0 p1:openSUSE:Factory/zsh/65.0 p2:shells/zsh/151.0 +- devel c:shells/zsh/151.0 p1:shells/zsh/150.0 +- devel c:shells/zsh/150.0 p1:shells/zsh/148.0 +- factory c:openSUSE:Factory/zsh/65.0 p1:openSUSE:Factory/zsh/64.0 p2:shells/zsh/148.0 +- devel c:shells/zsh/148.0 p1:shells/zsh/146.0 +- factory c:openSUSE:Factory/zsh/64.0 p1:openSUSE:Factory/zsh/63.0 p2:shells/zsh/146.0 +- devel c:shells/zsh/146.0 p1:shells/zsh/145.0 +- devel c:shells/zsh/145.0 p1:shells/zsh/144.0 +- devel c:shells/zsh/144.0 p1:shells/zsh/142.0 +- factory c:openSUSE:Factory/zsh/63.0 p1:openSUSE:Factory/zsh/62.0 p2:shells/zsh/142.0 +- devel c:shells/zsh/142.0 p1:shells/zsh/140.0 +- factory c:openSUSE:Factory/zsh/62.0 p1:openSUSE:Factory/zsh/61.0 p2:shells/zsh/140.0 +- devel c:shells/zsh/140.0 p1:shells/zsh/138.0 +- factory c:openSUSE:Factory/zsh/61.0 p1:openSUSE:Factory/zsh/60.0 p2:shells/zsh/138.0 +- devel c:shells/zsh/138.0 p1:shells/zsh/137.0 +- devel c:shells/zsh/137.0 p1:shells/zsh/135.0 +- factory c:openSUSE:Factory/zsh/60.0 p1:openSUSE:Factory/zsh/59.0 p2:shells/zsh/135.0 +- devel c:shells/zsh/135.0 p1:shells/zsh/133.0 +- factory c:openSUSE:Factory/zsh/59.0 p1:openSUSE:Factory/zsh/57.0 p2:shells/zsh/133.0 +- devel c:shells/zsh/133.0 p1:shells/zsh/131.0 +- factory c:openSUSE:Factory/zsh/57.0 p1:openSUSE:Factory/zsh/56.0 p2:shells/zsh/131.0 +- devel c:shells/zsh/131.0 p1:shells/zsh/129.0 +- factory c:openSUSE:Factory/zsh/56.0 p1:openSUSE:Factory/zsh/55.0 p2:shells/zsh/129.0 +- devel c:shells/zsh/129.0 p1:shells/zsh/127.0 +- factory c:openSUSE:Factory/zsh/55.0 p1:openSUSE:Factory/zsh/54.0 p2:shells/zsh/127.0 +- devel c:shells/zsh/127.0 p1:shells/zsh/125.0 +- factory c:openSUSE:Factory/zsh/54.0 p1:openSUSE:Factory/zsh/53.0 p2:shells/zsh/125.0 +- devel c:shells/zsh/125.0 p1:shells/zsh/123.0 +- factory c:openSUSE:Factory/zsh/53.0 p1:openSUSE:Factory/zsh/51.0 p2:shells/zsh/123.0 +- devel c:shells/zsh/123.0 p1:shells/zsh/121.0 +- factory c:openSUSE:Factory/zsh/51.0 p1:openSUSE:Factory/zsh/50.0 p2:shells/zsh/121.0 +- devel c:shells/zsh/121.0 p1:shells/zsh/119.0 +- factory c:openSUSE:Factory/zsh/50.0 p1:openSUSE:Factory/zsh/49.0 p2:shells/zsh/119.0 +- devel c:shells/zsh/119.0 p1:shells/zsh/117.0 +- factory c:openSUSE:Factory/zsh/49.0 p1:openSUSE:Factory/zsh/48.0 p2:shells/zsh/117.0 +- devel c:shells/zsh/117.0 p1:shells/zsh/115.0 +- factory c:openSUSE:Factory/zsh/48.0 p1:openSUSE:Factory/zsh/46.0 p2:shells/zsh/115.0 +- devel c:shells/zsh/115.0 p1:shells/zsh/113.0 +- factory c:openSUSE:Factory/zsh/46.0 p1:openSUSE:Factory/zsh/45.0 p2:shells/zsh/113.0 +- devel c:shells/zsh/113.0 p1:shells/zsh/111.0 +- factory c:openSUSE:Factory/zsh/45.0 p1:openSUSE:Factory/zsh/44.0 p2:shells/zsh/111.0 +- devel c:shells/zsh/111.0 p1:shells/zsh/109.0 +- factory c:openSUSE:Factory/zsh/44.0 p1:openSUSE:Factory/zsh/43.0 p2:shells/zsh/109.0 +- devel c:shells/zsh/109.0 p1:shells/zsh/107.0 +- factory c:openSUSE:Factory/zsh/43.0 p1:openSUSE:Factory/zsh/42.0 p2:shells/zsh/107.0 +- devel c:shells/zsh/107.0 p1:shells/zsh/105.0 +- factory c:openSUSE:Factory/zsh/42.0 p1:openSUSE:Factory/zsh/41.0 p2:shells/zsh/105.0 +- devel c:shells/zsh/105.0 p1:shells/zsh/103.0 +- factory c:openSUSE:Factory/zsh/41.0 p1:openSUSE:Factory/zsh/39.0 p2:shells/zsh/103.0 +- devel c:shells/zsh/103.0 p1:shells/zsh/102.0 +- devel c:shells/zsh/102.0 p1:shells/zsh/100.0 +- factory c:openSUSE:Factory/zsh/39.0 p1:openSUSE:Factory/zsh/38.0 p2:shells/zsh/100.0 +- devel c:shells/zsh/100.0 p1:shells/zsh/98.0 +- factory c:openSUSE:Factory/zsh/38.0 p1:openSUSE:Factory/zsh/37.0 p2:shells/zsh/98.0 +- devel c:shells/zsh/98.0 p1:shells/zsh/95.0 +- factory c:openSUSE:Factory/zsh/37.0 p1:openSUSE:Factory/zsh/36.0 p2:shells/zsh/95.0 +- devel c:shells/zsh/95.0 p1:shells/zsh/94.0 +- devel c:shells/zsh/94.0 p1:shells/zsh/91.0 +- devel c:shells/zsh/91.0 p1:shells/zsh/90.0 +- factory c:openSUSE:Factory/zsh/36.0 p1:openSUSE:Factory/zsh/35.0 p2:shells/zsh/90.0 +- devel c:shells/zsh/90.0 p1:shells/zsh/89.0 +- devel c:shells/zsh/89.0 p1:shells/zsh/88.0 +- devel c:shells/zsh/88.0 p1:shells/zsh/87.0 +- devel c:shells/zsh/87.0 p1:shells/zsh/84.0 +- factory c:openSUSE:Factory/zsh/35.0 p1:openSUSE:Factory/zsh/34.0 p2:shells/zsh/84.0 +- devel c:shells/zsh/84.0 p1:shells/zsh/83.0 +- devel c:shells/zsh/83.0 p1:shells/zsh/82.0 +- devel c:shells/zsh/82.0 p1:shells/zsh/81.0 +- devel c:shells/zsh/81.0 p1:shells/zsh/80.0 +- devel c:shells/zsh/80.0 p1:shells/zsh/77.0 +- factory c:openSUSE:Factory/zsh/34.0 p1:openSUSE:Factory/zsh/32.0 p2:shells/zsh/77.0 +- devel c:shells/zsh/77.0 p1:shells/zsh/76.032 +- devel c:shells/zsh/76.032 p1:shells/zsh/75.0 +- factory c:openSUSE:Factory/zsh/32.0 p1:openSUSE:Factory/zsh/31.0 +- factory c:openSUSE:Factory/zsh/31.0 p1:openSUSE:Factory/zsh/30.0 p2:shells/zsh/75.0 +- devel c:shells/zsh/75.0 p1:shells/zsh/74.0 +- devel c:shells/zsh/74.0 p1:shells/zsh/73.0 +- devel c:shells/zsh/73.0 p1:shells/zsh/72.03 +- devel c:shells/zsh/72.03 p1:shells/zsh/71.0 +- factory c:openSUSE:Factory/zsh/30.0 p1:openSUSE:Factory/zsh/29.0 +- factory c:openSUSE:Factory/zsh/29.0 p1:openSUSE:Factory/zsh/28.0 p2:shells/zsh/71.0 +- devel c:shells/zsh/71.0 p1:shells/zsh/69.0 +- factory c:openSUSE:Factory/zsh/28.0 p1:openSUSE:Factory/zsh/27.0 p2:shells/zsh/69.0 +- devel c:shells/zsh/69.0 p1:shells/zsh/68.0 +- devel c:shells/zsh/68.0 p1:shells/zsh/67.027 +- devel c:shells/zsh/67.027 p1:shells/zsh/66.0 +- factory c:openSUSE:Factory/zsh/27.0 p1:openSUSE:Factory/zsh/26.0 +- factory c:openSUSE:Factory/zsh/26.0 p1:openSUSE:Factory/zsh/25.0 p2:shells/zsh/66.0 +- devel c:shells/zsh/66.0 p1:shells/zsh/65.0 +- devel c:shells/zsh/65.0 p1:shells/zsh/64.0 +- devel c:shells/zsh/64.0 p1:shells/zsh/63.0 +- devel c:shells/zsh/63.0 p1:shells/zsh/62.0 +- devel c:shells/zsh/62.0 p1:shells/zsh/61.0 +- devel c:shells/zsh/61.0 p1:shells/zsh/60.0 +- devel c:shells/zsh/60.0 p1:shells/zsh/59.0 +- devel c:shells/zsh/59.0 p1:shells/zsh/58.0 +- devel c:shells/zsh/58.0 p1:shells/zsh/57.0 +- devel c:shells/zsh/57.0 p1:shells/zsh/56.0 +- devel c:shells/zsh/56.0 p1:shells/zsh/55.0 +- devel c:shells/zsh/55.0 p1:shells/zsh/54.0 +- devel c:shells/zsh/54.0 p1:shells/zsh/53.0 +- devel c:shells/zsh/53.0 p1:shells/zsh/52.0 +- devel c:shells/zsh/52.0 p1:shells/zsh/51.0 +- devel c:shells/zsh/51.0 p1:shells/zsh/50.0 +- devel c:shells/zsh/50.0 p1:shells/zsh/49.0 +- devel c:shells/zsh/49.0 p1:shells/zsh/48.0 +- devel c:shells/zsh/48.0 p1:shells/zsh/47.0 +- devel c:shells/zsh/47.0 p1:shells/zsh/46.025 +- devel c:shells/zsh/46.025 p1:shells/zsh/45.0 +- factory c:openSUSE:Factory/zsh/25.0 p1:openSUSE:Factory/zsh/24.0 +- factory c:openSUSE:Factory/zsh/24.0 p1:openSUSE:Factory/zsh/23.0 p2:shells/zsh/45.0 +- devel c:shells/zsh/45.0 p1:shells/zsh/44.0 +- devel c:shells/zsh/44.0 p1:shells/zsh/43.023 +- devel c:shells/zsh/43.023 p1:shells/zsh/42.0 +- factory c:openSUSE:Factory/zsh/23.0 p1:openSUSE:Factory/zsh/22.0 +- factory c:openSUSE:Factory/zsh/22.0 p1:openSUSE:Factory/zsh/18.0 p2:shells/zsh/42.0 +- devel c:shells/zsh/42.0 p1:shells/zsh/41.035 +- devel c:shells/zsh/41.035 p1:shells/zsh/41.017 +- factory c:openSUSE:Factory/zsh/18.0 p1:openSUSE:Factory/zsh/17.0 +- factory c:openSUSE:Factory/zsh/17.0 p1:openSUSE:Factory/zsh/16.0 p2:shells/zsh/41.017 +- devel c:shells/zsh/41.017 p1:shells/zsh/41.0 +- devel c:shells/zsh/41.0 p1:shells/zsh/40.0 +- devel c:shells/zsh/40.0 p1:shells/zsh/39.0 +- devel c:shells/zsh/39.0 p1:shells/zsh/38.0 +- devel c:shells/zsh/38.0 p1:shells/zsh/37.0 +- devel c:shells/zsh/37.0 p1:shells/zsh/36.014 +- factory c:openSUSE:Factory/zsh/16.0 p1:openSUSE:Factory/zsh/14.0 +- factory c:openSUSE:Factory/zsh/14.0 p1:openSUSE:Factory/zsh/13.0 p2:shells/zsh/36.014 +- devel c:shells/zsh/36.014 p1:shells/zsh/36.0 +- devel c:shells/zsh/36.0 p1:shells/zsh/35.0 +- devel c:shells/zsh/35.0 p1:shells/zsh/34.0 +- factory c:openSUSE:Factory/zsh/13.0 p1:openSUSE:Factory/zsh/12.0 p2:shells/zsh/34.0 +- devel c:shells/zsh/34.0 p1:shells/zsh/33.0 +- devel c:shells/zsh/33.0 p1:shells/zsh/32.0 +- devel c:shells/zsh/32.0 p1:openSUSE:Factory/zsh/12.0 +- factory c:openSUSE:Factory/zsh/12.0 p1:openSUSE:Factory/zsh/11.0 +- factory c:openSUSE:Factory/zsh/11.0 p1:openSUSE:Factory/zsh/10.0 +- factory c:openSUSE:Factory/zsh/10.0 p1:openSUSE:Factory/zsh/9.0 +- factory c:openSUSE:Factory/zsh/9.0 p1:openSUSE:Factory/zsh/8.0 +- factory c:openSUSE:Factory/zsh/8.0 p1:openSUSE:Factory/zsh/7.0 +- factory c:openSUSE:Factory/zsh/7.0 p1:openSUSE:Factory/zsh/6.0 +- factory c:openSUSE:Factory/zsh/6.0 p1:openSUSE:Factory/zsh/5.0 +- factory c:openSUSE:Factory/zsh/5.0 p1:openSUSE:Factory/zsh/4.0 +- factory c:openSUSE:Factory/zsh/4.0 p1:openSUSE:Factory/zsh/3.0 +- factory c:openSUSE:Factory/zsh/3.0 p1:openSUSE:Factory/zsh/2.0 +- factory c:openSUSE:Factory/zsh/2.0 p1:openSUSE:Factory/zsh/1.0 +- factory c:openSUSE:Factory/zsh/1.0 diff --git a/tests/tree_test.py b/tests/tree_test.py index 545c474..a519bd9 100644 --- a/tests/tree_test.py +++ b/tests/tree_test.py @@ -31,6 +31,20 @@ class TestTreeMethods(unittest.TestCase): with open(path, "r") as f: data = yaml.safe_load(f) self.assertEqual(data, revisions.as_list()) + + # verify flat lists + path = os.path.join( + os.path.dirname(__file__), f"fixtures/{package}-expected-list.yaml" + ) + flat_list = [str(x) for x in revisions.as_flat_list()] + if os.getenv("REGENERATE_DATA"): + with open(path, "w") as f: + yaml.dump(flat_list, f) + + with open(path, "r") as f: + data = yaml.safe_load(f) + self.assertEqual(data, flat_list) + self.db.conn.rollback() def test_zsh_tree(self):