equal
deleted
inserted
replaced
118 raise error.HookAbort(_('%s hook failed') % hname) |
118 raise error.HookAbort(_('%s hook failed') % hname) |
119 ui.warn(_('warning: %s hook failed\n') % hname) |
119 ui.warn(_('warning: %s hook failed\n') % hname) |
120 return r, False |
120 return r, False |
121 |
121 |
122 def _exthook(ui, repo, htype, name, cmd, args, throw): |
122 def _exthook(ui, repo, htype, name, cmd, args, throw): |
123 ui.note(_("running hook %s: %s\n") % (name, cmd)) |
|
124 |
|
125 starttime = util.timer() |
123 starttime = util.timer() |
126 env = {} |
124 env = {} |
127 |
125 |
128 # make in-memory changes visible to external process |
126 # make in-memory changes visible to external process |
129 if repo is not None: |
127 if repo is not None: |
138 if callable(v): |
136 if callable(v): |
139 v = v() |
137 v = v() |
140 if isinstance(v, (dict, list)): |
138 if isinstance(v, (dict, list)): |
141 v = stringutil.pprint(v) |
139 v = stringutil.pprint(v) |
142 env['HG_' + k.upper()] = v |
140 env['HG_' + k.upper()] = v |
|
141 |
|
142 if pycompat.iswindows: |
|
143 environ = procutil.shellenviron(env) |
|
144 cmd = util.platform.shelltocmdexe(cmd, environ) |
|
145 |
|
146 ui.note(_("running hook %s: %s\n") % (name, cmd)) |
143 |
147 |
144 if repo: |
148 if repo: |
145 cwd = repo.root |
149 cwd = repo.root |
146 else: |
150 else: |
147 cwd = pycompat.getcwd() |
151 cwd = pycompat.getcwd() |