Remove some Python 2 test code
Now that the presubmit system no longer supports Python 2 we can remove
support for it from the presubmit system tests. This change removes all
references to sys.version_info from this file.
This also fixes an unclosed file warning that suddenly appeared and
was stopping this change from landing.
Bug: 1207012
Change-Id: Ib74e9009b9d5cea0caf37c88e3258e9dd818f269
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/4522416
Reviewed-by: Aravind Vasudevan <aravindvasudev@google.com>
Commit-Queue: Bruce Dawson <brucedawson@chromium.org>
diff --git a/git_common.py b/git_common.py
index cd60bf6..0483536 100644
--- a/git_common.py
+++ b/git_common.py
@@ -922,17 +922,18 @@
def thaw():
took_action = False
- 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)
- if not match:
- if not took_action:
- return 'Nothing to thaw.'
- break
+ with run_stream('rev-list', 'HEAD') as stream:
+ for sha in stream:
+ sha = sha.strip().decode('utf-8')
+ msg = run('show', '--format=%f%b', '-s', 'HEAD')
+ match = FREEZE_MATCHER.match(msg)
+ if not match:
+ if not took_action:
+ return 'Nothing to thaw.'
+ break
- run('reset', '--' + FREEZE_SECTIONS[match.group(1)], sha)
- took_action = True
+ run('reset', '--' + FREEZE_SECTIONS[match.group(1)], sha)
+ took_action = True
def topo_iter(branch_tree, top_down=True):