subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From stef...@apache.org
Subject svn commit: r1741735 - in /subversion/trunk: contrib/client-side/ contrib/client-side/svnmerge/ contrib/server-side/ contrib/server-side/fsfsfixer/fixer/ tools/dev/mergegraph/
Date Sat, 30 Apr 2016 09:48:13 GMT
Author: stefan2
Date: Sat Apr 30 09:48:13 2016
New Revision: 1741735

URL: http://svn.apache.org/viewvc?rev=1741735&view=rev
Log:
Work towards Python 3 compatibility.  Since we already require Python 2.7+,
we can use the new syntax without further limiting our Python 2 support.

* contrib/client-side/svn_export_empty_files.py
* contrib/client-side/svnmerge/svnmerge-migrate-history.py
* contrib/client-side/svnmerge/svnmerge.py
* contrib/client-side/svn-merge-vendor.py
* contrib/server-side/add-needs-lock.py
* contrib/server-side/fsfsfixer/fixer/find_good_id.py
* contrib/server-side/fsfsverify.py
* tools/dev/mergegraph/mergegraph.py
  (): Replace occurances of Python 2 print statements to std streams
      with calls to the Python 3 style print function.  Don't forget
      to explicitly print a newline.

Modified:
    subversion/trunk/contrib/client-side/svn-merge-vendor.py
    subversion/trunk/contrib/client-side/svn_export_empty_files.py
    subversion/trunk/contrib/client-side/svnmerge/svnmerge-migrate-history.py
    subversion/trunk/contrib/client-side/svnmerge/svnmerge.py
    subversion/trunk/contrib/server-side/add-needs-lock.py
    subversion/trunk/contrib/server-side/fsfsfixer/fixer/find_good_id.py
    subversion/trunk/contrib/server-side/fsfsverify.py
    subversion/trunk/tools/dev/mergegraph/mergegraph.py

Modified: subversion/trunk/contrib/client-side/svn-merge-vendor.py
URL: http://svn.apache.org/viewvc/subversion/trunk/contrib/client-side/svn-merge-vendor.py?rev=1741735&r1=1741734&r2=1741735&view=diff
==============================================================================
--- subversion/trunk/contrib/client-side/svn-merge-vendor.py (original)
+++ subversion/trunk/contrib/client-side/svn-merge-vendor.py Sat Apr 30 09:48:13 2016
@@ -336,7 +336,7 @@ def get_xml_text_content(xml_doc, xpath)
 
 def usage(error = None):
     """Print usage message and exit"""
-    print >>sys.stderr, """%s: Merges the difference between two revisions of the original
repository of the vendor, to the vendor branch
+    sys.stderr.write("""%s: Merges the difference between two revisions of the original repository
of the vendor, to the vendor branch
 usage: %s [options] REPO_URL CURRENT_PATH ORIGINAL_REPO_URL -r N:M
 
   - REPO_URL : repository URL for the vendor branch (i.e: http://svn.example.com/repos/vendor/libcomplex)
@@ -369,10 +369,10 @@ Valid options:
   -v [--verbose]           : verbose mode
   -c [--merged-vendor] arg : working copy path of the original already merged vendor trunk
(skips the steps 1. and 2.)
   -w [--current-wc] arg    : working copy path of the current checked out trunk of the vendor
branch (skips the step 3.)
-    """ % ((prog_name,) * 2)
+    """ % ((prog_name,) * 2))
 
     if error:
-        print >>sys.stder, "", "Current error : "+error
+        sys.stder.write("\nCurrent error : " + error + "\n")
 
     sys.exit(1)
 

Modified: subversion/trunk/contrib/client-side/svn_export_empty_files.py
URL: http://svn.apache.org/viewvc/subversion/trunk/contrib/client-side/svn_export_empty_files.py?rev=1741735&r1=1741734&r2=1741735&view=diff
==============================================================================
--- subversion/trunk/contrib/client-side/svn_export_empty_files.py (original)
+++ subversion/trunk/contrib/client-side/svn_export_empty_files.py Sat Apr 30 09:48:13 2016
@@ -363,7 +363,7 @@ if __name__ == '__main__':
     except getopt.GetoptError:
         usage(False)
     if len(args) < 1 or len(args) > 2:
