From 94e57852a097890f3cd2f8af4f744da263df16bd Mon Sep 17 00:00:00 2001 From: Adam Majer Date: Sun, 24 Aug 2025 15:34:08 +0200 Subject: [PATCH] stop using saved state We can reconstruct the state based on log messages. Otherwise, it's incorrect as the trimming function removes exported parts anyway and then we have missing commits --- lib/git_exporter.py | 17 +---------------- 1 file changed, 1 insertion(+), 16 deletions(-) diff --git a/lib/git_exporter.py b/lib/git_exporter.py index 458f26f..d8ff581 100644 --- a/lib/git_exporter.py +++ b/lib/git_exporter.py @@ -40,7 +40,6 @@ class GitExporter: else: self.git.create() self.git.add_gitea_remote(package) - self.state_file = os.path.join(self.git.path, ".git", "_flat_state.yaml") self.gc_interval = 200 self.cachedir = cachedir @@ -105,14 +104,7 @@ class GitExporter: return state_data def check_repo_state(self, flats, branch_state, branch): - state_data = dict() - if os.path.exists(self.state_file): - with open(self.state_file) as f: - state_data = yaml.safe_load(f) - if not isinstance(state_data, dict): - state_data = {} - else: - state_data = self.reconstruct_state(flats) + state_data = self.reconstruct_state(flats) logging.debug(f"state data: {state_data}") left_to_commit = [] @@ -278,10 +270,3 @@ class GitExporter: ) flat.commit.git_commit = commit branch_state[flat.branch] = flat.commit - with open(self.state_file, "w") as f: - data = {} - for branch in ["factory", "devel"]: - commit = branch_state[branch] - if commit: - data[branch] = commit.dbid - yaml.dump(data, f)