Show More
@@ -98,7 +98,10 b' def _exthook(ui, repo, name, cmd, args, ' | |||||
98 | cwd = repo.root |
|
98 | cwd = repo.root | |
99 | else: |
|
99 | else: | |
100 | cwd = os.getcwd() |
|
100 | cwd = os.getcwd() | |
101 | r = util.system(cmd, environ=env, cwd=cwd) |
|
101 | if 'HG_URL' in env and env['HG_URL'].startswith('remote:http'): | |
|
102 | r = util.system(cmd, environ=env, cwd=cwd, out=ui) | |||
|
103 | else: | |||
|
104 | r = util.system(cmd, environ=env, cwd=cwd) | |||
102 | if r: |
|
105 | if r: | |
103 | desc, r = util.explain_exit(r) |
|
106 | desc, r = util.explain_exit(r) | |
104 | if throw: |
|
107 | if throw: |
@@ -366,13 +366,16 b' def set_hgexecutable(path):' | |||||
366 | global _hgexecutable |
|
366 | global _hgexecutable | |
367 | _hgexecutable = path |
|
367 | _hgexecutable = path | |
368 |
|
368 | |||
369 | def system(cmd, environ={}, cwd=None, onerr=None, errprefix=None): |
|
369 | def system(cmd, environ={}, cwd=None, onerr=None, errprefix=None, out=None): | |
370 | '''enhanced shell command execution. |
|
370 | '''enhanced shell command execution. | |
371 | run with environment maybe modified, maybe in different dir. |
|
371 | run with environment maybe modified, maybe in different dir. | |
372 |
|
372 | |||
373 | if command fails and onerr is None, return status. if ui object, |
|
373 | if command fails and onerr is None, return status. if ui object, | |
374 | print error message and return status, else raise onerr object as |
|
374 | print error message and return status, else raise onerr object as | |
375 |
exception. |
|
375 | exception. | |
|
376 | ||||
|
377 | if out is specified, it is assumed to be a file-like object that has a | |||
|
378 | write() method. stdout and stderr will be redirected to out.''' | |||
376 | def py2shell(val): |
|
379 | def py2shell(val): | |
377 | 'convert python object into string that is useful to shell' |
|
380 | 'convert python object into string that is useful to shell' | |
378 | if val is None or val is False: |
|
381 | if val is None or val is False: | |
@@ -386,8 +389,17 b' def system(cmd, environ={}, cwd=None, on' | |||||
386 | env = dict(os.environ) |
|
389 | env = dict(os.environ) | |
387 | env.update((k, py2shell(v)) for k, v in environ.iteritems()) |
|
390 | env.update((k, py2shell(v)) for k, v in environ.iteritems()) | |
388 | env['HG'] = hgexecutable() |
|
391 | env['HG'] = hgexecutable() | |
389 | rc = subprocess.call(cmd, shell=True, close_fds=closefds, |
|
392 | if out is None: | |
390 | env=env, cwd=cwd) |
|
393 | rc = subprocess.call(cmd, shell=True, close_fds=closefds, | |
|
394 | env=env, cwd=cwd) | |||
|
395 | else: | |||
|
396 | proc = subprocess.Popen(cmd, shell=True, close_fds=closefds, | |||
|
397 | env=env, cwd=cwd, stdout=subprocess.PIPE, | |||
|
398 | stderr=subprocess.STDOUT) | |||
|
399 | for line in proc.stdout: | |||
|
400 | out.write(line) | |||
|
401 | proc.wait() | |||
|
402 | rc = proc.returncode | |||
391 | if sys.platform == 'OpenVMS' and rc & 1: |
|
403 | if sys.platform == 'OpenVMS' and rc & 1: | |
392 | rc = 0 |
|
404 | rc = 0 | |
393 | if rc and onerr: |
|
405 | if rc and onerr: |
@@ -39,11 +39,9 b' req' | |||||
39 | echo % expect success |
|
39 | echo % expect success | |
40 | echo 'allow_push = *' >> .hg/hgrc |
|
40 | echo 'allow_push = *' >> .hg/hgrc | |
41 | echo '[hooks]' >> .hg/hgrc |
|
41 | echo '[hooks]' >> .hg/hgrc | |
42 |
echo 'changegroup = python ../printenv.py changegroup 0 |
|
42 | echo 'changegroup = python ../printenv.py changegroup 0' >> .hg/hgrc | |
43 | req |
|
43 | req | |
44 |
|
44 | |||
45 | cat ../urls |
|
|||
46 |
|
||||
47 | hg rollback |
|
45 | hg rollback | |
48 | echo % expect authorization error: all users denied |
|
46 | echo % expect authorization error: all users denied | |
49 | echo '[web]' > .hg/hgrc |
|
47 | echo '[web]' > .hg/hgrc |
@@ -23,8 +23,8 b' remote: adding changesets' | |||||
23 | remote: adding manifests |
|
23 | remote: adding manifests | |
24 | remote: adding file changes |
|
24 | remote: adding file changes | |
25 | remote: added 1 changesets with 1 changes to 1 files |
|
25 | remote: added 1 changesets with 1 changes to 1 files | |
|
26 | remote: changegroup hook: HG_NODE=ba677d0156c1196c1a699fa53f390dcfc3ce3872 HG_SOURCE=serve HG_URL=remote:http | |||
26 | % serve errors |
|
27 | % serve errors | |
27 | changegroup hook: HG_NODE=ba677d0156c1196c1a699fa53f390dcfc3ce3872 HG_SOURCE=serve HG_URL=remote:http |
|
|||
28 | rolling back to revision 0 (undo serve) |
|
28 | rolling back to revision 0 (undo serve) | |
29 | % expect authorization error: all users denied |
|
29 | % expect authorization error: all users denied | |
30 | abort: authorization failed |
|
30 | abort: authorization failed |
General Comments 0
You need to be logged in to leave comments.
Login now