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