[PATCH 4 of 5] sshserver: flush stream after command dispatch

Pierre-Yves David pierre-yves.david at ens-lyon.org
Sun Sep 8 03:46:02 EDT 2019


# HG changeset patch
# User Pierre-Yves David <pierre-yves.david at octobus.net>
# Date 1567897354 -7200
#      Sun Sep 08 01:02:34 2019 +0200
# Node ID 426a83641e1b9a94775bd2c3db0033d141432608
# Parent  b02758303195ae5953d2e1beacda3eec73314b20
# EXP-Topic check-summary
# Available At https://bitbucket.org/octobus/mercurial-devel/
#              hg pull https://bitbucket.org/octobus/mercurial-devel/ -r 426a83641e1b
sshserver: flush stream after command dispatch

I am not sure why this is not working as expected, but without this client might
not see some important output. Without this patch moving some output at
transaction closing time makes it disapear for ssh client in various sitaution.

diff --git a/mercurial/wireprotoserver.py b/mercurial/wireprotoserver.py
--- a/mercurial/wireprotoserver.py
+++ b/mercurial/wireprotoserver.py
@@ -657,6 +657,8 @@ def _runsshserver(ui, repo, fin, fout, e
                 continue
 
             rsp = wireprotov1server.dispatch(repo, proto, request)
+            repo.ui.fout.flush()
+            repo.ui.ferr.flush()
 
             if isinstance(rsp, bytes):
                 _sshv1respondbytes(fout, rsp)
diff --git a/tests/test-bookmarks-corner-case.t b/tests/test-bookmarks-corner-case.t
--- a/tests/test-bookmarks-corner-case.t
+++ b/tests/test-bookmarks-corner-case.t
@@ -200,8 +200,8 @@ Check raced push output.
   $ cat push-output.txt
   pushing to ssh://user@dummy/bookrace-server
   searching for changes
+  remote: setting raced push up
   remote has heads on branch 'default' that are not known locally: f26c3b5167d1
-  remote: setting raced push up
   remote: adding changesets
   remote: adding manifests
   remote: adding file changes
diff --git a/tests/test-ssh-proto.t b/tests/test-ssh-proto.t
--- a/tests/test-ssh-proto.t
+++ b/tests/test-ssh-proto.t
@@ -104,6 +104,7 @@ I/O logging works
   $ hg debugserve --sshstdio --logiofd 1 << EOF
   > hello
   > EOF
+  e> flush() -> None
   o> write(4) -> 4:
   o>     440\n
   o> write(440) -> 440:
@@ -119,6 +120,7 @@ I/O logging works
   capabilities: batch branchmap $USUAL_BUNDLE2_CAPS$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=generaldelta,revlogv1,sparserevlog unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash
 
   $ cat $TESTTMP/io
+  e> flush() -> None
   o> write(4) -> 4:
   o>     440\n
   o> write(440) -> 440:


More information about the Mercurial-devel mailing list