Mercurial > kallithea
changeset 4271:82fa5c6e958e
status: don't calculate status of whole repo when given empty list
SQLAlchemy would warn that it was a bad idea.
author | Mads Kiilerich <madski@unity3d.com> |
---|---|
date | Tue, 10 Dec 2013 19:30:37 +0100 |
parents | 22da5c75e660 |
children | f8f180cbe68d |
files | kallithea/model/db.py |
diffstat | 1 files changed, 5 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/kallithea/model/db.py Fri Jul 18 17:01:37 2014 +0200 +++ b/kallithea/model/db.py Tue Dec 10 19:30:37 2013 +0100 @@ -1362,18 +1362,19 @@ grouped[cmt.revision].append(cmt) return grouped - def statuses(self, revisions=None): + def statuses(self, revisions): """ Returns statuses for this repository :param revisions: list of revisions to get statuses for """ + if not revisions: + return {} statuses = ChangesetStatus.query()\ .filter(ChangesetStatus.repo == self)\ - .filter(ChangesetStatus.version == 0) - if revisions: - statuses = statuses.filter(ChangesetStatus.revision.in_(revisions)) + .filter(ChangesetStatus.version == 0)\ + .filter(ChangesetStatus.revision.in_(revisions)) grouped = {} #maybe we have open new pullrequest without a status ?