Show More
@@ -136,6 +136,8 b' class sshpeer(wireproto.wirepeer):' | |||||
136 |
|
136 | |||
137 | sshcmd = self.ui.config("ui", "ssh") |
|
137 | sshcmd = self.ui.config("ui", "ssh") | |
138 | remotecmd = self.ui.config("ui", "remotecmd") |
|
138 | remotecmd = self.ui.config("ui", "remotecmd") | |
|
139 | sshaddenv = dict(self.ui.configitems("sshenv")) | |||
|
140 | sshenv = util.shellenviron(sshaddenv) | |||
139 |
|
141 | |||
140 | args = util.sshargs(sshcmd, self._host, self._user, self._port) |
|
142 | args = util.sshargs(sshcmd, self._host, self._user, self._port) | |
141 |
|
143 | |||
@@ -144,11 +146,11 b' class sshpeer(wireproto.wirepeer):' | |||||
144 | util.shellquote("%s init %s" % |
|
146 | util.shellquote("%s init %s" % | |
145 | (_serverquote(remotecmd), _serverquote(self._path)))) |
|
147 | (_serverquote(remotecmd), _serverquote(self._path)))) | |
146 | ui.debug('running %s\n' % cmd) |
|
148 | ui.debug('running %s\n' % cmd) | |
147 | res = ui.system(cmd, blockedtag='sshpeer') |
|
149 | res = ui.system(cmd, blockedtag='sshpeer', environ=sshenv) | |
148 | if res != 0: |
|
150 | if res != 0: | |
149 | self._abort(error.RepoError(_("could not create remote repo"))) |
|
151 | self._abort(error.RepoError(_("could not create remote repo"))) | |
150 |
|
152 | |||
151 | self._validaterepo(sshcmd, args, remotecmd) |
|
153 | self._validaterepo(sshcmd, args, remotecmd, sshenv) | |
152 |
|
154 | |||
153 | # Begin of _basepeer interface. |
|
155 | # Begin of _basepeer interface. | |
154 |
|
156 | |||
@@ -180,7 +182,7 b' class sshpeer(wireproto.wirepeer):' | |||||
180 |
|
182 | |||
181 | # End of _basewirecommands interface. |
|
183 | # End of _basewirecommands interface. | |
182 |
|
184 | |||
183 | def _validaterepo(self, sshcmd, args, remotecmd): |
|
185 | def _validaterepo(self, sshcmd, args, remotecmd, sshenv=None): | |
184 | # cleanup up previous run |
|
186 | # cleanup up previous run | |
185 | self._cleanup() |
|
187 | self._cleanup() | |
186 |
|
188 | |||
@@ -196,7 +198,7 b' class sshpeer(wireproto.wirepeer):' | |||||
196 | # no buffer allow the use of 'select' |
|
198 | # no buffer allow the use of 'select' | |
197 | # feel free to remove buffering and select usage when we ultimately |
|
199 | # feel free to remove buffering and select usage when we ultimately | |
198 | # move to threading. |
|
200 | # move to threading. | |
199 | sub = util.popen4(cmd, bufsize=0) |
|
201 | sub = util.popen4(cmd, bufsize=0, env=sshenv) | |
200 | self._pipeo, self._pipei, self._pipee, self._subprocess = sub |
|
202 | self._pipeo, self._pipei, self._pipee, self._subprocess = sub | |
201 |
|
203 | |||
202 | self._pipei = util.bufferedinputpipe(self._pipei) |
|
204 | self._pipei = util.bufferedinputpipe(self._pipei) |
@@ -596,3 +596,21 b' abort with configured error hint when th' | |||||
596 | abort: no suitable response from remote hg! |
|
596 | abort: no suitable response from remote hg! | |
597 | (Please see http://company/internalwiki/ssh.html) |
|
597 | (Please see http://company/internalwiki/ssh.html) | |
598 | [255] |
|
598 | [255] | |
|
599 | ||||
|
600 | test that custom environment is passed down to ssh executable | |||
|
601 | $ cat >>dumpenv <<EOF | |||
|
602 | > #! /bin/sh | |||
|
603 | > echo \$VAR >&2 | |||
|
604 | > EOF | |||
|
605 | $ chmod +x dumpenv | |||
|
606 | $ hg pull ssh://something --config ui.ssh="./dumpenv" | |||
|
607 | pulling from ssh://something/ | |||
|
608 | remote: | |||
|
609 | abort: no suitable response from remote hg! | |||
|
610 | [255] | |||
|
611 | $ hg pull ssh://something --config ui.ssh="./dumpenv" --config sshenv.VAR=17 | |||
|
612 | pulling from ssh://something/ | |||
|
613 | remote: 17 | |||
|
614 | abort: no suitable response from remote hg! | |||
|
615 | [255] | |||
|
616 |
General Comments 0
You need to be logged in to leave comments.
Login now