mirror of
https://chromium.googlesource.com/chromium/tools/depot_tools.git
synced 2026-01-11 10:41:31 +00:00
Revert "Drop py2 support in gerrit and git related files"
This reverts commit b5c7f4b46c.
Reason for revert: missing a replace for urlparse.urlparse
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: Idd00fdfe0b3d62785da2789a7dfcc9fbc79b6385
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/4811623
Reviewed-by: Aravind Vasudevan <aravindvasudev@google.com>
Commit-Queue: Gavin Mak <gavinmak@google.com>
This commit is contained in:
@@ -21,6 +21,9 @@ commit's entire history, this script caches all calculated data inside the git
|
||||
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
|
||||
@@ -57,7 +60,10 @@ def pathlify(hash_prefix):
|
||||
>>> pathlify('\xDE\xAD')
|
||||
'de/ad'
|
||||
"""
|
||||
return '/'.join('%02x' % b for b in hash_prefix)
|
||||
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)
|
||||
|
||||
|
||||
@git.memoize_one(threadsafe=False)
|
||||
@@ -178,7 +184,10 @@ def preload_tree(prefix):
|
||||
|
||||
|
||||
def all_prefixes(depth=PREFIX_LEN):
|
||||
prefixes = [bytes([i]) for i in range(255)]
|
||||
if sys.version_info.major == 3:
|
||||
prefixes = [bytes([i]) for i in range(255)]
|
||||
else:
|
||||
prefixes = [chr(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
|
||||
|
||||
Reference in New Issue
Block a user