|
13 | 13 |
|
14 | 14 |
|
15 | 15 | def get_diff(repository_name, last_commit_id, previous_commit_id): |
16 | | - response = None |
| 16 | + differences = [] |
| 17 | + response_iterator = None |
17 | 18 |
|
18 | | - if previous_commit_id is not None: |
19 | | - response = codecommit.get_differences( |
| 19 | + paginator = codecommit.get_paginator('get_differences') |
| 20 | + |
| 21 | + if previous_commit_id is None: |
| 22 | + # This was the first commit (no previous, omit beforeCommitSpecifier) |
| 23 | + response_iterator = paginator.paginate( |
20 | 24 | repositoryName=repository_name, |
21 | | - beforeCommitSpecifier=previous_commit_id, |
22 | | - afterCommitSpecifier=last_commit_id |
| 25 | + afterCommitSpecifier=last_commit_id, |
23 | 26 | ) |
24 | 27 | else: |
25 | | - # This was the first commit (no previous, omit beforeCommitSpecifier) |
26 | | - response = codecommit.get_differences( |
| 28 | + response_iterator = paginator.paginate( |
27 | 29 | repositoryName=repository_name, |
28 | | - afterCommitSpecifier=last_commit_id |
| 30 | + beforeCommitSpecifier=previous_commit_id, |
| 31 | + afterCommitSpecifier=last_commit_id, |
29 | 32 | ) |
30 | 33 |
|
31 | | - return response["differences"] |
| 34 | + for response in response_iterator: |
| 35 | + differences += response["differences"] |
| 36 | + |
| 37 | + return differences |
32 | 38 |
|
33 | 39 |
|
34 | 40 | def get_diff_change_message_type(change_type): |
|
0 commit comments