repopick: Support overriding the default commits count to check
* Support passing -c 20 to consider 20 changes instead of 10
Change-Id: I2b36228fb0020501896c800b13713aef284a5772
diff --git a/build/tools/repopick.py b/build/tools/repopick.py
index c62a579..1e3b6b0 100755
--- a/build/tools/repopick.py
+++ b/build/tools/repopick.py
@@ -155,6 +155,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')
@@ -326,7 +327,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