Patchwork [STABLE] sshpeer: reflect actual command activity one handshake

login
register
mail settings
Submitter Boris Feld
Date April 24, 2018, 9:05 a.m.
Message ID <4f46a1e837ccad647617.1524560717@FB>
Download mbox | patch
Permalink /patch/31218/
State Accepted
Headers show

Comments

Boris Feld - April 24, 2018, 9:05 a.m.
# HG changeset patch
# User Boris Feld <boris.feld@octobus.net>
# Date 1524507798 -3600
#      Mon Apr 23 19:23:18 2018 +0100
# Branch stable
# Node ID 4f46a1e837ccad647617c0752bb727e75e723974
# Parent  80695628adcbee8860f19b9b8578fdf26ff4e701
# EXP-Topic fix-devel-output
# Available At https://bitbucket.org/octobus/mercurial-devel/
#              hg pull https://bitbucket.org/octobus/mercurial-devel/ -r 4f46a1e837cc
sshpeer: reflect actual command activity one handshake

The output from devel-peer-request is expected to give data about request and
roundtrip done to the server. Changeset a9cffd14aa04 changed some of that by
grouping hello and between commands call. However, the old sequence of command
was "emulated" in sshpeer.

Update the sshpeer to reflect this grouping of commands and update the tests
that use it.
Yuya Nishihara - April 24, 2018, 10:45 a.m.
On Tue, 24 Apr 2018 10:05:17 +0100, Boris Feld wrote:
> # HG changeset patch
> # User Boris Feld <boris.feld@octobus.net>
> # Date 1524507798 -3600
> #      Mon Apr 23 19:23:18 2018 +0100
> # Branch stable
> # Node ID 4f46a1e837ccad647617c0752bb727e75e723974
> # Parent  80695628adcbee8860f19b9b8578fdf26ff4e701
> # EXP-Topic fix-devel-output
> # Available At https://bitbucket.org/octobus/mercurial-devel/
> #              hg pull https://bitbucket.org/octobus/mercurial-devel/ -r 4f46a1e837cc
> sshpeer: reflect actual command activity one handshake

Looks good. Queued for stable, thanks.

Patch

