[PATCH] hgclient.py: use abolute_import and print_function
Pulkit Goyal
7895pulkit at gmail.com
Tue Mar 1 23:08:26 UTC 2016
# HG changeset patch
# User Pulkit Goyal <7895pulkit at gmail.com>
# Date 1456873576 -19800
# Wed Mar 02 04:36:16 2016 +0530
# Node ID 06a1ef8e92b9bb8d077b7902d4bb09dadd57b599
# Parent 4ab7f6108799840638228502a4fa57ff59167ce2
hgclient.py: Added absolute_import and print_function
diff -r 4ab7f6108799 -r 06a1ef8e92b9 contrib/hgclient.py
--- a/contrib/hgclient.py Wed Mar 02 04:29:11 2016 +0530
+++ b/contrib/hgclient.py Wed Mar 02 04:36:16 2016 +0530
@@ -1,6 +1,15 @@
# A minimal client for Mercurial's command server
-import os, sys, signal, struct, socket, subprocess, time, cStringIO
+from __future__ import absolute_import
+from __future__ import print_function
+import os
+import sys
+import signal
+import struct
+import socket
+import subprocess
+import time
+import cStringIO
def connectpipe(path=None):
cmdline = ['hg', 'serve', '--cmdserver', 'pipe']
@@ -69,7 +78,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 +101,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
diff -r 4ab7f6108799 -r 06a1ef8e92b9 tests/test-check-py3-compat.t
--- a/tests/test-check-py3-compat.t Wed Mar 02 04:29:11 2016 +0530
+++ b/tests/test-check-py3-compat.t Wed Mar 02 04:36:16 2016 +0530
@@ -4,8 +4,6 @@
$ hg files 'set:(**.py)' | sed 's|\\|/|g' | xargs python
contrib/check-py3-compat.py
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
More information about the Mercurial-devel
mailing list