|
# This file is part of Buildbot. Buildbot is free software: you can # redistribute it and/or modify it under the terms of the GNU General Public # License as published by the Free Software Foundation, version 2. # # This program is distributed in the hope that it will be useful, but WITHOUT # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS # FOR A PARTICULAR PURPOSE. See the GNU General Public License for more # details. # # You should have received a copy of the GNU General Public License along with # this program; if not, write to the Free Software Foundation, Inc., 51 # Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. # # Copyright Buildbot Team Members
pass
pass
# Documentation is in developer/database.rst
project, sourcestampsetid, codebase='', patch_body=None, patch_level=0, patch_author="", patch_comment="", patch_subdir=None, changeids=[]):
# handle inserting a patch patchlevel=patch_level, patch_base64=base64.b64encode(patch_body), patch_author=patch_author, patch_comment=patch_comment, subdir=patch_subdir))
# insert the sourcestamp itself
branch=branch, revision=revision, patchid=patchid, repository=repository, codebase=codebase, project=project, sourcestampsetid=sourcestampsetid))
# handle inserting change ids dict(sourcestampid=ssid, changeid=changeid) for changeid in changeids ])
# and return the new ssid
def getSourceStamps(self,sourcestampsetid): def getSourceStampIds(sourcestampsetid): def thd(conn): tbl = self.db.model.sourcestamps q = sa.select([tbl.c.id], whereclause=(tbl.c.sourcestampsetid == sourcestampsetid)) res = conn.execute(q) return [ row.id for row in res.fetchall() ] return self.db.pool.do(thd) ssids = yield getSourceStampIds(sourcestampsetid)
sslist=SsList() for ssid in ssids: sourcestamp = yield self.getSourceStamp(ssid) sslist.append(sourcestamp) defer.returnValue(sslist)
def getSourceStamp(self, ssid): revision=row.revision, patch_body=None, patch_level=None, patch_author=None, patch_comment=None, patch_subdir=None, repository=row.repository, codebase=row.codebase, project=row.project, changeids=set([]))
# fetch the patch, if necessary # note the subtle renaming here else: log.msg('patchid %d, referenced from ssid %d, not found' % (patchid, ssid))
# fetch change ids
|