[PATCH 3 of 3] test-ssh: convert dumpenv to python for Windows

Matt Harbison mharbison72 at gmail.com
Sun Dec 17 00:27:24 UTC 2017


# HG changeset patch
# User Matt Harbison <matt_harbison at yahoo.com>
# Date 1513468682 18000
#      Sat Dec 16 18:58:02 2017 -0500
# Node ID ca9cde0697c1e923f4c9a3396343afc238ba92f2
# Parent  d1fbb07b0b7259ae4ca88434e0eda2a21359f7ec
test-ssh: convert dumpenv to python for Windows

Previously, this complained:

    remote: '.' is not recognized as an internal or external command,
    remote: operable program or batch file.

1 out of 4 Linux runs failed to print 17 after converting, and instead printed
an empty remote line.  Not sure why, but maybe the flush will help.

diff --git a/tests/test-ssh.t b/tests/test-ssh.t
--- a/tests/test-ssh.t
+++ b/tests/test-ssh.t
@@ -598,17 +598,19 @@
   [255]
 
 test that custom environment is passed down to ssh executable
-  $ cat >>dumpenv <<EOF
-  > #! /bin/sh
-  > echo \$VAR >&2
+  $ cat >>dumpenv.py <<EOF
+  > from __future__ import print_function
+  > import sys
+  > from mercurial import encoding
+  > print('%s' % encoding.environ.get('VAR', ''), file=sys.stderr)
+  > sys.stderr.flush()
   > EOF
-  $ chmod +x dumpenv
-  $ hg pull ssh://something --config ui.ssh="./dumpenv"
+  $ hg pull ssh://something --config ui.ssh="$PYTHON dumpenv.py"
   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
+  $ hg pull ssh://something --config ui.ssh="$PYTHON dumpenv.py" --config sshenv.VAR=17
   pulling from ssh://something/
   remote: 17
   abort: no suitable response from remote hg!



More information about the Mercurial-devel mailing list