Commit 1b4c7e9f authored by Christian Biesinger's avatar Christian Biesinger Committed by Commit Bot

Make gclient_utils work with Python 3

It seems like line is always a string, not bytes; this change
seems to make it work with both Python 2 and 3 (at least,
"gclient sync" looks correct and doesn't throw exceptions)

Bug: 984182
Change-Id: Iaa09e08d4eda0ccb54afa5598bac6231319d6c3d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1744766
Auto-Submit: Christian Biesinger <cbiesinger@chromium.org>
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
Reviewed-by: 's avatarEdward Lesmes <ehmaldonado@chromium.org>
parent a110bf60
...@@ -643,13 +643,13 @@ class GitFilter(object): ...@@ -643,13 +643,13 @@ class GitFilter(object):
def __call__(self, line): def __call__(self, line):
# git uses an escape sequence to clear the line; elide it. # git uses an escape sequence to clear the line; elide it.
esc = line.find(chr(0o33).encode()) esc = line.find(chr(0o33))
if esc > -1: if esc > -1:
line = line[:esc] line = line[:esc]
if self.predicate and not self.predicate(line): if self.predicate and not self.predicate(line):
return return
now = time.time() now = time.time()
match = self.PERCENT_RE.match(line.decode()) match = self.PERCENT_RE.match(line)
if match: if match:
if match.group(1) != self.progress_prefix: if match.group(1) != self.progress_prefix:
self.progress_prefix = match.group(1) self.progress_prefix = match.group(1)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment