mirror of
https://chromium.googlesource.com/chromium/tools/depot_tools.git
synced 2026-01-11 18:51:29 +00:00
Convert print statements to Python 3 style
Ran "2to3 -w -n -f print ./" and manually added imports. Ran "^\s*print " and "\s+print " to find batch/shell scripts, comments and the like with embedded code, and updated them manually. Also manually added imports to files, which used print as a function, but were missing the import. The scripts still work with Python 2. There are no intended behaviour changes. Bug: 942522 Change-Id: Id777e4d4df4adcdfdab1b18bde89f235ef491b9f Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1595684 Reviewed-by: Dirk Pranke <dpranke@chromium.org> Commit-Queue: Dirk Pranke <dpranke@chromium.org> Auto-Submit: Raul Tambre <raul@tambre.ee>
This commit is contained in:
@@ -9,6 +9,8 @@ is more than one downstream branch, then this script will prompt you to select
|
||||
which branch.
|
||||
"""
|
||||
|
||||
from __future__ import print_function
|
||||
|
||||
import argparse
|
||||
import sys
|
||||
|
||||
@@ -36,24 +38,24 @@ def main(args):
|
||||
cur = hash_one(cur)
|
||||
downstreams = [b for b in branches() if upfn(b) == cur]
|
||||
if not downstreams:
|
||||
print "No downstream branches"
|
||||
print("No downstream branches")
|
||||
return 1
|
||||
elif len(downstreams) == 1:
|
||||
run('checkout', downstreams[0], stdout=sys.stdout, stderr=sys.stderr)
|
||||
else:
|
||||
high = len(downstreams) - 1
|
||||
while True:
|
||||
print "Please select a downstream branch"
|
||||
print("Please select a downstream branch")
|
||||
for i, b in enumerate(downstreams):
|
||||
print " %d. %s" % (i, b)
|
||||
print(" %d. %s" % (i, b))
|
||||
prompt = "Selection (0-%d)[0]: " % high
|
||||
r = opts.pick
|
||||
if r:
|
||||
print prompt + r
|
||||
print(prompt + r)
|
||||
else:
|
||||
r = raw_input(prompt).strip() or '0'
|
||||
if not r.isdigit() or (0 > int(r) > high):
|
||||
print "Invalid choice."
|
||||
print("Invalid choice.")
|
||||
else:
|
||||
run('checkout', downstreams[int(r)], stdout=sys.stdout,
|
||||
stderr=sys.stderr)
|
||||
|
||||
Reference in New Issue
Block a user