D3378: debugcommands: ability to suppress logging of handshake

2018-04-16 Thread indygreg (Gregory Szorc)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHGad1c07008e0b: debugcommands: ability to suppress logging of 
handshake (authored by indygreg, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D3378?vs=8290&id=8321

REVISION DETAIL
  https://phab.mercurial-scm.org/D3378

AFFECTED FILES
  mercurial/debugcommands.py
  tests/test-completion.t
  tests/test-http-api-httpv2.t
  tests/test-wireproto-command-branchmap.t
  tests/test-wireproto-command-capabilities.t
  tests/test-wireproto-command-heads.t
  tests/test-wireproto-command-known.t
  tests/test-wireproto-command-listkeys.t
  tests/test-wireproto-command-lookup.t
  tests/test-wireproto-command-pushkey.t
  tests/wireprotohelpers.sh

CHANGE DETAILS

diff --git a/tests/wireprotohelpers.sh b/tests/wireprotohelpers.sh
--- a/tests/wireprotohelpers.sh
+++ b/tests/wireprotohelpers.sh
@@ -6,6 +6,10 @@
 }
 
 sendhttpv2peer() {
+  hg --verbose debugwireproto --nologhandshake --peer http2 
http://$LOCALIP:$HGPORT/
+}
+
+sendhttpv2peerhandshake() {
   hg --verbose debugwireproto --peer http2 http://$LOCALIP:$HGPORT/
 }
 
diff --git a/tests/test-wireproto-command-pushkey.t 
b/tests/test-wireproto-command-pushkey.t
--- a/tests/test-wireproto-command-pushkey.t
+++ b/tests/test-wireproto-command-pushkey.t
@@ -29,23 +29,6 @@
   > new 426bada5c67598ca65036d57d9e4b64b0c1ce7a0
   > EOF
   creating http peer for wire protocol version 2
-  s> *\r\n (glob)
-  s> Accept-Encoding: identity\r\n
-  s> vary: X-HgProto-1,X-HgUpgrade-1\r\n
-  s> x-hgproto-1: cbor\r\n
-  s> x-hgupgrade-1: exp-http-v2-0001\r\n
-  s> accept: application/mercurial-0.1\r\n
-  s> host: $LOCALIP:$HGPORT\r\n (glob)
-  s> user-agent: Mercurial debugwireproto\r\n
-  s> \r\n
-  s> makefile('rb', None)
-  s> HTTP/1.1 200 OK\r\n
-  s> Server: testing stub value\r\n
-  s> Date: $HTTP_DATE$\r\n
-  s> Content-Type: application/mercurial-cbor\r\n
-  s> Content-Length: *\r\n (glob)
-  s> \r\n
-  s> 
\xa3Dapis\xa1Pexp-http-v2-0001\xa4Hcommands\xa7Eheads\xa2Dargs\xa1Jpubliconly\xf4Kpermissions\x81DpullEknown\xa2Dargs\xa1Enodes\x81HdeadbeefKpermissions\x81DpullFlookup\xa2Dargs\xa1CkeyCfooKpermissions\x81DpullGpushkey\xa2Dargs\xa4CkeyCkeyCnewCnewColdColdInamespaceBnsKpermissions\x81DpushHlistkeys\xa2Dargs\xa1InamespaceBnsKpermissions\x81DpullIbranchmap\xa2Dargs\xa0Kpermissions\x81DpullLcapabilities\xa2Dargs\xa0Kpermissions\x81DpullKcompression\x82\xa1DnameDzstd\xa1DnameDzlibNrawrepoformats\x82LgeneraldeltaHrevlogv1Qframingmediatypes\x81X&application/mercurial-exp-framing-0003GapibaseDapi/Nv1capabilitiesY\x01\xcabatch
 branchmap $USUAL_BUNDLE2_CAPS_SERVER$ changegroupsubset 
compression=$BUNDLE2_COMPRESSIONS$ getbundle httpheader=1024 
httpmediatype=0.1rx,0.1tx,0.2tx known lookup pushkey 
streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash
   sending pushkey command
   s> *\r\n (glob)
   s> Accept-Encoding: identity\r\n
@@ -77,23 +60,6 @@
   > namespace bookmarks
   > EOF
   creating http peer for wire protocol version 2
