comparison tests/test-commandserver.py @ 19132:605deb776abf

tests: fix test-commandserver phase . output for windows
author Brendan Cully <brendan@kublai.com>
date Fri, 03 May 2013 13:59:58 -0700
parents 1c8e0d6ac3b0
children c57e99386d88
comparison
equal deleted inserted replaced
19130:70f0d1da36b0 19132:605deb776abf
23 if channel in 'IL': 23 if channel in 'IL':
24 return channel, length 24 return channel, length
25 else: 25 else:
26 return channel, server.stdout.read(length) 26 return channel, server.stdout.read(length)
27 27
28 def runcommand(server, args, output=sys.stdout, error=sys.stderr, input=None): 28 def sep(text):
29 return text.replace('\\', '/')
30
31 def runcommand(server, args, output=sys.stdout, error=sys.stderr, input=None,
32 outfilter=lambda x: x):
29 print ' runcommand', ' '.join(args) 33 print ' runcommand', ' '.join(args)
30 sys.stdout.flush() 34 sys.stdout.flush()
31 server.stdin.write('runcommand\n') 35 server.stdin.write('runcommand\n')
32 writeblock(server, '\0'.join(args)) 36 writeblock(server, '\0'.join(args))
33 37
35 input = cStringIO.StringIO() 39 input = cStringIO.StringIO()
36 40
37 while True: 41 while True:
38 ch, data = readchannel(server) 42 ch, data = readchannel(server)
39 if ch == 'o': 43 if ch == 'o':
40 output.write(data) 44 output.write(outfilter(data))
41 output.flush() 45 output.flush()
42 elif ch == 'e': 46 elif ch == 'e':
43 error.write(data) 47 error.write(data)
44 error.flush() 48 error.flush()
45 elif ch == 'I': 49 elif ch == 'I':
247 runcommand(server, ['commit', '-Am.', 'a']) 251 runcommand(server, ['commit', '-Am.', 'a'])
248 runcommand(server, ['log', '-Gq']) 252 runcommand(server, ['log', '-Gq'])
249 253
250 # make it public; draft marker moves to 4:7966c8e3734d 254 # make it public; draft marker moves to 4:7966c8e3734d
251 runcommand(server, ['phase', '-p', '.']) 255 runcommand(server, ['phase', '-p', '.'])
252 runcommand(server, ['phase', '.']) # load _phasecache.phaseroots 256 # load _phasecache.phaseroots
257 runcommand(server, ['phase', '.'], outfilter=sep)
253 258
254 # strip 1::4 outside server 259 # strip 1::4 outside server
255 os.system('hg --config extensions.mq= strip 1') 260 os.system('hg --config extensions.mq= strip 1')
256 261
257 # shouldn't raise "7966c8e3734d: no node!" 262 # shouldn't raise "7966c8e3734d: no node!"