From df29022a38f72670a47d12eb7713b6c5847e6ae9 Mon Sep 17 00:00:00 2001 From: Adrian DC Date: Thu, 7 Sep 2017 22:59:54 +0200 Subject: [PATCH] repopick: Support overriding the default commits count to check * Support passing -c 20 to consider 20 changes instead of 10 Change-Id: I2b36228fb0020501896c800b13713aef284a5772 --- build/tools/repopick.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/build/tools/repopick.py b/build/tools/repopick.py index c62a579e..1e3b6b0c 100755 --- a/build/tools/repopick.py +++ b/build/tools/repopick.py @@ -155,6 +155,7 @@ if __name__ == '__main__': 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 @@ if __name__ == '__main__': 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