From e69252d47e8d818e84d370dab5337de2b52bf7e2 Mon Sep 17 00:00:00 2001 From: Pierre-Yves Chibon Date: Mar 20 2015 11:46:00 +0000 Subject: Allow doing COUNT queries when searching issues --- diff --git a/progit/lib/__init__.py b/progit/lib/__init__.py index f319fa6..2e70001 100644 --- a/progit/lib/__init__.py +++ b/progit/lib/__init__.py @@ -706,7 +706,7 @@ def get_project(session, name, user=None): def search_issues( session, repo, issueid=None, status=None, closed=False, tags=None, - assignee=None, author=None, private=None): + assignee=None, author=None, private=None, count=False): ''' Retrieve one or more issues associated to a project with the given criterias. @@ -743,6 +743,9 @@ def search_issues( If user name is specified: private tickets reported by that user are included. :type private: False, None or str + :kwarg count: a boolean to specify if the method should return the list + of Issues or just do a COUNT query. + :type count: boolean :return: A single Issue object if issueid is specified, a list of Project objects otherwise. @@ -820,6 +823,8 @@ def search_issues( if issueid is not None: output = query.first() + elif count: + output = query.count() else: output = query.all()