bisect-kit: cache some git operations
On a machine with slow disk io, this change could reduce
bisect_cr_localbuild_internal.py init time from 8 to 3.5 minutes.
BUG=b:157413258
TEST=./bisect_cr_localbuild_internal.py init --old 84.0.4142.0 --new 84.0.4147.0
Change-Id: I423c3df56eaa17acdd3bbe882b61fb99cde03fa7
diff --git a/bisect_kit/git_util.py b/bisect_kit/git_util.py
index 82a202b..f3da4e4 100644
--- a/bisect_kit/git_util.py
+++ b/bisect_kit/git_util.py
@@ -14,6 +14,7 @@
import subprocess
import time
+from bisect_kit import cache_util
from bisect_kit import cli
from bisect_kit import util
@@ -373,6 +374,7 @@
cwd=git_repo) != ''
+@cache_util.Cache.default_disabled
def get_commit_metadata(git_repo, rev):
"""Get metadata of given commit.
@@ -517,6 +519,7 @@
(path, git_repo, rev))
+@cache_util.Cache.default_disabled
def get_file_from_revision(git_repo, rev, path):
"""Get file content of given revision.