Skip to content

Commit

Permalink
rework packages.get_repository_info to handle releases in branches
Browse files Browse the repository at this point in the history
  • Loading branch information
javierggt committed Sep 5, 2023
1 parent f18920c commit cef969a
Show file tree
Hide file tree
Showing 2 changed files with 218 additions and 118 deletions.
21 changes: 20 additions & 1 deletion skare3_tools/github/github.py
Original file line number Diff line number Diff line change
Expand Up @@ -436,6 +436,7 @@ def __init__(self, repo=None, owner=None, api=None):
self.branches = Branches(self)
self.checks = Checks(self)
self.pull_requests = PullRequests(self)
self.compare = Compare(self)
self.merge = Merge(self)
self.dispatch_event = DispatchEvent(self)
self.contents = Contents(self)
Expand Down Expand Up @@ -615,7 +616,7 @@ def __call__(self, ref=None, **kwargs):
json.update({k: kwargs[k] for k in optional if k in kwargs})
kwargs = {k: v for k, v in kwargs.items() if k not in json}
if ref is not None:
return self._get(
return self._get_list(
"repos/:owner/:repo/commits/:ref", ref=ref, params=json, **kwargs
)
return self._get_list("repos/:owner/:repo/commits", params=json, **kwargs)
Expand Down Expand Up @@ -778,6 +779,24 @@ def edit(self, issue_number, **kwargs):
)


class Compare(_EndpointGroup):
"""Compare two commits
(`compare API docs </repos/{owner}/{repo}/compare/{basehead}>`)
"""

def __call__(self, base, head, **kwargs):
"""
"""
required = []
json = {k: kwargs[k] for k in required}
kwargs = {k: v for k, v in kwargs.items() if k not in json}
return self._get(
"/repos/:owner/:repo/compare/:basehead",
basehead=f"{base}...{head}",
**kwargs
)

class PullRequests(_EndpointGroup):
"""
Endpoints that have to do with pull requests
Expand Down
Loading

0 comments on commit cef969a

Please sign in to comment.