From 6f2321d1de694d4ca56784ba8b5634f9ca74b3a6 Mon Sep 17 00:00:00 2001 From: Martin Bidlingmaier Date: Wed, 26 Oct 2022 17:39:01 +0000 Subject: [PATCH] Speed up git thaw Previously, git thaw would read the whole output of git rev-list HEAD via readlines(). This was unnecessary, because we almost always only need to look a few of the most recent commits. Most of the runtime of git-thaw was spend on this. After this commit, we only read the lines we actually need. This makes git thaw run much faster. Bug: 1378479 Change-Id: I6f6c06e1df55b4943a94642aa414fc11aeea5718 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/3981233 Reviewed-by: Josip Sokcevic Commit-Queue: Martin Bidlingmaier --- git_common.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/git_common.py b/git_common.py index 3fea740d5..86a571e2f 100644 --- a/git_common.py +++ b/git_common.py @@ -922,7 +922,7 @@ def tags(*args): def thaw(): took_action = False - for sha in run_stream('rev-list', 'HEAD').readlines(): + for sha in run_stream('rev-list', 'HEAD'): sha = sha.strip().decode('utf-8') msg = run('show', '--format=%f%b', '-s', 'HEAD') match = FREEZE_MATCHER.match(msg)