stashy icon indicating copy to clipboard operation
stashy copied to clipboard

Infinite Loop when request changes for Pull Request with more than "page.max.changes"

Open critchtionary opened this issue 4 years ago • 0 comments

Using Bitbucket 6.10.0, Python 3.7.2 and stashy 0.6. Steps to reproduce:

  1. Check the value of page.max.changes in bitbucket.properties (defaults to 1000)
  2. Create a pull request with more than this amount of changes. Diff tab in pull request should show "This pull request is too large to render. Showing the first N files.
  3. Use stashy to request changes
pr_files = []
for change in bitbucket.projects[project].repos[slug].pull_requests[pr_id].changes():
    filename = change["path"]["toString"]
    if filename in pr_files:
        print("Duplicate file found!")
        print(len(pr_files))
        break # Break out of infinite loop
    pr_files.append(filename)

I would guess it's because the changes API returns isLastPage as False but it doesn't seem possible to get more than one page. The API doc even says "Note: This resource is currently not paged. The server will return at most one page. The server will truncate the number of changes to either the request's page limit or an internal maximum, whichever is smaller. The start parameter of the page request is also ignored. "

https://docs.atlassian.com/bitbucket-server/rest/6.10.0/bitbucket-rest.html#idp295

critchtionary avatar May 05 '20 12:05 critchtionary