repopick: Support overriding the default commits count to check

* Support passing -c 20 to consider 20 changes instead of 10

Change-Id: I2b36228fb0020501896c800b13713aef284a5772
gugelfrei
Adrian DC 7 years ago committed by Bruno Martins
parent 86d668be40
commit df29022a38

@ -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

Loading…
Cancel
Save