Show More
@@ -20,10 +20,10 b' typical client does not want echo-back m' | |||
|
20 | 20 | >>> @check |
|
21 | 21 | ... def hellomessage(server): |
|
22 | 22 | ... ch, data = readchannel(server) |
|
23 | ... print('%c, %r' % (ch, data)) | |
|
23 | ... print(b'%c, %r' % (ch, data)) | |
|
24 | 24 | ... # run an arbitrary command to make sure the next thing the server |
|
25 | 25 | ... # sends isn't part of the hello message |
|
26 | ... runcommand(server, ['id']) | |
|
26 | ... runcommand(server, [b'id']) | |
|
27 | 27 | o, 'capabilities: getencoding runcommand\nencoding: *\npid: *' (glob) |
|
28 | 28 | *** runcommand id |
|
29 | 29 | 000000000000 tip |
@@ -31,7 +31,7 b' typical client does not want echo-back m' | |||
|
31 | 31 | >>> from hgclient import check |
|
32 | 32 | >>> @check |
|
33 | 33 | ... def unknowncommand(server): |
|
34 | ... server.stdin.write('unknowncommand\n') | |
|
34 | ... server.stdin.write(b'unknowncommand\n') | |
|
35 | 35 | abort: unknown command unknowncommand |
|
36 | 36 | |
|
37 | 37 | >>> from hgclient import check, readchannel, runcommand |
@@ -44,19 +44,19 b' typical client does not want echo-back m' | |||
|
44 | 44 | ... runcommand(server, []) |
|
45 | 45 | ... |
|
46 | 46 | ... # global options |
|
47 | ... runcommand(server, ['id', '--quiet']) | |
|
47 | ... runcommand(server, [b'id', b'--quiet']) | |
|
48 | 48 | ... |
|
49 | 49 | ... # make sure global options don't stick through requests |
|
50 | ... runcommand(server, ['id']) | |
|
50 | ... runcommand(server, [b'id']) | |
|
51 | 51 | ... |
|
52 | 52 | ... # --config |
|
53 | ... runcommand(server, ['id', '--config', 'ui.quiet=True']) | |
|
53 | ... runcommand(server, [b'id', b'--config', b'ui.quiet=True']) | |
|
54 | 54 | ... |
|
55 | 55 | ... # make sure --config doesn't stick |
|
56 | ... runcommand(server, ['id']) | |
|
56 | ... runcommand(server, [b'id']) | |
|
57 | 57 | ... |
|
58 | 58 | ... # negative return code should be masked |
|
59 | ... runcommand(server, ['id', '-runknown']) | |
|
59 | ... runcommand(server, [b'id', b'-runknown']) | |
|
60 | 60 | *** runcommand |
|
61 | 61 | Mercurial Distributed SCM |
|
62 | 62 | |
@@ -97,12 +97,12 b' typical client does not want echo-back m' | |||
|
97 | 97 | >>> @check |
|
98 | 98 | ... def inputeof(server): |
|
99 | 99 | ... readchannel(server) |
|
100 | ... server.stdin.write('runcommand\n') | |
|
100 | ... server.stdin.write(b'runcommand\n') | |
|
101 | 101 | ... # close stdin while server is waiting for input |
|
102 | 102 | ... server.stdin.close() |
|
103 | 103 | ... |
|
104 | 104 | ... # server exits with 1 if the pipe closed while reading the command |
|
105 | ... print('server exit code =', server.wait()) | |
|
105 | ... print(b'server exit code =', server.wait()) | |
|
106 | 106 | server exit code = 1 |
|
107 | 107 | |
|
108 | 108 | >>> from hgclient import check, readchannel, runcommand, stringio |
@@ -110,7 +110,7 b' typical client does not want echo-back m' | |||
|
110 | 110 | ... def serverinput(server): |
|
111 | 111 | ... readchannel(server) |
|
112 | 112 | ... |
|
113 | ... patch = """ | |
|
113 | ... patch = b""" | |
|
114 | 114 | ... # HG changeset patch |
|
115 | 115 | ... # User test |
|
116 | 116 | ... # Date 0 0 |
@@ -125,8 +125,8 b' typical client does not want echo-back m' | |||
|
125 | 125 | ... +1 |
|
126 | 126 | ... """ |
|
127 | 127 | ... |
|
128 | ... runcommand(server, ['import', '-'], input=stringio(patch)) | |
|
129 | ... runcommand(server, ['log']) | |
|
128 | ... runcommand(server, [b'import', b'-'], input=stringio(patch)) | |
|
129 | ... runcommand(server, [b'log']) | |
|
130 | 130 | *** runcommand import - |
|
131 | 131 | applying patch from stdin |
|
132 | 132 | *** runcommand log |
@@ -145,8 +145,8 b' check strict parsing of early options:' | |||
|
145 | 145 | >>> @check |
|
146 | 146 | ... def cwd(server): |
|
147 | 147 | ... readchannel(server) |
|
148 | ... runcommand(server, ['log', '-b', '--config=alias.log=!echo pwned', | |
|
149 | ... 'default']) | |
|
148 | ... runcommand(server, [b'log', b'-b', b'--config=alias.log=!echo pwned', | |
|
149 | ... b'default']) | |
|
150 | 150 | *** runcommand log -b --config=alias.log=!echo pwned default |
|
151 | 151 | abort: unknown revision '--config=alias.log=!echo pwned'! |
|
152 | 152 | [255] |
@@ -158,9 +158,9 b' check that "histedit --commands=-" can r' | |||
|
158 | 158 | >>> @check |
|
159 | 159 | ... def serverinput(server): |
|
160 | 160 | ... readchannel(server) |
|
161 | ... rules = 'pick eff892de26ec\n' | |
|
162 | ... runcommand(server, ['histedit', '0', '--commands=-', | |
|
163 | ... '--config', 'extensions.histedit='], | |
|
161 | ... rules = b'pick eff892de26ec\n' | |
|
162 | ... runcommand(server, [b'histedit', b'0', b'--commands=-', | |
|
163 | ... b'--config', b'extensions.histedit='], | |
|
164 | 164 | ... input=cStringIO.StringIO(rules)) |
|
165 | 165 | *** runcommand histedit 0 --commands=- --config extensions.histedit= |
|
166 | 166 | |
@@ -172,8 +172,8 b" check that --cwd doesn't persist between" | |||
|
172 | 172 | >>> @check |
|
173 | 173 | ... def cwd(server): |
|
174 | 174 | ... readchannel(server) |
|
175 | ... runcommand(server, ['--cwd', 'foo', 'st', 'bar']) | |
|
176 | ... runcommand(server, ['st', 'foo/bar']) | |
|
175 | ... runcommand(server, [b'--cwd', b'foo', b'st', b'bar']) | |
|
176 | ... runcommand(server, [b'st', b'foo/bar']) | |
|
177 | 177 | *** runcommand --cwd foo st bar |
|
178 | 178 | ? bar |
|
179 | 179 | *** runcommand st foo/bar |
@@ -198,11 +198,11 b' check that local configs for the cached ' | |||
|
198 | 198 | ... |
|
199 | 199 | ... # the cached repo local hgrc contains ui.foo=bar, so showconfig should |
|
200 | 200 | ... # show it |
|
201 | ... runcommand(server, ['showconfig'], outfilter=sep) | |
|
201 | ... runcommand(server, [b'showconfig'], outfilter=sep) | |
|
202 | 202 | ... |
|
203 | 203 | ... # but not for this repo |
|
204 | ... runcommand(server, ['init', 'foo']) | |
|
205 | ... runcommand(server, ['-R', 'foo', 'showconfig', 'ui', 'defaults']) | |
|
204 | ... runcommand(server, [b'init', b'foo']) | |
|
205 | ... runcommand(server, [b'-R', b'foo', b'showconfig', b'ui', b'defaults']) | |
|
206 | 206 | *** runcommand showconfig |
|
207 | 207 | bundle.mainreporoot=$TESTTMP/repo |
|
208 | 208 | devel.all-warnings=true |
@@ -238,18 +238,18 b' check that local configs for the cached ' | |||
|
238 | 238 | > from __future__ import print_function |
|
239 | 239 | > import sys |
|
240 | 240 | > def hook(**args): |
|
241 | > print('hook talking') | |
|
242 | > print('now try to read something: %r' % sys.stdin.read()) | |
|
241 | > print(b'hook talking') | |
|
242 | > print(b'now try to read something: %r' % sys.stdin.read()) | |
|
243 | 243 | > EOF |
|
244 | 244 | |
|
245 | 245 | >>> from hgclient import check, readchannel, runcommand, stringio |
|
246 | 246 | >>> @check |
|
247 | 247 | ... def hookoutput(server): |
|
248 | 248 | ... readchannel(server) |
|
249 | ... runcommand(server, ['--config', | |
|
250 | ... 'hooks.pre-identify=python:hook.hook', | |
|
251 | ... 'id'], | |
|
252 | ... input=stringio('some input')) | |
|
249 | ... runcommand(server, [b'--config', | |
|
250 | ... b'hooks.pre-identify=python:hook.hook', | |
|
251 | ... b'id'], | |
|
252 | ... input=stringio(b'some input')) | |
|
253 | 253 | *** runcommand --config hooks.pre-identify=python:hook.hook id |
|
254 | 254 | eff892de26ec tip |
|
255 | 255 | hook talking |
@@ -265,10 +265,10 b' Clean hook cached version' | |||
|
265 | 265 | >>> @check |
|
266 | 266 | ... def outsidechanges(server): |
|
267 | 267 | ... readchannel(server) |
|
268 | ... runcommand(server, ['status']) | |
|
268 | ... runcommand(server, [b'status']) | |
|
269 | 269 | ... os.system('hg ci -Am2') |
|
270 | ... runcommand(server, ['tip']) | |
|
271 | ... runcommand(server, ['status']) | |
|
270 | ... runcommand(server, [b'tip']) | |
|
271 | ... runcommand(server, [b'status']) | |
|
272 | 272 | *** runcommand status |
|
273 | 273 | M a |
|
274 | 274 | *** runcommand tip |
@@ -285,24 +285,24 b' Clean hook cached version' | |||
|
285 | 285 | >>> @check |
|
286 | 286 | ... def bookmarks(server): |
|
287 | 287 | ... readchannel(server) |
|
288 | ... runcommand(server, ['bookmarks']) | |
|
288 | ... runcommand(server, [b'bookmarks']) | |
|
289 | 289 | ... |
|
290 | 290 | ... # changes .hg/bookmarks |
|
291 | 291 | ... os.system('hg bookmark -i bm1') |
|
292 | 292 | ... os.system('hg bookmark -i bm2') |
|
293 | ... runcommand(server, ['bookmarks']) | |
|
293 | ... runcommand(server, [b'bookmarks']) | |
|
294 | 294 | ... |
|
295 | 295 | ... # changes .hg/bookmarks.current |
|
296 | 296 | ... os.system('hg upd bm1 -q') |
|
297 | ... runcommand(server, ['bookmarks']) | |
|
297 | ... runcommand(server, [b'bookmarks']) | |
|
298 | 298 | ... |
|
299 | ... runcommand(server, ['bookmarks', 'bm3']) | |
|
299 | ... runcommand(server, [b'bookmarks', b'bm3']) | |
|
300 | 300 | ... f = open('a', 'ab') |
|
301 | ... f.write('a\n') and None | |
|
301 | ... f.write(b'a\n') and None | |
|
302 | 302 | ... f.close() |
|
303 | ... runcommand(server, ['commit', '-Amm']) | |
|
304 | ... runcommand(server, ['bookmarks']) | |
|
305 | ... print('') | |
|
303 | ... runcommand(server, [b'commit', b'-Amm']) | |
|
304 | ... runcommand(server, [b'bookmarks']) | |
|
305 | ... print(b'') | |
|
306 | 306 | *** runcommand bookmarks |
|
307 | 307 | no bookmarks set |
|
308 | 308 | *** runcommand bookmarks |
@@ -324,9 +324,9 b' Clean hook cached version' | |||
|
324 | 324 | >>> @check |
|
325 | 325 | ... def tagscache(server): |
|
326 | 326 | ... readchannel(server) |
|
327 | ... runcommand(server, ['id', '-t', '-r', '0']) | |
|
327 | ... runcommand(server, [b'id', b'-t', b'-r', b'0']) | |
|
328 | 328 | ... os.system('hg tag -r 0 foo') |
|
329 | ... runcommand(server, ['id', '-t', '-r', '0']) | |
|
329 | ... runcommand(server, [b'id', b'-t', b'-r', b'0']) | |
|
330 | 330 | *** runcommand id -t -r 0 |
|
331 | 331 | |
|
332 | 332 | *** runcommand id -t -r 0 |
@@ -337,9 +337,9 b' Clean hook cached version' | |||
|
337 | 337 | >>> @check |
|
338 | 338 | ... def setphase(server): |
|
339 | 339 | ... readchannel(server) |
|
340 | ... runcommand(server, ['phase', '-r', '.']) | |
|
340 | ... runcommand(server, [b'phase', b'-r', b'.']) | |
|
341 | 341 | ... os.system('hg phase -r . -p') |
|
342 | ... runcommand(server, ['phase', '-r', '.']) | |
|
342 | ... runcommand(server, [b'phase', b'-r', b'.']) | |
|
343 | 343 | *** runcommand phase -r . |
|
344 | 344 | 3: draft |
|
345 | 345 | *** runcommand phase -r . |
@@ -350,11 +350,11 b' Clean hook cached version' | |||
|
350 | 350 | >>> @check |
|
351 | 351 | ... def rollback(server): |
|
352 | 352 | ... readchannel(server) |
|
353 | ... runcommand(server, ['phase', '-r', '.', '-p']) | |
|
354 | ... runcommand(server, ['commit', '-Am.']) | |
|
355 | ... runcommand(server, ['rollback']) | |
|
356 | ... runcommand(server, ['phase', '-r', '.']) | |
|
357 | ... print('') | |
|
353 | ... runcommand(server, [b'phase', b'-r', b'.', b'-p']) | |
|
354 | ... runcommand(server, [b'commit', b'-Am.']) | |
|
355 | ... runcommand(server, [b'rollback']) | |
|
356 | ... runcommand(server, [b'phase', b'-r', b'.']) | |
|
357 | ... print(b'') | |
|
358 | 358 | *** runcommand phase -r . -p |
|
359 | 359 | no phases changed |
|
360 | 360 | *** runcommand commit -Am. |
@@ -370,9 +370,9 b' Clean hook cached version' | |||
|
370 | 370 | >>> @check |
|
371 | 371 | ... def branch(server): |
|
372 | 372 | ... readchannel(server) |
|
373 | ... runcommand(server, ['branch']) | |
|
373 | ... runcommand(server, [b'branch']) | |
|
374 | 374 | ... os.system('hg branch foo') |
|
375 | ... runcommand(server, ['branch']) | |
|
375 | ... runcommand(server, [b'branch']) | |
|
376 | 376 | ... os.system('hg branch default') |
|
377 | 377 | *** runcommand branch |
|
378 | 378 | default |
@@ -389,15 +389,15 b' Clean hook cached version' | |||
|
389 | 389 | >>> @check |
|
390 | 390 | ... def hgignore(server): |
|
391 | 391 | ... readchannel(server) |
|
392 | ... runcommand(server, ['commit', '-Am.']) | |
|
392 | ... runcommand(server, [b'commit', b'-Am.']) | |
|
393 | 393 | ... f = open('ignored-file', 'ab') |
|
394 | ... f.write('') and None | |
|
394 | ... f.write(b'') and None | |
|
395 | 395 | ... f.close() |
|
396 | 396 | ... f = open('.hgignore', 'ab') |
|
397 | ... f.write('ignored-file') | |
|
397 | ... f.write(b'ignored-file') | |
|
398 | 398 | ... f.close() |
|
399 | ... runcommand(server, ['status', '-i', '-u']) | |
|
400 | ... print('') | |
|
399 | ... runcommand(server, [b'status', b'-i', b'-u']) | |
|
400 | ... print(b'') | |
|
401 | 401 | *** runcommand commit -Am. |
|
402 | 402 | adding .hgignore |
|
403 | 403 | *** runcommand status -i -u |
@@ -413,17 +413,17 b' cache of non-public revisions should be ' | |||
|
413 | 413 | ... def phasesetscacheaftercommit(server): |
|
414 | 414 | ... readchannel(server) |
|
415 | 415 | ... # load _phasecache._phaserevs and _phasesets |
|
416 | ... runcommand(server, ['log', '-qr', 'draft()']) | |
|
416 | ... runcommand(server, [b'log', b'-qr', b'draft()']) | |
|
417 | 417 | ... # create draft commits by another process |
|
418 | 418 | ... for i in range(5, 7): |
|
419 | 419 | ... f = open('a', 'ab') |
|
420 | 420 | ... f.seek(0, os.SEEK_END) |
|
421 | ... f.write('a\n') and None | |
|
421 | ... f.write(b'a\n') and None | |
|
422 | 422 | ... f.close() |
|
423 | 423 | ... os.system('hg commit -Aqm%d' % i) |
|
424 | 424 | ... # new commits should be listed as draft revisions |
|
425 | ... runcommand(server, ['log', '-qr', 'draft()']) | |
|
426 | ... print('') | |
|
425 | ... runcommand(server, [b'log', b'-qr', b'draft()']) | |
|
426 | ... print(b'') | |
|
427 | 427 | *** runcommand log -qr draft() |
|
428 | 428 | 4:7966c8e3734d |
|
429 | 429 | *** runcommand log -qr draft() |
@@ -438,12 +438,12 b' cache of non-public revisions should be ' | |||
|
438 | 438 | ... def phasesetscacheafterstrip(server): |
|
439 | 439 | ... readchannel(server) |
|
440 | 440 | ... # load _phasecache._phaserevs and _phasesets |
|
441 | ... runcommand(server, ['log', '-qr', 'draft()']) | |
|
441 | ... runcommand(server, [b'log', b'-qr', b'draft()']) | |
|
442 | 442 | ... # strip cached revisions by another process |
|
443 | 443 | ... os.system('hg --config extensions.strip= strip -q 5') |
|
444 | 444 | ... # shouldn't abort by "unknown revision '6'" |
|
445 | ... runcommand(server, ['log', '-qr', 'draft()']) | |
|
446 | ... print('') | |
|
445 | ... runcommand(server, [b'log', b'-qr', b'draft()']) | |
|
446 | ... print(b'') | |
|
447 | 447 | *** runcommand log -qr draft() |
|
448 | 448 | 4:7966c8e3734d |
|
449 | 449 | 5:41f6602d1c4f |
@@ -461,23 +461,23 b' cache of phase roots should be invalidat' | |||
|
461 | 461 | ... readchannel(server) |
|
462 | 462 | ... |
|
463 | 463 | ... # create new head, 5:731265503d86 |
|
464 | ... runcommand(server, ['update', '-C', '0']) | |
|
464 | ... runcommand(server, [b'update', b'-C', b'0']) | |
|
465 | 465 | ... f = open('a', 'ab') |
|
466 | ... f.write('a\n') and None | |
|
466 | ... f.write(b'a\n') and None | |
|
467 | 467 | ... f.close() |
|
468 | ... runcommand(server, ['commit', '-Am.', 'a']) | |
|
469 | ... runcommand(server, ['log', '-Gq']) | |
|
468 | ... runcommand(server, [b'commit', b'-Am.', b'a']) | |
|
469 | ... runcommand(server, [b'log', b'-Gq']) | |
|
470 | 470 | ... |
|
471 | 471 | ... # make it public; draft marker moves to 4:7966c8e3734d |
|
472 | ... runcommand(server, ['phase', '-p', '.']) | |
|
472 | ... runcommand(server, [b'phase', b'-p', b'.']) | |
|
473 | 473 | ... # load _phasecache.phaseroots |
|
474 |
... runcommand(server, ['phase', '.'], outfilter=sep |
|
|
474 | ... runcommand(server, [b'phase', b'.'], outfilter=sep) | |
|
475 | 475 | ... |
|
476 | 476 | ... # strip 1::4 outside server |
|
477 | 477 | ... os.system('hg -q --config extensions.mq= strip 1') |
|
478 | 478 | ... |
|
479 | 479 | ... # shouldn't raise "7966c8e3734d: no node!" |
|
480 | ... runcommand(server, ['branches']) | |
|
480 | ... runcommand(server, [b'branches']) | |
|
481 | 481 | *** runcommand update -C 0 |
|
482 | 482 | 1 files updated, 0 files merged, 2 files removed, 0 files unresolved |
|
483 | 483 | (leaving bookmark bm3) |
@@ -510,9 +510,9 b' changelog and manifest would have invali' | |||
|
510 | 510 | >>> @check |
|
511 | 511 | ... def txabort(server): |
|
512 | 512 | ... readchannel(server) |
|
513 | ... runcommand(server, ['commit', '--config', 'hooks.pretxncommit=false', | |
|
514 | ... '-mfoo']) | |
|
515 | ... runcommand(server, ['verify']) | |
|
513 | ... runcommand(server, [b'commit', b'--config', b'hooks.pretxncommit=false', | |
|
514 | ... b'-mfoo']) | |
|
515 | ... runcommand(server, [b'verify']) | |
|
516 | 516 | *** runcommand commit --config hooks.pretxncommit=false -mfoo |
|
517 | 517 | transaction abort! |
|
518 | 518 | rollback completed |
@@ -537,14 +537,14 b' changelog and manifest would have invali' | |||
|
537 | 537 | ... def obsolete(server): |
|
538 | 538 | ... readchannel(server) |
|
539 | 539 | ... |
|
540 | ... runcommand(server, ['up', 'null']) | |
|
541 | ... runcommand(server, ['phase', '-df', 'tip']) | |
|
540 | ... runcommand(server, [b'up', b'null']) | |
|
541 | ... runcommand(server, [b'phase', b'-df', b'tip']) | |
|
542 | 542 | ... cmd = 'hg debugobsolete `hg log -r tip --template {node}`' |
|
543 | 543 | ... if os.name == 'nt': |
|
544 | 544 | ... cmd = 'sh -c "%s"' % cmd # run in sh, not cmd.exe |
|
545 | 545 | ... os.system(cmd) |
|
546 | ... runcommand(server, ['log', '--hidden']) | |
|
547 | ... runcommand(server, ['log']) | |
|
546 | ... runcommand(server, [b'log', b'--hidden']) | |
|
547 | ... runcommand(server, [b'log']) | |
|
548 | 548 | *** runcommand up null |
|
549 | 549 | 0 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
550 | 550 | *** runcommand phase -df tip |
@@ -588,15 +588,15 b' changelog and manifest would have invali' | |||
|
588 | 588 | ... readchannel(server) |
|
589 | 589 | ... |
|
590 | 590 | ... # load repo.mq |
|
591 | ... runcommand(server, ['qapplied']) | |
|
591 | ... runcommand(server, [b'qapplied']) | |
|
592 | 592 | ... os.system('hg qnew 0.diff') |
|
593 | 593 | ... # repo.mq should be invalidated |
|
594 | ... runcommand(server, ['qapplied']) | |
|
594 | ... runcommand(server, [b'qapplied']) | |
|
595 | 595 | ... |
|
596 | ... runcommand(server, ['qpop', '--all']) | |
|
596 | ... runcommand(server, [b'qpop', b'--all']) | |
|
597 | 597 | ... os.system('hg qqueue --create foo') |
|
598 | 598 | ... # repo.mq should be recreated to point to new queue |
|
599 | ... runcommand(server, ['qqueue', '--active']) | |
|
599 | ... runcommand(server, [b'qqueue', b'--active']) | |
|
600 | 600 | *** runcommand qapplied |
|
601 | 601 | *** runcommand qapplied |
|
602 | 602 | 0.diff |
@@ -614,16 +614,16 b' changelog and manifest would have invali' | |||
|
614 | 614 | > command = registrar.command(cmdtable) |
|
615 | 615 | > @command(b"debuggetpass", norepo=True) |
|
616 | 616 | > def debuggetpass(ui): |
|
617 | > ui.write("%s\\n" % ui.getpass()) | |
|
617 | > ui.write(b"%s\\n" % ui.getpass()) | |
|
618 | 618 | > @command(b"debugprompt", norepo=True) |
|
619 | 619 | > def debugprompt(ui): |
|
620 | > ui.write("%s\\n" % ui.prompt("prompt:")) | |
|
620 | > ui.write(b"%s\\n" % ui.prompt(b"prompt:")) | |
|
621 | 621 | > @command(b"debugreadstdin", norepo=True) |
|
622 | 622 | > def debugreadstdin(ui): |
|
623 | > ui.write("read: %r\n" % sys.stdin.read(1)) | |
|
623 | > ui.write(b"read: %r\n" % sys.stdin.read(1)) | |
|
624 | 624 | > @command(b"debugwritestdout", norepo=True) |
|
625 | 625 | > def debugwritestdout(ui): |
|
626 | > os.write(1, "low-level stdout fd and\n") | |
|
626 | > os.write(1, b"low-level stdout fd and\n") | |
|
627 | 627 | > sys.stdout.write("stdout should be redirected to stderr\n") |
|
628 | 628 | > sys.stdout.flush() |
|
629 | 629 | > EOF |
@@ -636,20 +636,20 b' changelog and manifest would have invali' | |||
|
636 | 636 | >>> @check |
|
637 | 637 | ... def getpass(server): |
|
638 | 638 | ... readchannel(server) |
|
639 | ... runcommand(server, ['debuggetpass', '--config', | |
|
640 | ... 'ui.interactive=True'], | |
|
641 | ... input=stringio('1234\n')) | |
|
642 | ... runcommand(server, ['debuggetpass', '--config', | |
|
643 | ... 'ui.interactive=True'], | |
|
644 | ... input=stringio('\n')) | |
|
645 | ... runcommand(server, ['debuggetpass', '--config', | |
|
646 | ... 'ui.interactive=True'], | |
|
647 | ... input=stringio('')) | |
|
648 | ... runcommand(server, ['debugprompt', '--config', | |
|
649 | ... 'ui.interactive=True'], | |
|
650 | ... input=stringio('5678\n')) | |
|
651 | ... runcommand(server, ['debugreadstdin']) | |
|
652 | ... runcommand(server, ['debugwritestdout']) | |
|
639 | ... runcommand(server, [b'debuggetpass', b'--config', | |
|
640 | ... b'ui.interactive=True'], | |
|
641 | ... input=stringio(b'1234\n')) | |
|
642 | ... runcommand(server, [b'debuggetpass', b'--config', | |
|
643 | ... b'ui.interactive=True'], | |
|
644 | ... input=stringio(b'\n')) | |
|
645 | ... runcommand(server, [b'debuggetpass', b'--config', | |
|
646 | ... b'ui.interactive=True'], | |
|
647 | ... input=stringio(b'')) | |
|
648 | ... runcommand(server, [b'debugprompt', b'--config', | |
|
649 | ... b'ui.interactive=True'], | |
|
650 | ... input=stringio(b'5678\n')) | |
|
651 | ... runcommand(server, [b'debugreadstdin']) | |
|
652 | ... runcommand(server, [b'debugwritestdout']) | |
|
653 | 653 | *** runcommand debuggetpass --config ui.interactive=True |
|
654 | 654 | password: 1234 |
|
655 | 655 | *** runcommand debuggetpass --config ui.interactive=True |
@@ -672,15 +672,15 b' run commandserver in commandserver, whic' | |||
|
672 | 672 | >>> from hgclient import check, readchannel, runcommand, stringio |
|
673 | 673 | >>> @check |
|
674 | 674 | ... def nested(server): |
|
675 | ... print('%c, %r' % readchannel(server)) | |
|
675 | ... print(b'%c, %r' % readchannel(server)) | |
|
676 | 676 | ... class nestedserver(object): |
|
677 | ... stdin = stringio('getencoding\n') | |
|
677 | ... stdin = stringio(b'getencoding\n') | |
|
678 | 678 | ... stdout = stringio() |
|
679 | ... runcommand(server, ['serve', '--cmdserver', 'pipe'], | |
|
679 | ... runcommand(server, [b'serve', b'--cmdserver', b'pipe'], | |
|
680 | 680 | ... output=nestedserver.stdout, input=nestedserver.stdin) |
|
681 | 681 | ... nestedserver.stdout.seek(0) |
|
682 | ... print('%c, %r' % readchannel(nestedserver)) # hello | |
|
683 | ... print('%c, %r' % readchannel(nestedserver)) # getencoding | |
|
682 | ... print(b'%c, %r' % readchannel(nestedserver)) # hello | |
|
683 | ... print(b'%c, %r' % readchannel(nestedserver)) # getencoding | |
|
684 | 684 | o, 'capabilities: getencoding runcommand\nencoding: *\npid: *' (glob) |
|
685 | 685 | *** runcommand serve --cmdserver pipe |
|
686 | 686 | o, 'capabilities: getencoding runcommand\nencoding: *\npid: *' (glob) |
@@ -696,10 +696,10 b' start without repository:' | |||
|
696 | 696 | >>> @check |
|
697 | 697 | ... def hellomessage(server): |
|
698 | 698 | ... ch, data = readchannel(server) |
|
699 | ... print('%c, %r' % (ch, data)) | |
|
699 | ... print(b'%c, %r' % (ch, data)) | |
|
700 | 700 | ... # run an arbitrary command to make sure the next thing the server |
|
701 | 701 | ... # sends isn't part of the hello message |
|
702 | ... runcommand(server, ['id']) | |
|
702 | ... runcommand(server, [b'id']) | |
|
703 | 703 | o, 'capabilities: getencoding runcommand\nencoding: *\npid: *' (glob) |
|
704 | 704 | *** runcommand id |
|
705 | 705 | abort: there is no Mercurial repository here (.hg not found) |
@@ -709,8 +709,8 b' start without repository:' | |||
|
709 | 709 | >>> @check |
|
710 | 710 | ... def startwithoutrepo(server): |
|
711 | 711 | ... readchannel(server) |
|
712 | ... runcommand(server, ['init', 'repo2']) | |
|
713 | ... runcommand(server, ['id', '-R', 'repo2']) | |
|
712 | ... runcommand(server, [b'init', b'repo2']) | |
|
713 | ... runcommand(server, [b'id', b'-R', b'repo2']) | |
|
714 | 714 | *** runcommand init repo2 |
|
715 | 715 | *** runcommand id -R repo2 |
|
716 | 716 | 000000000000 tip |
@@ -734,22 +734,22 b' unix domain socket:' | |||
|
734 | 734 | |
|
735 | 735 | >>> from __future__ import print_function |
|
736 | 736 | >>> from hgclient import check, readchannel, runcommand, stringio, unixserver |
|
737 | >>> server = unixserver('.hg/server.sock', '.hg/server.log') | |
|
737 | >>> server = unixserver(b'.hg/server.sock', b'.hg/server.log') | |
|
738 | 738 | >>> def hellomessage(conn): |
|
739 | 739 | ... ch, data = readchannel(conn) |
|
740 | ... print('%c, %r' % (ch, data)) | |
|
741 | ... runcommand(conn, ['id']) | |
|
740 | ... print(b'%c, %r' % (ch, data)) | |
|
741 | ... runcommand(conn, [b'id']) | |
|
742 | 742 | >>> check(hellomessage, server.connect) |
|
743 | 743 | o, 'capabilities: getencoding runcommand\nencoding: *\npid: *' (glob) |
|
744 | 744 | *** runcommand id |
|
745 | 745 | eff892de26ec tip bm1/bm2/bm3 |
|
746 | 746 | >>> def unknowncommand(conn): |
|
747 | 747 | ... readchannel(conn) |
|
748 | ... conn.stdin.write('unknowncommand\n') | |
|
748 | ... conn.stdin.write(b'unknowncommand\n') | |
|
749 | 749 | >>> check(unknowncommand, server.connect) # error sent to server.log |
|
750 | 750 | >>> def serverinput(conn): |
|
751 | 751 | ... readchannel(conn) |
|
752 | ... patch = """ | |
|
752 | ... patch = b""" | |
|
753 | 753 | ... # HG changeset patch |
|
754 | 754 | ... # User test |
|
755 | 755 | ... # Date 0 0 |
@@ -762,8 +762,8 b' unix domain socket:' | |||
|
762 | 762 | ... 1 |
|
763 | 763 | ... +2 |
|
764 | 764 | ... """ |
|
765 | ... runcommand(conn, ['import', '-'], input=stringio(patch)) | |
|
766 | ... runcommand(conn, ['log', '-rtip', '-q']) | |
|
765 | ... runcommand(conn, [b'import', b'-'], input=stringio(patch)) | |
|
766 | ... runcommand(conn, [b'log', b'-rtip', b'-q']) | |
|
767 | 767 | >>> check(serverinput, server.connect) |
|
768 | 768 | *** runcommand import - |
|
769 | 769 | applying patch from stdin |
@@ -786,13 +786,13 b' unix domain socket:' | |||
|
786 | 786 | > EOF |
|
787 | 787 | >>> from __future__ import print_function |
|
788 | 788 | >>> from hgclient import check, readchannel, unixserver |
|
789 | >>> server = unixserver('.hg/server.sock', '.hg/server.log') | |
|
789 | >>> server = unixserver(b'.hg/server.sock', b'.hg/server.log') | |
|
790 | 790 | >>> def earlycrash(conn): |
|
791 | 791 | ... while True: |
|
792 | 792 | ... try: |
|
793 | 793 | ... ch, data = readchannel(conn) |
|
794 | ... if not data.startswith(' '): | |
|
795 | ... print('%c, %r' % (ch, data)) | |
|
794 | ... if not data.startswith(b' '): | |
|
795 | ... print(b'%c, %r' % (ch, data)) | |
|
796 | 796 | ... except EOFError: |
|
797 | 797 | ... break |
|
798 | 798 | >>> check(earlycrash, server.connect) |
@@ -835,19 +835,19 b' cases.' | |||
|
835 | 835 | > command = registrar.command(cmdtable) |
|
836 | 836 | > configtable = {} |
|
837 | 837 | > configitem = registrar.configitem(configtable) |
|
838 | > configitem('failafterfinalize', 'fail', | |
|
838 | > configitem(b'failafterfinalize', b'fail', | |
|
839 | 839 | > default=None, |
|
840 | 840 | > ) |
|
841 | 841 | > def fail(tr): |
|
842 | > raise error.Abort('fail after finalization') | |
|
842 | > raise error.Abort(b'fail after finalization') | |
|
843 | 843 | > def reposetup(ui, repo): |
|
844 | 844 | > class failrepo(repo.__class__): |
|
845 | 845 | > def commitctx(self, ctx, error=False): |
|
846 | > if self.ui.configbool('failafterfinalize', 'fail'): | |
|
846 | > if self.ui.configbool(b'failafterfinalize', b'fail'): | |
|
847 | 847 | > # 'sorted()' by ASCII code on category names causes |
|
848 | 848 | > # invoking 'fail' after finalization of changelog |
|
849 | 849 | > # using "'cl-%i' % id(self)" as category name |
|
850 | > self.currenttransaction().addfinalize('zzzzzzzz', fail) | |
|
850 | > self.currenttransaction().addfinalize(b'zzzzzzzz', fail) | |
|
851 | 851 | > return super(failrepo, self).commitctx(ctx, error) |
|
852 | 852 | > repo.__class__ = failrepo |
|
853 | 853 | > EOF |
@@ -874,11 +874,11 b' cases.' | |||
|
874 | 874 | >>> @check |
|
875 | 875 | ... def abort(server): |
|
876 | 876 | ... readchannel(server) |
|
877 | ... runcommand(server, ['commit', | |
|
878 | ... '--config', 'hooks.pretxncommit=false', | |
|
879 | ... '-mfoo']) | |
|
880 | ... runcommand(server, ['log']) | |
|
881 | ... runcommand(server, ['verify', '-q']) | |
|
877 | ... runcommand(server, [b'commit', | |
|
878 | ... b'--config', b'hooks.pretxncommit=false', | |
|
879 | ... b'-mfoo']) | |
|
880 | ... runcommand(server, [b'log']) | |
|
881 | ... runcommand(server, [b'verify', b'-q']) | |
|
882 | 882 | *** runcommand commit --config hooks.pretxncommit=false -mfoo |
|
883 | 883 | transaction abort! |
|
884 | 884 | rollback completed |
@@ -893,11 +893,11 b' cases.' | |||
|
893 | 893 | >>> @check |
|
894 | 894 | ... def abort(server): |
|
895 | 895 | ... readchannel(server) |
|
896 | ... runcommand(server, ['commit', | |
|
897 | ... '--config', 'failafterfinalize.fail=true', | |
|
898 | ... '-mfoo']) | |
|
899 | ... runcommand(server, ['log']) | |
|
900 | ... runcommand(server, ['verify', '-q']) | |
|
896 | ... runcommand(server, [b'commit', | |
|
897 | ... b'--config', b'failafterfinalize.fail=true', | |
|
898 | ... b'-mfoo']) | |
|
899 | ... runcommand(server, [b'log']) | |
|
900 | ... runcommand(server, [b'verify', b'-q']) | |
|
901 | 901 | *** runcommand commit --config failafterfinalize.fail=true -mfoo |
|
902 | 902 | transaction abort! |
|
903 | 903 | rollback completed |
@@ -918,11 +918,11 b' cases.' | |||
|
918 | 918 | >>> @check |
|
919 | 919 | ... def abort(server): |
|
920 | 920 | ... readchannel(server) |
|
921 | ... runcommand(server, ['commit', | |
|
922 | ... '--config', 'hooks.pretxncommit=false', | |
|
923 | ... '-mfoo', 'foo']) | |
|
924 | ... runcommand(server, ['log']) | |
|
925 | ... runcommand(server, ['verify', '-q']) | |
|
921 | ... runcommand(server, [b'commit', | |
|
922 | ... b'--config', b'hooks.pretxncommit=false', | |
|
923 | ... b'-mfoo', b'foo']) | |
|
924 | ... runcommand(server, [b'log']) | |
|
925 | ... runcommand(server, [b'verify', b'-q']) | |
|
926 | 926 | *** runcommand commit --config hooks.pretxncommit=false -mfoo foo |
|
927 | 927 | transaction abort! |
|
928 | 928 | rollback completed |
@@ -938,11 +938,11 b' cases.' | |||
|
938 | 938 | >>> @check |
|
939 | 939 | ... def abort(server): |
|
940 | 940 | ... readchannel(server) |
|
941 | ... runcommand(server, ['commit', | |
|
942 | ... '--config', 'failafterfinalize.fail=true', | |
|
943 | ... '-mfoo', 'foo']) | |
|
944 | ... runcommand(server, ['log']) | |
|
945 | ... runcommand(server, ['verify', '-q']) | |
|
941 | ... runcommand(server, [b'commit', | |
|
942 | ... b'--config', b'failafterfinalize.fail=true', | |
|
943 | ... b'-mfoo', b'foo']) | |
|
944 | ... runcommand(server, [b'log']) | |
|
945 | ... runcommand(server, [b'verify', b'-q']) | |
|
946 | 946 | *** runcommand commit --config failafterfinalize.fail=true -mfoo foo |
|
947 | 947 | transaction abort! |
|
948 | 948 | rollback completed |
@@ -989,10 +989,10 b' and the merge should fail (issue5628)' | |||
|
989 | 989 | ... def merge(server): |
|
990 | 990 | ... readchannel(server) |
|
991 | 991 | ... # audit a/poisoned as a good path |
|
992 | ... runcommand(server, ['up', '-qC', '2']) | |
|
993 | ... runcommand(server, ['up', '-qC', '1']) | |
|
992 | ... runcommand(server, [b'up', b'-qC', b'2']) | |
|
993 | ... runcommand(server, [b'up', b'-qC', b'1']) | |
|
994 | 994 | ... # here a is a symlink, so a/poisoned is bad |
|
995 | ... runcommand(server, ['merge', '2']) | |
|
995 | ... runcommand(server, [b'merge', b'2']) | |
|
996 | 996 | *** runcommand up -qC 2 |
|
997 | 997 | *** runcommand up -qC 1 |
|
998 | 998 | *** runcommand merge 2 |
@@ -1009,13 +1009,13 b' symlinks:' | |||
|
1009 | 1009 | >>> @check |
|
1010 | 1010 | ... def files(server): |
|
1011 | 1011 | ... readchannel(server) |
|
1012 | ... runcommand(server, ['up', '-qC', '2']) | |
|
1012 | ... runcommand(server, [b'up', b'-qC', b'2']) | |
|
1013 | 1013 | ... # audit a/poisoned as a good path |
|
1014 | ... runcommand(server, ['files', 'a/poisoned']) | |
|
1015 | ... runcommand(server, ['up', '-qC', '0']) | |
|
1016 | ... runcommand(server, ['up', '-qC', '1']) | |
|
1014 | ... runcommand(server, [b'files', b'a/poisoned']) | |
|
1015 | ... runcommand(server, [b'up', b'-qC', b'0']) | |
|
1016 | ... runcommand(server, [b'up', b'-qC', b'1']) | |
|
1017 | 1017 | ... # here 'a' is a symlink, so a/poisoned should be warned |
|
1018 | ... runcommand(server, ['files', 'a/poisoned']) | |
|
1018 | ... runcommand(server, [b'files', b'a/poisoned']) | |
|
1019 | 1019 | *** runcommand up -qC 2 |
|
1020 | 1020 | *** runcommand files a/poisoned |
|
1021 | 1021 | a/poisoned |
General Comments 0
You need to be logged in to leave comments.
Login now