Reland "Drop py2 support in gerrit and git related files"
This is a reland of commit b5c7f4b46c3309d46e1796bce7fa83388af9bfd8
Original change's description:
> Drop py2 support in gerrit and git related files
>
> python3 is the only supported version of python in depot_tools.
>
> Bug: 1475402
> Change-Id: Ie4ee18d297081b3aa0206b8d7ce6461819bff0ca
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/4809560
> Reviewed-by: Josip Sokcevic <sokcevic@chromium.org>
> Commit-Queue: Gavin Mak <gavinmak@google.com>
Bug: 1475402
Change-Id: I194180494071777b7b9dd91a5c8edabbbf5484c1
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/4811218
Reviewed-by: Joanna Wang <jojwang@chromium.org>
Commit-Queue: Gavin Mak <gavinmak@google.com>
diff --git a/git_number.py b/git_number.py
index f46b1ee..864f3ee 100755
--- a/git_number.py
+++ b/git_number.py
@@ -21,9 +21,6 @@
repo that it operates on in the ref 'refs/number/commits'.
"""
-from __future__ import print_function
-from __future__ import division
-
import binascii
import collections
import logging
@@ -60,10 +57,7 @@
>>> pathlify('\xDE\xAD')
'de/ad'
"""
- if sys.version_info.major == 3:
- return '/'.join('%02x' % b for b in hash_prefix)
-
- return '/'.join('%02x' % ord(b) for b in hash_prefix)
+ return '/'.join('%02x' % b for b in hash_prefix)
@git.memoize_one(threadsafe=False)
@@ -184,10 +178,7 @@
def all_prefixes(depth=PREFIX_LEN):
- if sys.version_info.major == 3:
- prefixes = [bytes([i]) for i in range(255)]
- else:
- prefixes = [chr(i) for i in range(255)]
+ prefixes = [bytes([i]) for i in range(255)]
for x in prefixes:
# This isn't covered because PREFIX_LEN currently == 1
if depth > 1: # pragma: no cover