-  s> GET /?cmd=capabilities HTTP/1.1\r\n
-  s> Accept-Encoding: identity\r\n
-  s> vary: X-HgProto-1,X-HgUpgrade-1\r\n
-  s> x-hgproto-1: cbor\r\n
-  s> x-hgupgrade-1: exp-http-v2-0001\r\n
-  s> accept: application/mercurial-0.1\r\n
-  s> host: $LOCALIP:$HGPORT\r\n (glob)
-  s> user-agent: Mercurial debugwireproto\r\n
-  s> \r\n
-  s> makefile('rb', None)
-  s> HTTP/1.1 200 OK\r\n
-  s> Server: testing stub value\r\n
-  s> Date: $HTTP_DATE$\r\n
-  s> Content-Type: application/mercurial-cbor\r\n
-  s> Content-Length: *\r\n (glob)
-  s> \r\n
-  s> 
\xa3Dapis\xa1Pexp-http-v2-0001\xa4Hcommands\xa7Eheads\xa2Dargs\xa1Jpubliconly\xf4Kpermissions\x81DpullEknown\xa2Dargs\xa1Enodes\x81HdeadbeefKpermissions\x81DpullFlookup\xa2Dargs\xa1CkeyCfooKpermissions\x81DpullGpushkey\xa2Dargs\xa4CkeyCkeyCnewCnewColdColdInamespaceBnsKpermissions\x81DpushHlistkeys\xa2Dargs\xa1InamespaceBnsKpermissions\x81DpullIbranchmap\xa2Dargs\xa0Kpermissions\x81DpullLcapabilities\xa2Dargs\xa0Kpermissions\x81DpullKcompression\x82\xa1DnameDzstd\xa1DnameDzlibNrawrepoformats\x82LgeneraldeltaHrevlogv1Qframingmediatypes\x81X&application/mercurial-exp-framing-0003GapibaseDapi/Nv1capabilitiesY\x01\xcabatch
 branchmap $USUAL_BUNDLE2_CAPS_SERVER$ changegroupsubset 
compression=$BUNDLE2_COMPRESSIONS$ getbundle httpheader=1024 
httpmediatype=0.1rx,0.1tx,0.2tx known lookup pushkey 
streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash
   sending listkeys command
   s> POST /api/exp-http-v2-0001/ro/listkeys HTTP/1.1\r\n
   s> Accept-Encoding: identity\r\n
diff --git a/tests/test-wireproto-command-lookup.t 
b/tests/test-wireproto-command-lookup.t
--- a/tests/test-wireproto-command-lookup.t
+++ b/tests/test-wireproto-command-lookup.t
@@ -26,23 +26,6 @@
   > key 426b

D3378: debugcommands: ability to suppress logging of handshake

2018-04-14 Thread indygreg (Gregory Szorc)
indygreg created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  The tests for calling wire protocol commands were getting quite
  verbose because they included the results of the capabilities
  request. Furthermore, it was annoying to have to update several
  tests every time the capabilities response changed.
  
  The only tests that really care about the low-level details of
  the capabilities requests are those testing the protocol
  handshake. And those are mostly not instantiating peer instances
  or are contained to limited files.
  
  This commit adds an option to `hg debugwireproto` to suppress logging
  of the handshake. The shell helper function to perform HTTP tests
  has been updated to use this by default. Lots of excessive test
  output has gone away.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D3378

AFFECTED FILES
  mercurial/debugcommands.py
  tests/test-completion.t
  tests/test-http-api-httpv2.t
  tests/test-wireproto-command-branchmap.t
  tests/test-wireproto-command-capabilities.t
  tests/test-wireproto-command-heads.t
  tests/test-wireproto-command-known.t
  tests/test-wireproto-command-listkeys.t
  tests/test-wireproto-command-lookup.t
  tests/test-wireproto-command-pushkey.t
  tests/wireprotohelpers.sh

CHANGE DETAILS

diff --git a/tests/wireprotohelpers.sh b/tests/wireprotohelpers.sh
--- a/tests/wireprotohelpers.sh
+++ b/tests/wireprotohelpers.sh
@@ -6,6 +6,10 @@
 }
 
 sendhttpv2peer() {
+  hg --verbose debugwireproto --nologhandshake --peer http2 
http://$LOCALIP:$HGPORT/
+}
+
+sendhttpv2peerhandshake() {
   hg --verbose debugwireproto --peer http2 http://$LOCALIP:$HGPORT/
 }
 
diff --git a/tests/test-wireproto-command-pushkey.t 
b/tests/test-wireproto-command-pushkey.t
--- a/tests/test-wireproto-command-pushkey.t
+++ b/tests/test-wireproto-command-pushkey.t
@@ -29,23 +29,6 @@
   > new 426bada5c67598ca65036d57d9e4b64b0c1ce7a0
   > EOF
   creating http peer for wire protocol version 2
