Patchwork [2,of,5] sshpeer: break "OutOfBandError" feature for ssh (BC)

login
register
mail settings
Submitter Pierre-Yves David
Date May 20, 2015, 11:53 p.m.
Message ID <2e5f389856a5d976cd85.1432166001@marginatus.alto.octopoid.net>
Download mbox | patch
Permalink /patch/9207/
State Accepted
Headers show

Comments

Pierre-Yves David - May 20, 2015, 11:53 p.m.
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david@fb.com>
# Date 1432143192 18000
#      Wed May 20 12:33:12 2015 -0500
# Node ID 2e5f389856a5d976cd853ab94fd125955413d2f0
# Parent  480ce3cb4b817dddf155c71cfd95dcb4e57baca1
sshpeer: break "OutOfBandError" feature for ssh (BC)

When we'll be using the ssh's 'stderr' for realtime output successfully, it will
no longer be possible to use 'stderr' to carry the error message (because it
is already consumed by the real time output logic.

This feature is very rarely used (test says largefile only) and I think
breaking its output pattern is worth the benefit of having real time output with
ssh.

Patch

diff --git a/mercurial/sshpeer.py b/mercurial/sshpeer.py
--- a/mercurial/sshpeer.py
+++ b/mercurial/sshpeer.py
@@ -193,20 +193,13 @@  class sshpeer(wireproto.wirepeer):
         return self.pipei
 
     def _recv(self):
         l = self.pipei.readline()
         if l == '\n':
-            err = []
-            while True:
-                line = self.pipee.readline()
-                if line == '-\n':
-                    break
-                err.extend([line])
-            if len(err) > 0:
-                # strip the trailing newline added to the last line server-side
-                err[-1] = err[-1][:-1]
-            self._abort(error.OutOfBandError(*err))
+            self.readerr()
+            msg = _('check previous remote output')
+            self._abort(error.OutOfBandError(hint=msg))
         self.readerr()
         try:
             l = int(l)
         except ValueError:
             self._abort(error.ResponseError(_("unexpected response:"), l))
diff --git a/tests/test-largefiles-wireproto.t b/tests/test-largefiles-wireproto.t
--- a/tests/test-largefiles-wireproto.t
+++ b/tests/test-largefiles-wireproto.t
@@ -109,15 +109,18 @@  used all HGPORTs, kill all daemons
   $ "$TESTDIR/killdaemons.py" $DAEMON_PIDS
 #endif
 
 vanilla clients locked out from largefiles ssh repos
   $ hg --config extensions.largefiles=! clone -e "python \"$TESTDIR/dummyssh\"" ssh://user@dummy/r4 r5
-  abort: remote error:
-  
-  This repository uses the largefiles extension.
-  
-  Please enable it in your Mercurial config file.
+  remote: 
+  remote: This repository uses the largefiles extension.
+  remote: 
+  remote: Please enable it in your Mercurial config file.
+  remote: 
+  remote: -
+  abort: remote error
+  (check previous remote output)
   [255]
 
 #if serve
 
 largefiles clients refuse to push largefiles repos to vanilla servers