Keep a reference to the database in DBRevision

To avoid passing the db to all actions
This commit is contained in:
Stephan Kulow
2022-11-02 18:07:24 +01:00
parent 75f9f56a57
commit ba7436f10c
3 changed files with 53 additions and 45 deletions

View File

@@ -120,19 +120,19 @@ class GitExporter:
self.git.gc()
gc_cnt = self.gc_interval
logging.debug(f"Committing {flat}")
self.commit_flat(db, flat, branch_state)
self.commit_flat(flat, branch_state)
def limit_download(self, file: Path):
return file.suffix in (".spec", ".changes")
def commit_flat(self, db, flat, branch_state):
def commit_flat(self, flat, branch_state):
parents = []
self.git.checkout(flat.branch)
if flat.parent1:
parents.append(flat.parent1.git_commit)
if flat.parent2:
parents.append(flat.parent2.git_commit)
to_download, to_delete = flat.commit.calc_delta(db, branch_state[flat.branch])
to_download, to_delete = flat.commit.calc_delta(branch_state[flat.branch])
for file in to_delete:
if not self.limit_download(file):
continue