8000 Merge branch 'per-page' of daevaorn/github3.py · pythonthings/github3.py@4377c01 · GitHub
[go: up one dir, main page]

Skip to content
8000

Commit 4377c01

Browse files
committed
Merge branch 'per-page' of daevaorn/github3.py
Conflicts: AUTHORS.rst
2 parents ab3486b + 26f9a81 commit 4377c01

File tree

3 files changed

+19
-2
lines changed

3 files changed

+19
-2
lines changed

AUTHORS.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,7 @@ Contributors
125125

126126
- Abhijeet Kasurde (@akasurde)
127127

128+
<<<<<<< HEAD
128129
- Matthew Krueger (@mlkrueger1987)
129130

130131
- Dejan Svetec (@dsvetec)
@@ -138,3 +139,5 @@ Contributors
138139
- Goodwillcoding (@goodwillcoding)
139140

140141
- Andreas Backx (@AndreasBackx)
142+
143+
- Alexander Koshelev <daevaorn@gmail.com>

github3/repos/repo.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -593,7 +593,7 @@ def commit_comment(self, comment_id):
593593
return self._instance_or_null(RepoComment, json)
594594

595595
def commits(self, sha=None, path=None, author=None, number=-1, etag=None,
596-
since=None, until=None):
596+
since=None, until=None, per_page=None):
597597
r"""Iterate over commits in this repository.
598598
599599
:param str sha: (optional), sha or branch to start listing commits
@@ -614,13 +614,15 @@ def commits(self, sha=None, path=None, author=None, number=-1, etag=None,
614614
be returned. This can be a ``datetime`` or an ``ISO8601`` formatted
615615
date string.
616616
:type until: datetime or string
617+
:param int per_page: (optional), commits listing page size
617618
618619
:returns: generator of
619620
:class:`RepoCommit <github3.repos.commit.RepoCommit>`\ s
620621
"""
621622
params = {'sha': sha, 'path': path, 'author': author,
622623
'since': timestamp_parameter(since),
623-
'until': timestamp_parameter(until)}
624+
'until': timestamp_parameter(until),
625+
'per_page': per_page}
624626

625627
self._remove_none(params)
626628
url = self._build_url('commits', base_url=self._api)

tests/unit/test_repos_repo.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1093,6 +1093,18 @@ def test_commits_since_until_datetime(self):
10931093
headers={}
10941094
)
10951095

1096+
def test_commits_per_page(self):
1097+
"""Test the ability to specify page size for commits listing."""
1098+
1099+
i = self.instance.commits(per_page=10)
1100+
self.get_next(i)
1101+
1102+
self.session.get.assert_called_once_with(
1103+
url_for('commits'),
1104+
params={'per_page': 10},
1105+
headers={}
1106+
)
1107+
10961108
def test_commits_sha_path(self):
10971109
"""Test the ability to filter commits by branch and path."""
10981110
i = self.instance.commits(sha='branch', path='tests/')

0 commit comments

Comments
 (0)
0