D1683: sshpeer: allow for additional environment passing to ssh exe
This revision was automatically updated to reflect the committed changes. Closed by commit rHG47921dafb44b: sshpeer: allow for additional environment passing to ssh exe (authored by ikostia, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D1683?vs=4429=4519 REVISION DETAIL https://phab.mercurial-scm.org/D1683 AFFECTED FILES mercurial/sshpeer.py tests/test-ssh.t CHANGE DETAILS diff --git a/tests/test-ssh.t b/tests/test-ssh.t --- a/tests/test-ssh.t +++ b/tests/test-ssh.t @@ -596,3 +596,21 @@ abort: no suitable response from remote hg! (Please see http://company/internalwiki/ssh.html) [255] + +test that custom environment is passed down to ssh executable + $ cat >>dumpenv < #! /bin/sh + > echo \$VAR >&2 + > EOF + $ chmod +x dumpenv + $ hg pull ssh://something --config ui.ssh="./dumpenv" + pulling from ssh://something/ + remote: + abort: no suitable response from remote hg! + [255] + $ hg pull ssh://something --config ui.ssh="./dumpenv" --config sshenv.VAR=17 + pulling from ssh://something/ + remote: 17 + abort: no suitable response from remote hg! + [255] + diff --git a/mercurial/sshpeer.py b/mercurial/sshpeer.py --- a/mercurial/sshpeer.py +++ b/mercurial/sshpeer.py @@ -136,19 +136,21 @@ sshcmd = self.ui.config("ui", "ssh") remotecmd = self.ui.config("ui", "remotecmd") +sshaddenv = dict(self.ui.configitems("sshenv")) +sshenv = util.shellenviron(sshaddenv) args = util.sshargs(sshcmd, self._host, self._user, self._port) if create: cmd = '%s %s %s' % (sshcmd, args, util.shellquote("%s init %s" % (_serverquote(remotecmd), _serverquote(self._path ui.debug('running %s\n' % cmd) -res = ui.system(cmd, blockedtag='sshpeer') +res = ui.system(cmd, blockedtag='sshpeer', environ=sshenv) if res != 0: self._abort(error.RepoError(_("could not create remote repo"))) -self._validaterepo(sshcmd, args, remotecmd) +self._validaterepo(sshcmd, args, remotecmd, sshenv) # Begin of _basepeer interface. @@ -180,7 +182,7 @@ # End of _basewirecommands interface. -def _validaterepo(self, sshcmd, args, remotecmd): +def _validaterepo(self, sshcmd, args, remotecmd, sshenv=None): # cleanup up previous run self._cleanup() @@ -196,7 +198,7 @@ # no buffer allow the use of 'select' # feel free to remove buffering and select usage when we ultimately # move to threading. -sub = util.popen4(cmd, bufsize=0) +sub = util.popen4(cmd, bufsize=0, env=sshenv) self._pipeo, self._pipei, self._pipee, self._subprocess = sub self._pipei = util.bufferedinputpipe(self._pipei) To: ikostia, #hg-reviewers, mbthomas, durin42 Cc: durin42, mbthomas, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D1683: sshpeer: allow for additional environment passing to ssh exe
ikostia created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY We already have the ability to customize the ssh command line arguments, let's add the ability to customize its environment as well. Example use-case is ssh.exe from Git on Windows. If `HOME` enviroment variable is present and has some non-empty value, ssh.exe will try to access that location for some stuff (for example, it seems for resolving `~` in `.ssh/config`). Git for Windows seems to sometimess set this variable to the value of `/home/username` which probably works under Git Bash, but does not work in a native `cmd.exe` or `powershell`. Whatever the root cause, setting `HOME` to be an empty string heals things. Therefore, some distributors might want to set `sshenv.HOME=` in the configuration (seems less intrusive that forcing everyone to tweak their env). TEST PLAN - rt REPOSITORY rHG Mercurial BRANCH default REVISION DETAIL https://phab.mercurial-scm.org/D1683 AFFECTED FILES mercurial/sshpeer.py tests/test-ssh.t CHANGE DETAILS diff --git a/tests/test-ssh.t b/tests/test-ssh.t --- a/tests/test-ssh.t +++ b/tests/test-ssh.t @@ -596,3 +596,21 @@ abort: no suitable response from remote hg! (Please see http://company/internalwiki/ssh.html) [255] + +test that custom environment is passed down to ssh executable + $ cat >>dumpenv < #! /bin/sh + > echo \$VAR >&2 + > EOF + $ chmod +x dumpenv + $ hg pull ssh://something --config ui.ssh="./dumpenv" + pulling from ssh://something/ + remote: + abort: no suitable response from remote hg! + [255] + $ hg pull ssh://something --config ui.ssh="./dumpenv" --config sshenv.VAR=17 + pulling from ssh://something/ + remote: 17 + abort: no suitable response from remote hg! + [255] + diff --git a/mercurial/sshpeer.py b/mercurial/sshpeer.py --- a/mercurial/sshpeer.py +++ b/mercurial/sshpeer.py @@ -136,19 +136,21 @@ sshcmd = self.ui.config("ui", "ssh") remotecmd = self.ui.config("ui", "remotecmd") +sshaddenv = dict(self.ui.configitems("sshenv")) +sshenv = util.shellenviron(sshaddenv) args = util.sshargs(sshcmd, self._host, self._user, self._port) if create: cmd = '%s %s %s' % (sshcmd, args, util.shellquote("%s init %s" % (_serverquote(remotecmd), _serverquote(self._path ui.debug('running %s\n' % cmd) -res = ui.system(cmd, blockedtag='sshpeer') +res = ui.system(cmd, blockedtag='sshpeer', environ=sshenv) if res != 0: self._abort(error.RepoError(_("could not create remote repo"))) -self._validaterepo(sshcmd, args, remotecmd) +self._validaterepo(sshcmd, args, remotecmd, sshenv) # Begin of _basepeer interface. @@ -180,7 +182,7 @@ # End of _basewirecommands interface. -def _validaterepo(self, sshcmd, args, remotecmd): +def _validaterepo(self, sshcmd, args, remotecmd, sshenv=None): # cleanup up previous run self._cleanup() @@ -196,7 +198,7 @@ # no buffer allow the use of 'select' # feel free to remove buffering and select usage when we ultimately # move to threading. -sub = util.popen4(cmd, bufsize=0) +sub = util.popen4(cmd, bufsize=0, env=sshenv) self._pipeo, self._pipei, self._pipee, self._subprocess = sub self._pipei = util.bufferedinputpipe(self._pipei) To: ikostia, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D1667: tests_: fix test-lfs.t on OSX where find does not have quotes
ikostia abandoned this revision. ikostia added a comment. @quark: thanks for the `tests` note. abandoning this as an equivalent change is already landed. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D1667 To: ikostia, #hg-reviewers, quark, akushner Cc: durin42, akushner, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D1667: tests_: fix test-lfs.t on OSX where find does not have quotes
ikostia created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. TEST PLAN - run test-lfs.t REPOSITORY rHG Mercurial BRANCH default REVISION DETAIL https://phab.mercurial-scm.org/D1667 AFFECTED FILES tests/test-lfs.t CHANGE DETAILS diff --git a/tests/test-lfs.t b/tests/test-lfs.t --- a/tests/test-lfs.t +++ b/tests/test-lfs.t @@ -571,7 +571,7 @@ the user cache. $ find $TESTTMP/repo12/.hg/store/lfs/objects -type f - find: */repo12/.hg/store/lfs/objects': $ENOENT$ (glob) + find: */repo12/.hg/store/lfs/objects*: $ENOENT$ (glob) [1] $ hg --config extensions.share= share repo12 repo13 To: ikostia, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D1564: worker: make windows workers daemons
ikostia accepted this revision. ikostia added a comment. This *looks* reasonable to me, but I am afraid I could be missing something important. Anyway, since we can turn it off via a config, I'd say it's good to be in the hotfixes. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D1564 To: wlis, #hg-reviewers, ikostia Cc: ikostia, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D865: obsmarker: fix crash when metadata fields are >255 bytes (issue5681)
ikostia accepted this revision. ikostia added a comment. LGTM REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D865 To: swhitaker, #hg-reviewers, ikostia Cc: pulkit, ikostia, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D865: obsmarker: fix crash when metadata fields are >255 bytes (issue5681)
ikostia added a comment. That is why we raise `ProgrammingError`, not some sort of `UserError`. If your extension writes metadata longer than 255 chars, it is a bad extension. Your proposal is weird, because it is quietly modifying things, IMO this is much worse. I'd rather be forced to change my name to something shorter than having it truncated at some arbitrary position. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D865 To: swhitaker, #hg-reviewers, ikostia Cc: pulkit, ikostia, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D865: obsmarker: fix crash when metadata fields are >255 bytes
ikostia requested changes to this revision. ikostia added a comment. This revision now requires changes to proceed. I would rather see this thing do `raise error.ProrgrammingError('metadata cannot be longer than 255 bytes')` (or some other message). REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D865 To: swhitaker, #hg-reviewers, ikostia Cc: ikostia, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D680: scmutil: handle conflicting files and dirs in origbackuppath
ikostia added a comment. Just as an FYI: I revoke my previous comments, as stuff started working for non-prefixed paths and I no longer intend to land anything related to this. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D680 To: mbthomas, ryanmce, #hg-reviewers, durham, yuja, ikostia Cc: quark, ikostia, yuja, durham, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D680: scmutil: handle conflicting files and dirs in origbackuppath
ikostia added a comment. Here's a patch: https://www.mercurial-scm.org/pipermail/mercurial-devel/2017-September/104837.html REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D680 To: mbthomas, ryanmce, #hg-reviewers, durham, yuja, ikostia Cc: ikostia, yuja, durham, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D680: scmutil: handle conflicting files and dirs in origbackuppath
ikostia requested changes to this revision. ikostia added a comment. This revision now requires changes to proceed. Please wait until the `util.finddirs()` is tweaked and remove `normpath` call. INLINE COMMENTS > yuja wrote in scmutil.py:570 > That's probably okay now. > > I'm not sure if it conflicts with the long paths plan. IIRC, forward > slash isn't allowed in `\\?\` path. I think we should adjust `finddirs` to split on `os.path.sep`, not hardcoded `/`, then we can get rid of `util.normpath` a couple of lines above. I am long overdue with re-sending my series, I will add this change there as well. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D680 To: mbthomas, ryanmce, #hg-reviewers, durham, yuja, ikostia Cc: ikostia, yuja, durham, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel