]> git.decadent.org.uk Git - dak.git/commitdiff
make p-u clear out queue information from the tables
authorMark Hymers <mhy@debian.org>
Sun, 15 Nov 2009 18:27:46 +0000 (18:27 +0000)
committerMark Hymers <mhy@debian.org>
Sun, 15 Nov 2009 18:27:46 +0000 (18:27 +0000)
Signed-off-by: Mark Hymers <mhy@debian.org>
dak/process_upload.py
daklib/dbconn.py

index ec7fbd35a19a70e05be39d803516bc0fccf6ca1d..33fff0dc8059af7834b94619b8c402cccc2e31e2 100755 (executable)
@@ -286,6 +286,7 @@ def action(u, session):
             chg = u.pkg.add_known_changes(holding.holding_dir, session=session)
         u.accept(summary, short_summary, session)
         u.check_override()
+        chg.clean_from_queue()
         session.commit()
         u.remove()
     elif answer == 'P':
@@ -482,6 +483,11 @@ def main():
         Logger.log(["total", summarystats.accept_count, summarystats.accept_bytes])
 
     if not Options["No-Action"]:
+        # Clean out the queue files
+        session = DBConn().session()
+        session.execute("DELETE FROM changes_pending_files WHERE id NOT IN (SELECT file_id FROM changes_pending_files_map )")
+        session.commit()
+
         if log_urgency:
             UrgencyLog().close()
     Logger.close()
index 7388208e3478bcf6e5fd1423556ab2fba2f09663..7047f59bbc3ea5ad1f39b431c28a10037ed9b0ec 100644 (file)
@@ -1437,6 +1437,21 @@ class DBChange(object):
     def __repr__(self):
         return '<DBChange %s>' % self.changesname
 
+    def clean_from_queue(self):
+        session = DBConn().session().object_session(self)
+
+        # Remove changes_pool_files entries
+        for pf in self.poolfiles:
+            self.poolfiles.remove(pf)
+
+        # Remove change
+        for cf in self.files:
+            self.files.remove(cf)
+
+        # Clear out of queue
+        self.in_queue = None
+        self.approved_for_id = None
+
 __all__.append('DBChange')
 
 @session_wrapper