Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 39881f86 authored by Michael W's avatar Michael W Committed by Paul Keith
Browse files

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
parent c93bdd63
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -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