changeset 28355:897a4bbd578b

hgclient: use absolute_import and print_function
author Pulkit Goyal <7895pulkit@gmail.com>
date Sun, 06 Mar 2016 03:15:45 +0530
parents 00f317788d33
children a5c773acb018
files contrib/hgclient.py tests/test-check-py3-compat.t
diffstat 2 files changed, 12 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- 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