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 <sokcevic@google.com>
Commit-Queue: Martin Bidlingmaier <mbid@google.com>
changes/33/3981233/3
Martin Bidlingmaier 3 years ago committed by LUCI CQ
parent f4670898b9
commit 6f2321d1de

@ -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)

Loading…
Cancel
Save