findmissing: getopen: Instantiate commit handlers only once per branch
The getopen tool examines either a stable release branch or a Chrome OS
branch, but not both. That means that we can instantiate the commit
handler(s) for it once and re-use them. There is not need to re-instantiate
the handler(s) for each branch, much less for each SHA.
Move instantiation to once per branch for now. Next step willl be to move
it up even further, to instantiate it once per repository, but I want to
explore if there is a better way to implement this before doing that.
BUG=b:177099511
TEST=Run getopen
Change-Id: Ia377d888f794f023195d877fbe67c121c28defbd
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/dev-util/+/2641545
Tested-by: Guenter Roeck <groeck@chromium.org>
Reviewed-by: Curtis Malainey <cujomalainey@chromium.org>
Commit-Queue: Guenter Roeck <groeck@chromium.org>
diff --git a/contrib/findmissing/getopen.py b/contrib/findmissing/getopen.py
index ce0c325..c25e5db 100755
--- a/contrib/findmissing/getopen.py
+++ b/contrib/findmissing/getopen.py
@@ -131,10 +131,12 @@
if metadata.kernel_fixes_table == 'stable_fixes':
table = 'linux_stable'
- kernel = common.Kernel.linux_stable
+ handler = git_interface.commitHandler(common.Kernel.linux_stable)
+ rc_handler = git_interface.commitHandler(common.Kernel.linux_stable_rc)
else:
table = 'linux_chrome'
- kernel = common.Kernel.linux_chrome
+ handler = git_interface.commitHandler(common.Kernel.linux_chrome)
+ rc_handler = None
c = db.cursor()
@@ -189,11 +191,6 @@
affected_branches += version_list(metadata.branches, start, end)
affected_branches = sorted(list(set(affected_branches)), key=branch_order)
if affected_branches:
- handler = git_interface.commitHandler(kernel)
- if kernel == common.Kernel.linux_stable:
- rc_handler = git_interface.commitHandler(common.Kernel.linux_stable_rc)
- else:
- rc_handler = None
print(' Affected branches:')
for affected_branch in affected_branches:
branch_name = metadata.get_kernel_branch(affected_branch)