Comparison

class github.Comparison.Comparison

This class represents Comparisons.

The reference can be found here https://docs.github.com/en/rest/commits/commits#compare-two-commits

This class has a paginated property. For details, see Comparison.commits() or Comparison.get_commits().

The OpenAPI schema can be found at

  • /components/schemas/commit-comparison

A CompletableGithubObject can be partially initialised (completed=False). Accessing attributes that are not initialized will then trigger a request to complete all attributes.

A partially initialized CompletableGithubObject (completed=False) can be completed via complete(). This requires the url to be given via parameter url or attributes.

With a requester where Requester.is_lazy == True, this CompletableGithubObjects is partially initialized. This requires the url to be given via parameter url or attributes. Any CompletableGithubObject created from this lazy object will be lazy itself if created with parameter url or attributes.

Parameters:
  • requester – requester

  • headers – response headers

  • attributes – attributes to initialize

  • completed – do not update non-initialized attributes when True

  • url – url of this instance, overrides attributes[‘url’]

  • accept – use this accept header when completing this instance

property commits: PaginatedList[Commit]

This is a paginated property.

Iterating over this paginated list may fetch multiple pages. The size of these pages can be controlled via the …_per_page parameter of github.Repository.Repository.compare(), github.Comparison.Comparison.get_commits(), or github.Github().

If no per_page is given, the default page size is 250. The maximum is 1000.

At most 10000 commits can be retrieved.

property files: list[File]

Only the first 300 changed files.

get_commits(*, comparison_commits_per_page: int | None = None) PaginatedList[Commit]
Calls:

GET /repos/{owner}/{repo}/compare/{base…:head}

Identical to calling github.Comparison.Comparison.commits(), except that this uses the given per_page value.

For more details, see github.Comparison.Comparison.commits().

Parameters:

comparison_commits_per_page – int Number of commits retrieved per page. Iterating over the commits will fetch pages of this size. The default page size is 250, the maximum is 1000. At most 10000 commits can be retrieved.