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_map_branches.py b/git_map_branches.py
index 290f90f..60cf317 100755
--- a/git_map_branches.py
+++ b/git_map_branches.py
@@ -24,6 +24,8 @@
     upstream, then you will see this.
 """
 
+from __future__ import print_function
+
 import argparse
 import collections
 import os
@@ -185,8 +187,8 @@
       parent = self.__branches_info[cycle[-1]].upstream
       cycle.append(parent)
       if parent == branch:
-        print >> sys.stderr, 'Warning: Detected cycle in branches: {}'.format(
-            ' -> '.join(cycle))
+        print('Warning: Detected cycle in branches: {}'.format(
+            ' -> '.join(cycle)), file=sys.stderr)
         return True
     return False
 
@@ -312,11 +314,11 @@
 def main(argv):
   setup_color.init()
   if get_git_version() < MIN_UPSTREAM_TRACK_GIT_VERSION:
-    print >> sys.stderr, (
+    print(
         'This tool will not show all tracking information for git version '
         'earlier than ' +
         '.'.join(str(x) for x in MIN_UPSTREAM_TRACK_GIT_VERSION) +
-        '. Please consider upgrading.')
+        '. Please consider upgrading.', file=sys.stderr)
 
   if '-h' in argv:
     print_desc()
@@ -342,7 +344,7 @@
   mapper.maxjobs = opts.maxjobs
   mapper.show_subject = opts.show_subject
   mapper.start()
-  print mapper.output.as_formatted_string()
+  print(mapper.output.as_formatted_string())
   return 0
 
 if __name__ == '__main__':