hgclient: use absolute_import and print_function
authorPulkit Goyal <7895pulkit@gmail.com>
Sun, 06 Mar 2016 03:15:45 +0530
changeset 28355 897a4bbd578b
parent 28354 00f317788d33
child 28356 a5c773acb018
hgclient: use absolute_import and print_function
contrib/hgclient.py
tests/test-check-py3-compat.t
--- a/contrib/hgclient.py	Sun Mar 06 03:10:17 2016 +0530
+++ b/contrib/hgclient.py	Sun Mar 06 03:15:45 2016 +0530
@@ -1,6 +1,14 @@
 # A minimal client for Mercurial's command server
 
-import os, sys, signal, struct, socket, subprocess, time, cStringIO
+from __future__ import absolute_import, print_function
+import cStringIO
+import os
+import signal
+import socket
+import struct
+import subprocess
+import sys
+import time
 
 def connectpipe(path=None):
     cmdline = ['hg', 'serve', '--cmdserver', 'pipe']
@@ -69,7 +77,7 @@
 
 def runcommand(server, args, output=sys.stdout, error=sys.stderr, input=None,
                outfilter=lambda x: x):
-    print '*** runcommand', ' '.join(args)
+    print('*** runcommand', ' '.join(args))
     sys.stdout.flush()
     server.stdin.write('runcommand\n')
     writeblock(server, '\0'.join(args))
@@ -92,10 +100,10 @@
         elif ch == 'r':
             ret, = struct.unpack('>i', data)
             if ret != 0:
-                print ' [%d]' % ret
+                print(' [%d]' % ret)
             return ret
         else:
-            print "unexpected channel %c: %r" % (ch, data)
+            print("unexpected channel %c: %r" % (ch, data))
             if ch.isupper():
                 return
 
--- a/tests/test-check-py3-compat.t	Sun Mar 06 03:10:17 2016 +0530
+++ b/tests/test-check-py3-compat.t	Sun Mar 06 03:15:45 2016 +0530
@@ -6,8 +6,6 @@
   contrib/check-code.py not using absolute_import
   contrib/check-code.py requires print_function
   contrib/debugshell.py not using absolute_import
-  contrib/hgclient.py not using absolute_import
-  contrib/hgclient.py requires print_function
   contrib/hgfixes/fix_bytes.py not using absolute_import
   contrib/hgfixes/fix_bytesmod.py not using absolute_import
   contrib/hgfixes/fix_leftover_imports.py not using absolute_import