aboutsummaryrefslogtreecommitdiff
path: root/infra/repo_manager.py
diff options
context:
space:
mode:
Diffstat (limited to 'infra/repo_manager.py')
-rw-r--r--infra/repo_manager.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/infra/repo_manager.py b/infra/repo_manager.py
index a0b97b3ef..07880d81a 100644
--- a/infra/repo_manager.py
+++ b/infra/repo_manager.py
@@ -135,7 +135,7 @@ class RepoManager:
check_result=True)
self.git(['remote', 'update'], check_result=True)
- def get_commit_list(self, newest_commit, oldest_commit=None):
+ def get_commit_list(self, newest_commit, oldest_commit=None, limit=None):
"""Gets the list of commits(inclusive) between the old and new commits.
Args:
@@ -162,7 +162,11 @@ class RepoManager:
else:
commit_range = newest_commit
- out, _, err_code = self.git(['rev-list', commit_range])
+ limit_args = []
+ if limit:
+ limit_args.append(f'--max-count={limit}')
+
+ out, _, err_code = self.git(['rev-list', commit_range] + limit_args)
commits = out.split('\n')
commits = [commit for commit in commits if commit]
if err_code or not commits: