repopick: Support overriding the default commits count to check
* Support passing -c 20 to consider 20 changes instead of 10
Change-Id: Ibebb0785ef159736b9bec998f0f5e0e56f18acdd
diff --git a/build/tools/repopick.py b/build/tools/repopick.py
index 9c660f5..521be4b 100644
--- a/build/tools/repopick.py
+++ b/build/tools/repopick.py
@@ -154,6 +154,7 @@
parser.add_argument('-Q', '--query', help='pick all commits using the specified query')
parser.add_argument('-g', '--gerrit', default=default_gerrit, help='Gerrit Instance to use. Form proto://[user@]host[:port]')
parser.add_argument('-e', '--exclude', nargs=1, help='exclude a list of commit numbers separated by a ,')
+ parser.add_argument('-c', '--check-picked', type=int, default=10, help='pass the amount of commits to check for already picked changes')
args = parser.parse_args()
if not args.start_branch and args.abandon_first:
parser.error('if --abandon-first is set, you must also give the branch name with --start-branch')
@@ -325,7 +326,7 @@
subprocess.check_output(['repo', 'start', args.start_branch[0], project_path])
# Determine the maximum commits to check already picked changes
- check_picked_count = 10
+ check_picked_count = args.check_picked
branch_commits_count = int(subprocess.check_output(['git', 'rev-list', '--count', 'HEAD'], cwd=project_path))
if branch_commits_count <= check_picked_count:
check_picked_count = branch_commits_count - 1