Browse Source

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>
Martin Bidlingmaier 2 years ago
parent
commit
6f2321d1de
1 changed files with 1 additions and 1 deletions
  1. 1 1
      git_common.py

+ 1 - 1
git_common.py

@@ -922,7 +922,7 @@ def tags(*args):
 
 
 def thaw():
 def thaw():
   took_action = False
   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')
     sha = sha.strip().decode('utf-8')
     msg = run('show', '--format=%f%b', '-s', 'HEAD')
     msg = run('show', '--format=%f%b', '-s', 'HEAD')
     match = FREEZE_MATCHER.match(msg)
     match = FREEZE_MATCHER.match(msg)