Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 17 additions & 2 deletions github2/commits.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import pagerator
from github2.core import BaseData, GithubCommand, Attribute, DateAttribute


Expand Down Expand Up @@ -26,9 +27,23 @@ def __repr__(self):
class Commits(GithubCommand):
domain = "commits"

def list(self, project, branch="master", file=None):
def list(self, project, branch="master", file=None, page = None):
post_data = {}
if page is not None:
post_data['page'] = page
return self.get_values("list", project, branch, file,
filter="commits", datatype=Commit)
filter="commits", datatype=Commit,
post_data=post_data)

def iter(self, project, branch="master", file=None):
return pagerator.IterableQuery(
lambda page: self.get_values(
"list", project, branch, file,
filter="commits", datatype=Commit,
post_data=dict(page=page+1)
),
35 # page_size hardcoded in the GitHub
)

def show(self, project, sha):
return self.get_value("show", project, sha,
Expand Down