-  s> *\r\n (glob)
-  s> Accept-Encoding: identity\r\n
-  s> vary: X-HgProto-1,X-HgUpgrade-1\r\n
-  s> x-hgproto-1: cbor\r\n
-  s> x-hgupgrade-1: exp-http-v2-0001\r\n
-  s> accept: application/mercurial-0.1\r\n
-  s> host: $LOCALIP:$HGPORT\r\n (glob)
-  s> user-agent: Mercurial debugwireproto\r\n
-  s> \r\n
-  s> makefile('rb', None)
-  s> HTTP/1.1 200 OK\r\n
-  s> Server: testing stub value\r\n
-  s> Date: $HTTP_DATE$\r\n
-  s> Content-Type: application/mercurial-cbor\r\n
-  s> Content-Length: *\r\n (glob)
-  s> \r\n
-  s> 
\xa3Dapis\xa1Pexp-http-v2-0001\xa4Hcommands\xa7Eheads\xa2Dargs\xa1Jpubliconly\xf4Kpermissions\x81DpullEknown\xa2Dargs\xa1Enodes\x81HdeadbeefKpermissions\x81DpullFlookup\xa2Dargs\xa1CkeyCfooKpermissions\x81DpullGpushkey\xa2Dargs\xa4CkeyCkeyCnewCnewColdColdInamespaceBnsKpermissions\x81DpushHlistkeys\xa2Dargs\xa1InamespaceBnsKpermissions\x81DpullIbranchmap\xa2Dargs\xa0Kpermissions\x81DpullLcapabilities\xa2Dargs\xa0Kpermissions\x81DpullKcompression\x82\xa1DnameDzstd\xa1DnameDzlibNrawrepoformats\x82LgeneraldeltaHrevlogv1Qframingmediatypes\x81X&application/mercurial-exp-framing-0003GapibaseDapi/Nv1capabilitiesY\x01\xcabatch
 branchmap $USUAL_BUNDLE2_CAPS_SERVER$ changegroupsubset 
compression=$BUNDLE2_COMPRESSIONS$ getbundle httpheader=1024 
httpmediatype=0.1rx,0.1tx,0.2tx known lookup pushkey 
streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash
   sending pushkey command
   s> *\r\n (glob)
   s> Accept-Encoding: identity\r\n
@@ -77,23 +60,6 @@
   > namespace bookmarks
   > EOF
   creating http peer for wire protocol version 2
-  s> GET /?cmd=capabilities HTTP/1.1\r\n
-  s> Accept-Encoding: identity\r\n
-  s> vary: X-HgProto-1,X-HgUpgrade-1\r\n
-  s> x-hgproto-1: cbor\r\n
-  s> x-hgupgrade-1: exp-http-v2-0001\r\n
-  s> accept: application/mercurial-0.1\r\n
-  s> host: $LOCALIP:$HGPORT\r\n (glob)
-  s> user-agent: Mercurial debugwireproto\r\n
-  s> \r\n
-  s> makefile('rb', None)
-  s> HTTP/1.1 200 OK\r\n
-  s> Server: testing stub value\r\n
-  s> Date: $HTTP_DATE$\r\n
-  s> Content-Type: application/mercurial-cbor\r\n
-  s> Content-Length: *\r\n (glob)
-  s> \r\n
-  s> 
\xa3Dapis\xa1Pexp-http-v2-0001\xa4Hcommands\xa7Eheads\xa2Dargs\xa1Jpubliconly\xf4Kpermissions\x81DpullEknown\xa2Dargs\xa1Enodes\x81HdeadbeefKpermissions\x81DpullFlookup\xa2Dargs\xa1CkeyCfooKpermissions\x81DpullGpushkey\xa2Dargs\xa4CkeyCkeyCnewCnewColdColdInamespaceBnsKpermissions\x81DpushHlistkeys\xa2Dargs\xa1InamespaceBnsKpermissions\x81DpullIbranchmap\xa2Dargs\xa0Kpermissions\x81DpullLcapabilities\xa2Dargs\xa0Kpermissions\x81DpullKcompression\x82\xa1DnameDzstd\xa1DnameDzlibNrawrepoformats\x82LgeneraldeltaHrevlogv1Qframingmediatypes\x81X&application/mercurial-exp-framing-0003GapibaseDapi/Nv1capabilitiesY\x01\xcabatch
 branchmap $USUAL_BUNDLE2_CAPS_SERV