You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by br...@apache.org on 2013/01/06 02:39:17 UTC

svn commit: r1429453 - /subversion/trunk/tools/hook-scripts/validate-files.py

Author: breser
Date: Sun Jan  6 01:39:17 2013
New Revision: 1429453

URL: http://svn.apache.org/viewvc?rev=1429453&view=rev
Log:
validate-files.py: Use decode on output data from subprocesse.

This is necessary to be compatable with Python 3 which returns bytes instead
of strings for these calls.

* tools/hook-scripts/validate-files.py
  (Commands.svnlook_changed): Use decode on the lines and we read them
    and decode before writing stderr back out in case of an err.
  (Commands.user_command): Use decode before returning the stderr output.

Modified:
    subversion/trunk/tools/hook-scripts/validate-files.py

Modified: subversion/trunk/tools/hook-scripts/validate-files.py
URL: http://svn.apache.org/viewvc/subversion/trunk/tools/hook-scripts/validate-files.py?rev=1429453&r1=1429452&r2=1429453&view=diff
==============================================================================
--- subversion/trunk/tools/hook-scripts/validate-files.py (original)
+++ subversion/trunk/tools/hook-scripts/validate-files.py Sun Jan  6 01:39:17 2013
@@ -80,7 +80,7 @@ class Commands:
             line = p.stdout.readline()
             if not line:
                 break
-            line = line.strip()
+            line = line.decode().strip()
             text_mod = line[0:1]
             # Only if the contents of the file changed (by addition or update)
             # directories always end in / in the svnlook changed output
@@ -91,7 +91,7 @@ class Commands:
         # returncode/stderr output
         data = p.communicate()
         if p.returncode != 0:
-            sys.stderr.write(data[1])
+            sys.stderr.write(data[1].decode())
             sys.exit(2)
 
         return changed
@@ -109,7 +109,7 @@ class Commands:
         cmd_env['FILE'] = fn
         p = subprocess.Popen(cmd, shell=True, env=cmd_env, stderr=subprocess.PIPE)
         data = p.communicate()
-        return (p.returncode, data[1])
+        return (p.returncode, data[1].decode())
 
 def main(repo, txn):
     exitcode = 0