Show More
@@ -85,6 +85,7 b' def _exthook(ui, repo, name, cmd, args, ' | |||
|
85 | 85 | |
|
86 | 86 | _redirect = False |
|
87 | 87 | def redirect(state): |
|
88 | global _redirect | |
|
88 | 89 | _redirect = state |
|
89 | 90 | |
|
90 | 91 | def hook(ui, repo, name, throw=False, **args): |
@@ -92,8 +93,8 b' def hook(ui, repo, name, throw=False, **' | |||
|
92 | 93 | |
|
93 | 94 | if _redirect: |
|
94 | 95 | # temporarily redirect stdout to stderr |
|
95 | oldstdout = os.dup(sys.stdout.fileno()) | |
|
96 | os.dup2(sys.stderr.fileno(), sys.stdout.fileno()) | |
|
96 | oldstdout = os.dup(sys.__stdout__.fileno()) | |
|
97 | os.dup2(sys.__stderr__.fileno(), sys.__stdout__.fileno()) | |
|
97 | 98 | |
|
98 | 99 | hooks = [(hname, cmd) for hname, cmd in ui.configitems("hooks") |
|
99 | 100 | if hname.split(".", 1)[0] == name and cmd] |
@@ -106,8 +107,9 b' def hook(ui, repo, name, throw=False, **' | |||
|
106 | 107 | args, throw) or r |
|
107 | 108 | else: |
|
108 | 109 | r = _exthook(ui, repo, hname, cmd, args, throw) or r |
|
109 | return r | |
|
110 | 110 | |
|
111 | 111 | if _redirect: |
|
112 | os.dup2(oldstdout, sys.stdout.fileno()) | |
|
112 | os.dup2(oldstdout, sys.__stdout__.fileno()) | |
|
113 | 113 | os.close(oldstdout) |
|
114 | ||
|
115 | return r |
@@ -29,7 +29,7 b' EOF' | |||
|
29 | 29 | |
|
30 | 30 | cat <<EOF > badhook |
|
31 | 31 | import sys |
|
32 | sys.stdout.write("KABOOM") | |
|
32 | sys.stdout.write("KABOOM\n") | |
|
33 | 33 | EOF |
|
34 | 34 | |
|
35 | 35 | echo "# creating 'remote'" |
@@ -78,8 +78,7 b' remote: adding changesets' | |||
|
78 | 78 | remote: adding manifests |
|
79 | 79 | remote: adding file changes |
|
80 | 80 | remote: added 1 changesets with 1 changes to 1 files |
|
81 | abort: unexpected response: | |
|
82 | 'KABOOM1\n' | |
|
81 | remote: KABOOM | |
|
83 | 82 | changeset: 3:ac7448082955 |
|
84 | 83 | tag: tip |
|
85 | 84 | parent: 1:572896fe480d |
General Comments 0
You need to be logged in to leave comments.
Login now