--- a/contrib/hgclient.py Wed Nov 07 22:37:51 2018 +0900
+++ b/contrib/hgclient.py Sun Jan 18 18:49:59 2015 +0900
@@ -27,10 +27,11 @@
stringio = cStringIO.StringIO
bprint = print
-def connectpipe(path=None):
+def connectpipe(path=None, extraargs=()):
cmdline = [b'hg', b'serve', b'--cmdserver', b'pipe']
if path:
cmdline += [b'-R', path]
+ cmdline.extend(extraargs)
server = subprocess.Popen(cmdline, stdin=subprocess.PIPE,
stdout=subprocess.PIPE)
@@ -114,6 +115,8 @@
writeblock(server, input.read(data))
elif ch == b'L':
writeblock(server, input.readline(data))
+ elif ch == b'm':
+ bprint(b"message: %r" % data)
elif ch == b'r':
ret, = struct.unpack('>i', data)
if ret != 0:
@@ -132,3 +135,8 @@
finally:
server.stdin.close()
server.wait()
+
+def checkwith(connect=connectpipe, **kwargs):
+ def wrap(func):
+ return check(func, lambda: connect(**kwargs))
+ return wrap