diff --git a/mercurial/sshpeer.py b/mercurial/sshpeer.py
--- a/mercurial/sshpeer.py
+++ b/mercurial/sshpeer.py
@@ -261,11 +261,9 @@  def _performhandshake(ui, stdin, stdout,
             handshake.insert(0, 'upgrade %s %s\n' % (token, upgradecaps))
 
         if requestlog:
-            ui.debug('devel-peer-request: hello\n')
+            ui.debug('devel-peer-request: hello+between\n')
+            ui.debug('devel-peer-request:   pairs: %d bytes\n' % len(pairsarg))
         ui.debug('sending hello command\n')
-        if requestlog:
-            ui.debug('devel-peer-request: between\n')
-            ui.debug('devel-peer-request:   pairs: %d bytes\n' % len(pairsarg))
         ui.debug('sending between command\n')
 
         stdin.write(''.join(handshake))
diff --git a/tests/test-debugcommands.t b/tests/test-debugcommands.t
--- a/tests/test-debugcommands.t
+++ b/tests/test-debugcommands.t
@@ -411,10 +411,9 @@  Test debugpeer
   $ hg --config ui.ssh="\"$PYTHON\" \"$TESTDIR/dummyssh\"" --debug debugpeer ssh://user@dummy/debugrevlog
   running "*" "*/tests/dummyssh" 'user@dummy' 'hg -R debugrevlog serve --stdio' (glob) (no-windows !)
   running "*" "*\tests/dummyssh" "user@dummy" "hg -R debugrevlog serve --stdio" (glob) (windows !)
-  devel-peer-request: hello
+  devel-peer-request: hello+between
+  devel-peer-request:   pairs: 81 bytes
   sending hello command
-  devel-peer-request: between
-  devel-peer-request:   pairs: 81 bytes
   sending between command
   remote: 413
   remote: capabilities: batch branchmap $USUAL_BUNDLE2_CAPS_SERVER$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash
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
@@ -58,10 +58,9 @@  Test a normal behaving server, for sanit
   $ hg --debug debugpeer ssh://user@dummy/server
   running * "*/tests/dummyssh" 'user@dummy' 'hg -R server serve --stdio' (glob) (no-windows !)
   running * "*\tests/dummyssh" "user@dummy" "hg -R server serve --stdio" (glob) (windows !)
-  devel-peer-request: hello
+  devel-peer-request: hello+between
+  devel-peer-request:   pairs: 81 bytes
   sending hello command
-  devel-peer-request: between
-  devel-peer-request:   pairs: 81 bytes
   sending between command
   remote: 413
   remote: capabilities: batch branchmap $USUAL_BUNDLE2_CAPS_SERVER$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash
@@ -170,10 +169,9 @@  SSH banner is not printed by default, ig
   $ SSHSERVERMODE=banner hg --debug debugpeer ssh://user@dummy/server
   running * "*/tests/dummyssh" 'user@dummy' 'hg -R server serve --stdio' (glob) (no-windows !)
   running * "*\tests/dummyssh" "user@dummy" "hg -R server serve --stdio" (glob) (windows !)
-  devel-peer-request: hello
+  devel-peer-request: hello+between
+  devel-peer-request:   pairs: 81 bytes
   sending hello command
-  devel-peer-request: between
-  devel-peer-request:   pairs: 81 bytes
   sending between command
   remote: banner: line 0
   remote: banner: line 1
@@ -262,10 +260,9 @@  servers.
   $ SSHSERVERMODE=no-hello hg --debug debugpeer ssh://user@dummy/server
   running * "*/tests/dummyssh" 'user@dummy' 'hg -R server serve --stdio' (glob) (no-windows !)
   running * "*\tests/dummyssh" "user@dummy" "hg -R server serve --stdio" (glob) (windows !)
-  devel-peer-request: hello
+  devel-peer-request: hello+between
+  devel-peer-request:   pairs: 81 bytes
   sending hello command
-  devel-peer-request: between
-  devel-peer-request:   pairs: 81 bytes
   sending between command
   remote: 0
   remote: 1
@@ -310,10 +307,9 @@  Sending an unknown command to the server
   running * "*/tests/dummyssh" 'user@dummy' 'hg -R server serve --stdio' (glob) (no-windows !)
   running * "*\tests/dummyssh" "user@dummy" "hg -R server serve --stdio" (glob) (windows !)
   sending no-args command
-  devel-peer-request: hello
+  devel-peer-request: hello+between
+  devel-peer-request:   pairs: 81 bytes
   sending hello command
-  devel-peer-request: between
-  devel-peer-request:   pairs: 81 bytes
   sending between command
   remote: 0
   remote: 413
@@ -383,10 +379,9 @@  Send multiple unknown commands before he
   sending unknown1 command
   sending unknown2 command
   sending unknown3 command
-  devel-peer-request: hello
+  devel-peer-request: hello+between
+  devel-peer-request:   pairs: 81 bytes
   sending hello command
-  devel-peer-request: between
-  devel-peer-request:   pairs: 81 bytes
   sending between command
   remote: 0
   remote: 0
@@ -958,10 +953,9 @@  Send an upgrade request to a server that
   running * "*/tests/dummyssh" 'user@dummy' 'hg -R server serve --stdio' (glob) (no-windows !)
   running * "*\tests/dummyssh" "user@dummy" "hg -R server serve --stdio" (glob) (windows !)
   sending upgrade request: * proto=exp-ssh-v2-0001 (glob)
-  devel-peer-request: hello
+  devel-peer-request: hello+between
+  devel-peer-request:   pairs: 81 bytes
   sending hello command
-  devel-peer-request: between
-  devel-peer-request:   pairs: 81 bytes
   sending between command
   remote: 0
   remote: 413
@@ -1017,10 +1011,9 @@  Send an upgrade request to a server that
   running * "*/tests/dummyssh" 'user@dummy' 'hg -R server serve --stdio' (glob) (no-windows !)
   running * "*\tests/dummyssh" "user@dummy" "hg -R server serve --stdio" (glob) (windows !)
   sending upgrade request: * proto=exp-ssh-v2-0001 (glob)
-  devel-peer-request: hello
+  devel-peer-request: hello+between
+  devel-peer-request:   pairs: 81 bytes
   sending hello command
-  devel-peer-request: between
-  devel-peer-request:   pairs: 81 bytes
   sending between command
   protocol upgraded to exp-ssh-v2-0001
   remote: capabilities: batch branchmap $USUAL_BUNDLE2_CAPS_SERVER$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash
@@ -1037,10 +1030,9 @@  Verify the peer has capabilities
   running * "*/tests/dummyssh" 'user@dummy' 'hg -R server serve --stdio' (glob) (no-windows !)
   running * "*\tests/dummyssh" "user@dummy" "hg -R server serve --stdio" (glob) (windows !)
   sending upgrade request: * proto=exp-ssh-v2-0001 (glob)
-  devel-peer-request: hello
+  devel-peer-request: hello+between
+  devel-peer-request:   pairs: 81 bytes
   sending hello command
-  devel-peer-request: between
-  devel-peer-request:   pairs: 81 bytes
   sending between command
   protocol upgraded to exp-ssh-v2-0001
   remote: capabilities: batch branchmap $USUAL_BUNDLE2_CAPS_SERVER$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash
diff --git a/tests/test-ssh.t b/tests/test-ssh.t
--- a/tests/test-ssh.t
+++ b/tests/test-ssh.t
@@ -490,10 +490,9 @@  debug output
   pulling from ssh://user@dummy/remote
   running .* ".*/dummyssh" ['"]user@dummy['"] ('|")hg -R remote serve --stdio('|") (re)
   sending upgrade request: * proto=exp-ssh-v2-0001 (glob) (sshv2 !)
-  devel-peer-request: hello
+  devel-peer-request: hello+between
+  devel-peer-request:   pairs: 81 bytes
   sending hello command
-  devel-peer-request: between
-  devel-peer-request:   pairs: 81 bytes
   sending between command
   remote: 413 (sshv1 !)
   protocol upgraded to exp-ssh-v2-0001 (sshv2 !)