Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(154)

Unified Diff: third_party/buildbot_8_4p1/buildbot/db/buildsets.py

Issue 302283005: Backported getRecentBuildsets from buildbot 0.8.8 (to use it in RietveldPollerWithCache) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/build
Patch Set: Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/buildbot_8_4p1/buildbot/db/buildsets.py
diff --git a/third_party/buildbot_8_4p1/buildbot/db/buildsets.py b/third_party/buildbot_8_4p1/buildbot/db/buildsets.py
index e70a51242ca09ba7ec7034e2092f4053c3d0332c..c90af5bec8eb57e5075858623fcc5d59a62eadd7 100644
--- a/third_party/buildbot_8_4p1/buildbot/db/buildsets.py
+++ b/third_party/buildbot_8_4p1/buildbot/db/buildsets.py
@@ -190,6 +190,35 @@ class BuildsetsConnectorComponent(base.DBConnectorComponent):
return [ self._row2dict(row) for row in res.fetchall() ]
return self.db.pool.do(thd)
+ def getRecentBuildsets(self, count, branch=None, repository=None,
+ complete=None):
+ def thd(conn):
+ bs_tbl = self.db.model.buildsets
+ ch_tbl = self.db.model.changes
+ j = sa.join(self.db.model.buildsets,
+ self.db.model.sourcestamps)
+ j = j.join(self.db.model.sourcestamp_changes)
+ j = j.join(ch_tbl)
+ q = sa.select(columns=[bs_tbl], from_obj=[j],
+ distinct=True)
+ q = q.order_by(sa.desc(bs_tbl.c.id))
+ q = q.limit(count)
+
+ if complete is not None:
+ if complete:
+ q = q.where(bs_tbl.c.complete != 0)
+ else:
+ q = q.where((bs_tbl.c.complete == 0) |
+ (bs_tbl.c.complete == None))
+ if branch:
+ q = q.where(ch_tbl.c.branch == branch)
+ if repository:
+ q = q.where(ch_tbl.c.repository == repository)
+ res = conn.execute(q)
+ return list(reversed([self._row2dict(row)
+ for row in res.fetchall()]))
+ return self.db.pool.do(thd)
+
def getBuildsetProperties(self, buildsetid):
"""
Return the properties for a buildset, in the same format they were
« no previous file with comments | « third_party/buildbot_8_4p1/README.chromium ('k') | third_party/buildbot_8_4p1/buildbot/test/unit/test_db_buildsets.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698