-        print >>sys.stderr, "Incorrect number of arguments"
+        sys.stderr.write("Incorrect number of arguments\n")
         usage(False)
 
     for o, a in opts:
@@ -397,7 +397,7 @@ if __name__ == '__main__':
         try:
             last_slash_index = url.rindex('/')
         except ValueError:
-            print >>sys.stderr, "Cannot find a / in the URL '%s'" % url
+            sys.stderr.write("Cannot find a / in the URL '%s'\n" % url)
             usage(False)
         export_pathname = url[last_slash_index+1:]
 

Modified: subversion/trunk/contrib/client-side/svnmerge/svnmerge-migrate-history.py
URL: http://svn.apache.org/viewvc/subversion/trunk/contrib/client-side/svnmerge/svnmerge-migrate-history.py?rev=1741735&r1=1741734&r2=1741735&view=diff
==============================================================================
--- subversion/trunk/contrib/client-side/svnmerge/svnmerge-migrate-history.py (original)
+++ subversion/trunk/contrib/client-side/svnmerge/svnmerge-migrate-history.py Sat Apr 30 09:48:13
2016
@@ -67,8 +67,8 @@ def usage_and_exit(error_msg=None):
 
   stream = error_msg and sys.stderr or sys.stdout
   if error_msg:
-    print >> stream, "ERROR: %s\n" % error_msg
-  print >> stream, """Usage: %s REPOS_PATH [PATH_PREFIX...] [OPTIONS]
+    stream.write("ERROR: %s\n\n" % error_msg)
+  stream.write("""Usage: %s REPOS_PATH [PATH_PREFIX...] [OPTIONS]
        %s --help
 
 Migrate merge history from svnmerge.py's format to Subversion 1.5's
@@ -88,7 +88,7 @@ Options:
 Example:
 
    %s /path/to/repos trunk branches tags
-""" % (progname, progname, progname)
+""" % (progname, progname, progname))
   sys.exit(error_msg and 1 or 0)
 
 class Migrator:

Modified: subversion/trunk/contrib/client-side/svnmerge/svnmerge.py
URL: http://svn.apache.org/viewvc/subversion/trunk/contrib/client-side/svnmerge/svnmerge.py?rev=1741735&r1=1741734&r2=1741735&view=diff
==============================================================================
--- subversion/trunk/contrib/client-side/svnmerge/svnmerge.py (original)
+++ subversion/trunk/contrib/client-side/svnmerge/svnmerge.py Sat Apr 30 09:48:13 2016
@@ -206,7 +206,7 @@ def console_width():
 
 def error(s):
     """Subroutine to output an error and bail."""
-    print >> sys.stderr, "%s: %s" % (NAME, s)
+    sys.stderr.write("%s: %s\n" % (NAME, s))
     sys.exit(1)
 
 def report(s):
@@ -1981,7 +1981,7 @@ class CommandOpts:
         return cmd, args, state
 
     def error(self, s, cmd=None):
-        print >>sys.stderr, "%s: %s" % (self.progname, s)
+        sys.stderr.write("%s: %s\n" % (self.progname, s))
         if cmd is not None:
             self.print_command_help(cmd)
         else:

Modified: subversion/trunk/contrib/server-side/add-needs-lock.py
URL: http://svn.apache.org/viewvc/subversion/trunk/contrib/server-side/add-needs-lock.py?rev=1741735&r1=1741734&r2=1741735&view=diff
==============================================================================
--- subversion/trunk/contrib/server-side/add-needs-lock.py (original)
+++ subversion/trunk/contrib/server-side/add-needs-lock.py Sat Apr 30 09:48:13 2016
@@ -47,7 +47,7 @@ try:
   import svn.fs
   import svn.repos
 except ImportError as e:
-  print >> sys.stderr, "ERROR: Unable to import Subversion's Python bindings: '%s'"
% e
+  sys.stderr.write("ERROR: Unable to import Subversion's Python bindings: '%s'\n" % e)
   sys.exit(1)
 
 # Walk a tree returning file paths

