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>
diff --git a/git_upstream_diff.py b/git_upstream_diff.py
index 72d1304..c21828f 100755
--- a/git_upstream_diff.py
+++ b/git_upstream_diff.py
@@ -3,6 +3,8 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
+from __future__ import print_function
+
import argparse
import sys
@@ -31,12 +33,12 @@
opts.branch = current_branch
if not opts.branch or opts.branch == 'HEAD':
- print 'fatal: Cannot perform git-upstream-diff while not on a branch'
+ print('fatal: Cannot perform git-upstream-diff while not on a branch')
return 1
par = git.upstream(opts.branch)
if not par:
- print 'fatal: No upstream configured for branch \'%s\'' % opts.branch
+ print('fatal: No upstream configured for branch \'%s\'' % opts.branch)
return 1
cmd = [git.GIT_EXE, '-c', 'core.quotePath=false',