def get_commits_batch(request, repo, startSha, endSha, size=DEFAULT_COMMITS_SIZE, keep_first=False): commits = builds_helper.get_commits(request=request, repo=repo, startSha=startSha, endSha=endSha, size=size) truncated = False new_start_sha = None if commits and len(commits) >= size: new_start_sha = commits[-1]["sha"] truncated = True if not keep_first and commits: commits.pop(0) return commits, truncated, new_start_sha
def get_commits_batch(request, repo, startSha, endSha, size=DEFAULT_COMMITS_SIZE, keep_first=False): commits = builds_helper.get_commits(request=request, repo=repo, startSha=startSha, endSha=endSha, size=size) truncated = False new_start_sha = None if commits and len(commits) >= size: new_start_sha = commits[-1]["sha"] truncated = True if not keep_first and commits: commits.pop(0) return commits, truncated, new_start_sha