Modified: subversion/trunk/contrib/server-side/fsfsfixer/fixer/find_good_id.py
URL: http://svn.apache.org/viewvc/subversion/trunk/contrib/server-side/fsfsfixer/fixer/find_good_id.py?rev=1741735&r1=1741734&r2=1741735&view=diff
==============================================================================
--- subversion/trunk/contrib/server-side/fsfsfixer/fixer/find_good_id.py (original)
+++ subversion/trunk/contrib/server-side/fsfsfixer/fixer/find_good_id.py Sat Apr 30 09:48:13
2016
@@ -117,7 +117,7 @@ if __name__ == '__main__':
   # reconstruct the file so as to preserve all offsets.
   # ### TODO: This check should be in the caller rather than here.
   if len(good_id) != len(bad_id):
-    print >>sys.stderr, "warning: the good ID has a different length: " + \
-                        "bad id '" + bad_id + "', good id '" + good_id + "'"
+    sys.stderr.write("warning: the good ID has a different length: " + \
+                     "bad id '" + bad_id + "', good id '" + good_id + "'\n")
 
   print good_id

Modified: subversion/trunk/contrib/server-side/fsfsverify.py
URL: http://svn.apache.org/viewvc/subversion/trunk/contrib/server-side/fsfsverify.py?rev=1741735&r1=1741734&r2=1741735&view=diff
==============================================================================
--- subversion/trunk/contrib/server-side/fsfsverify.py (original)
+++ subversion/trunk/contrib/server-side/fsfsverify.py Sat Apr 30 09:48:13 2016
@@ -561,7 +561,7 @@ class Rep(object):
       raise e
 
     if self.rev != currentRev:
-      print >>sys.stderr, "Skipping text rep since it isn't present in the current
rev"
+      sys.stderr.write("Skipping text rep since it isn't present in the current rev\n")
       return
 
     f.seek(self.offset)
@@ -1078,16 +1078,16 @@ def checkOptions(options):
       count = count + 1
 
   if count > 1:
-    print >>sys.stderr, "Please use only one of -c, -f, and -t."
+    sys.stderr.write("Please use only one of -c, -f, and -t.\n")
     sys.exit(1)
 
   if options.dumpChanged and (options.dumpWindows or options.dumpInstructions):
-    print >>sys.stderr, \
-      "-c is incompatible with -w and -i.  Dropping -w and/or -i."
+    sys.stderr.write(\
+      "-c is incompatible with -w and -i.  Dropping -w and/or -i.\n")
 
   if options.noVerify and (options.dumpWindows or options.dumpInstructions):
-    print >>sys.stderr, \
-      "--no-verify is incompatible with -w and -i.  Dropping -w and/or -i."
+    sys.stderr.write(\
+      "--no-verify is incompatible with -w and -i.  Dropping -w and/or -i.\n")
 
 
 def handleError(error, withTraceback=False):
@@ -1096,8 +1096,8 @@ def handleError(error, withTraceback=Fal
     import traceback
     traceback.print_exc()
 
-  print >>sys.stderr,"Error %s: %s" % (error.__class__.__name__, str(e))
-  print >>sys.stderr,"Try running with -f to fix the revision"
+  sys.stderr.write("Error %s: %s\n" % (error.__class__.__name__, str(e)))
+  sys.stderr.write("Try running with -f to fix the revision\n")
   sys.exit(1)
 
 

Modified: subversion/trunk/tools/dev/mergegraph/mergegraph.py
URL: http://svn.apache.org/viewvc/subversion/trunk/tools/dev/mergegraph/mergegraph.py?rev=1741735&r1=1741734&r2=1741735&view=diff
==============================================================================
--- subversion/trunk/tools/dev/mergegraph/mergegraph.py (original)
+++ subversion/trunk/tools/dev/mergegraph/mergegraph.py Sat Apr 30 09:48:13 2016
@@ -242,7 +242,7 @@ class MergeDot(MergeGraph, pydot.Dot):
                                              'annotations': '[]' })
     files_read = config.read(config_filename)
     if len(files_read) == 0:
-      print >> sys.stderr, 'graph: unable to read graph config from "' + config_filename
+ '"'
+      sys.stderr.write('graph: unable to read graph config from "' + config_filename + '"\n')
       sys.exit(1)
     graph.basename = config.get('graph', 'basename')
     graph.title = config.get('graph', 'title')



Mime
View raw message