repopick: Limit commit counting
* For every commit, repopick checks the last commits for the presence of the commits to be picked * In every project a change should go in, it calls "git rev-list --count" to find the maximum amount of commits to be searched, but it only cares if there are less (or equal) commits at all than to be checked * Therefore, we can limit the counting to one more than we want to check * This is relevant for example for fw/b, where there is a huge amount of changes and therefore a lot of time used to count * Example: fw/b git rev-list --count HEAD: 46.693s git rev-list --count --max-count=1000 : 0.019s * Real-life example: repopick -t qs-lightmode Old: 2m33.375s New: 0m6.657s Change-Id: If0500574fb282e332996b606dd9926841f8e0e88
This commit is contained in:
@@ -393,7 +393,8 @@ if __name__ == '__main__':
|
||||
|
||||
# Determine the maximum commits to check already picked changes
|
||||
check_picked_count = args.check_picked
|
||||
branch_commits_count = int(subprocess.check_output(['git', 'rev-list', '--count', 'HEAD'], cwd=project_path))
|
||||
max_count = '--max-count={0}'.format(check_picked_count + 1)
|
||||
branch_commits_count = int(subprocess.check_output(['git', 'rev-list', '--count', max_count, 'HEAD'], cwd=project_path))
|
||||
if branch_commits_count <= check_picked_count:
|
||||
check_picked_count = branch_commits_count - 1
|
||||
|
||||
|
Reference in New Issue
Block a user