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_mark_merge_base.py b/git_mark_merge_base.py
index 214b3df..c6b3181 100755
--- a/git_mark_merge_base.py
+++ b/git_mark_merge_base.py
@@ -11,6 +11,8 @@
 just print the effective merge base for the current branch.
 """
 
+from __future__ import print_function
+
 import argparse
 import sys
 
@@ -39,16 +41,16 @@
     try:
       remove_merge_base(cur)
     except CalledProcessError:
-      print 'No merge base currently exists for %s.' % cur
+      print('No merge base currently exists for %s.' % cur)
     return 0
 
   if opts.merge_base:
     try:
       opts.merge_base = hash_one(opts.merge_base)
     except CalledProcessError:
-      print >> sys.stderr, (
-          'fatal: could not resolve %s as a commit' % (opts.merge_base)
-      )
+      print(
+          'fatal: could not resolve %s as a commit' % opts.merge_base,
+          file=sys.stderr)
       return 1
 
     manual_merge_base(cur, opts.merge_base, upstream(cur))
@@ -57,9 +59,9 @@
   actual = get_or_create_merge_base(cur)
   if opts.merge_base and opts.merge_base != actual:
     ret = 1
-    print "Invalid merge_base %s" % opts.merge_base
+    print("Invalid merge_base %s" % opts.merge_base)
 
-  print "merge_base(%s): %s" % (cur, actual)
+  print("merge_base(%s): %s" % (cur, actual))
   return ret