# Commits
- def _get_commit(self, query, *args):
- res = self.db.get(query, *args)
-
- if res:
- return Commit(self.backend, res.id, data=res)
-
def _get_commits(self, query, *args):
res = self.db.query(query, *args)
for row in res:
yield Commit(self.backend, row.id, data=row)
- def get_commit_by_id(self, commit_id):
- commit = self.db.get("SELECT id FROM sources_commits WHERE id = %s", commit_id)
+ def _get_commit(self, query, *args):
+ res = self.db.get(query, *args)
- if commit:
- return Commit(self.pakfire, commit.id)
+ if res:
+ return Commit(self.backend, res.id, data=res)
+
+ def get_commit_by_id(self, id):
+ return self._get_commit("""
+ SELECT
+ *
+ FROM
+ source_commits
+ WHERE
+ id = %s
+ """, id,
+ )
class Source(base.DataObject):