contrib/hgclient.py
changeset 28355 897a4bbd578b
parent 22993 24c5fd2894f8
child 28836 3f45488d70df
--- 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