D12087: unamend: error out when running on merge commit
martinvonz created this revision. Herald added a reviewer: hg-reviewers. Herald added a subscriber: mercurial-patches. REVISION SUMMARY It's better to error out than to produce a bad commit. We do that same in `hg uncommit`. I haven't looked into how much work it is to make them work instead. REPOSITORY rHG Mercurial BRANCH default REVISION DETAIL https://phab.mercurial-scm.org/D12087 AFFECTED FILES hgext/uncommit.py tests/test-unamend.t CHANGE DETAILS diff --git a/tests/test-unamend.t b/tests/test-unamend.t --- a/tests/test-unamend.t +++ b/tests/test-unamend.t @@ -443,8 +443,5 @@ A left $ hg amend $ hg unamend - $ hg st --rev 1 --rev . - A right - R left (known-bad-output !) - $ hg st --rev 2 --rev . - A left (missing-correct-output !) + abort: cannot unamend merge changeset + [10] diff --git a/hgext/uncommit.py b/hgext/uncommit.py --- a/hgext/uncommit.py +++ b/hgext/uncommit.py @@ -273,6 +273,8 @@ curctx = repo[b'.'] rewriteutil.precheck(repo, [curctx.rev()], b'unamend') +if len(curctx.parents()) > 1: +raise error.InputError(_(b"cannot unamend merge changeset")) # identify the commit to which to unamend markers = list(predecessormarkers(curctx)) To: martinvonz, #hg-reviewers Cc: mercurial-patches, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D12086: tests: demonstrate how `hg unamend` fails on merge commits
martinvonz created this revision. Herald added a reviewer: hg-reviewers. Herald added a subscriber: mercurial-patches. REVISION SUMMARY When `hg unamend` is run on a merge commit, it seems that it loses the changes from the second parent. REPOSITORY rHG Mercurial BRANCH default REVISION DETAIL https://phab.mercurial-scm.org/D12086 AFFECTED FILES tests/test-unamend.t CHANGE DETAILS diff --git a/tests/test-unamend.t b/tests/test-unamend.t --- a/tests/test-unamend.t +++ b/tests/test-unamend.t @@ -421,3 +421,30 @@ A d b R b + +Try to unamend a merge + + $ cd .. + $ hg init merge + $ cd merge + $ echo initial > initial + $ hg ci -Aqm initial + $ echo left > left + $ hg ci -Aqm left + $ hg co -q 0 + $ echo right > right + $ hg ci -Aqm right + $ hg merge -q 1 + $ hg ci -m merge + $ echo accidental > initial + $ hg st --rev 1 --rev . + A right + $ hg st --rev 2 --rev . + A left + $ hg amend + $ hg unamend + $ hg st --rev 1 --rev . + A right + R left (known-bad-output !) + $ hg st --rev 2 --rev . + A left (missing-correct-output !) To: martinvonz, #hg-reviewers Cc: mercurial-patches, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
mercurial-devel | Failed pipeline for branch/default | 8ed6483b
Pipeline #31486 has failed! Project: mercurial-devel ( https://foss.heptapod.net/mercurial/mercurial-devel ) Branch: branch/default ( https://foss.heptapod.net/mercurial/mercurial-devel/-/commits/branch/default ) Commit: 8ed6483b ( https://foss.heptapod.net/mercurial/mercurial-devel/-/commit/8ed6483b95b4eedc6e55dacdc94465bc7c12a0b0 ) Commit Message: relnotes: add note about changed labels texts ... Commit Author: Martin von Zweigbergk ( https://foss.heptapod.net/martinvonz ) Pipeline #31486 ( https://foss.heptapod.net/mercurial/mercurial-devel/-/pipelines/31486 ) triggered by Administrator ( https://foss.heptapod.net/root ) had 1 failed job. Job #284690 ( https://foss.heptapod.net/mercurial/mercurial-devel/-/jobs/284690/raw ) Stage: tests Name: test-py2-rust -- You're receiving this email because of your account on foss.heptapod.net. ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D12085: relnotes: add note about changed labels texts
martinvonz created this revision. Herald added a reviewer: hg-reviewers. Herald added a subscriber: mercurial-patches. REPOSITORY rHG Mercurial BRANCH default REVISION DETAIL https://phab.mercurial-scm.org/D12085 AFFECTED FILES relnotes/next CHANGE DETAILS diff --git a/relnotes/next b/relnotes/next --- a/relnotes/next +++ b/relnotes/next @@ -24,6 +24,11 @@ used to have some space-padding, and truncation to fit within 72 columns. Both the padding and the truncation has been removed. +Some of the text in labels passed to merge tools has changed. For example, +in conflicts while running `hg histedit`, the labels used to be "local", +"base", and "histedit". They are now "already edited", +"parent of current change", and "current change", respectively. + == Internal API Changes == The following functions have been removed: To: martinvonz, #hg-reviewers Cc: mercurial-patches, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D12083: requirements: add an official `REVLOG_COMPRESSION_ZSTD` const
marmoute created this revision. Herald added a reviewer: hg-reviewers. Herald added a subscriber: mercurial-patches. REVISION SUMMARY Such constant was missing and its value was missing from the set of requirements that needs to be preserved through stream clone. This did not had any consequence yet as the "bundle 2 does not filter its requirements" is shadowing the issue. However we are now in a situation where we can fix this issue. So lets do it next. With the preparation work on test, changing the streamreqs value only impact two tests, where checking the full value seems to remains relevant. Important note: Since older version of Mercurial used the old `supportedformat` class attribute to check for stream requirement they supported, older version will consider this requirements to prevent them from using streaming clone. Even as they support this requirements for years. Pack for stable will be send to fix it, but they will have to be backported to older version if needed. REPOSITORY rHG Mercurial BRANCH default REVISION DETAIL https://phab.mercurial-scm.org/D12083 AFFECTED FILES mercurial/localrepo.py mercurial/requirements.py tests/test-bundle.t tests/test-clonebundles.t tests/test-debugcommands.t CHANGE DETAILS diff --git a/tests/test-debugcommands.t b/tests/test-debugcommands.t --- a/tests/test-debugcommands.t +++ b/tests/test-debugcommands.t @@ -657,8 +657,8 @@ devel-peer-request: pairs: 81 bytes sending hello command sending between command - remote: 463 - remote: capabilities: batch branchmap $USUAL_BUNDLE2_CAPS$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=generaldelta,persistent-nodemap,revlogv1,sparserevlog unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash + remote: 487 + remote: capabilities: batch branchmap $USUAL_BUNDLE2_CAPS$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=generaldelta,persistent-nodemap,revlog-compression-zstd,revlogv1,sparserevlog unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash remote: 1 devel-peer-request: protocaps devel-peer-request: caps: * bytes (glob) @@ -677,8 +677,8 @@ devel-peer-request: pairs: 81 bytes sending hello command sending between command - remote: 444 - remote: capabilities: batch branchmap $USUAL_BUNDLE2_CAPS$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=generaldelta,revlogv1,sparserevlog unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash + remote: 468 + remote: capabilities: batch branchmap $USUAL_BUNDLE2_CAPS$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=generaldelta,revlog-compression-zstd,revlogv1,sparserevlog unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash remote: 1 devel-peer-request: protocaps devel-peer-request: caps: * bytes (glob) diff --git a/tests/test-clonebundles.t b/tests/test-clonebundles.t --- a/tests/test-clonebundles.t +++ b/tests/test-clonebundles.t @@ -279,8 +279,9 @@ $ hg -R server debugcreatestreamclonebundle packed.hg writing 613 bytes for 4 files - bundle requirements: generaldelta, revlogv1, sparserevlog (no-rust !) - bundle requirements: generaldelta, persistent-nodemap, revlogv1, sparserevlog (rust !) + bundle requirements: generaldelta, revlogv1, sparserevlog (no-rust no-zstd !) + bundle requirements: generaldelta, revlog-compression-zstd, revlogv1, sparserevlog (no-rust zstd !) + bundle requirements: generaldelta, persistent-nodemap, revlog-compression-zstd, revlogv1, sparserevlog (rust !) No bundle spec should work diff --git a/tests/test-bundle.t b/tests/test-bundle.t --- a/tests/test-bundle.t +++ b/tests/test-bundle.t @@ -297,32 +297,32 @@ $ hg -R test debugcreatestreamclonebundle packed.hg writing 2665 bytes for 6 files - bundle requirements: generaldelta, persistent-nodemap, revlogv1, sparserevlog + bundle requirements: generaldelta, persistent-nodemap, revlog-compression-zstd, revlogv1, sparserevlog $ f -B 64 --size --sha1 --hexdump packed.hg - packed.hg: size=2860, sha1=81d7a2e535892cda51e82c200f818de2cca828d3 + packed.hg: size=2884, sha1=b0c868701f8a9fe44daf094b2f5bf661cf90c789 : 48 47 53 31 55 4e 00 00 00 00 00 00 00 06 00 00 |HGS1UN..| - 0010: 00 00 00 00 0a 69 00 36 67 65 6e 65 72 61 6c 64 |.i.6generald| + 0010: 00 00 00 00 0a 69 00 4e 67 65 6e 65 72 61 6c 64 |.i.Ngenerald| 0020: 65 6c 74 61 2c 70 65 72 73 69 73 74 65 6e 74 2d |elta,persistent-| - 0030: 6e 6f 64 65 6d 61 70 2c 72 65 76 6c 6f 67 76 31 |nodemap,revlogv1| + 0030: 6e 6f 64 65 6d 61 70 2c 72 65 76 6c 6f 67 2d 63 |nodemap,revlog-c| $ hg debugbundle --spec packed.hg - none-packed1;requirements%3Dgeneraldelta%2Cpersistent-nodemap%2Crevlogv1%2Csparserevlog + none-packed1;requirements%3Dgeneraldelta%2Cpersistent-nodemap%2Crevlog-compression-zstd%2Crevlogv1%2Csparserevlog #endif #if reporevlogstore no-rust zstd $ hg -R test debugcreatestreamclonebundle packed.hg writing
D12084: stream-clone: also filter the requirement we put in the bundle 2
marmoute created this revision. Herald added a reviewer: hg-reviewers. Herald added a subscriber: mercurial-patches. REVISION SUMMARY We were wrongly putting irrelevant requirements in the bundle and the receiving side was getting confused, treating them as being missing while still putting them in the `requires` file. Leading do corrupted repositories. This changes fix stream-clone behavior regarding format when bundle-2 is involved, so we now also test this cases. Behavior with older version of Mercurial will be fine as they filter the requirements they get from the bundle on their side anyway. REPOSITORY rHG Mercurial BRANCH default REVISION DETAIL https://phab.mercurial-scm.org/D12084 AFFECTED FILES mercurial/bundle2.py tests/test-clone-stream-format.t tests/test-clone-stream.t tests/test-stream-bundle-v2.t CHANGE DETAILS diff --git a/tests/test-stream-bundle-v2.t b/tests/test-stream-bundle-v2.t --- a/tests/test-stream-bundle-v2.t +++ b/tests/test-stream-bundle-v2.t @@ -45,13 +45,13 @@ $ hg bundle -a --type="none-v2;stream=v2" bundle.hg $ hg debugbundle bundle.hg Stream params: {} - stream2 -- {bytecount: 1693, filecount: 11, requirements: dotencode%2Cfncache%2Cgeneraldelta%2Crevlogv1%2Csparserevlog%2Cstore} (mandatory: True) (no-zstd !) - stream2 -- {bytecount: 1693, filecount: 11, requirements: dotencode%2Cfncache%2Cgeneraldelta%2Crevlog-compression-zstd%2Crevlogv1%2Csparserevlog%2Cstore} (mandatory: True) (zstd no-rust !) - stream2 -- {bytecount: 1693, filecount: 11, requirements: dotencode%2Cfncache%2Cgeneraldelta%2Cpersistent-nodemap%2Crevlog-compression-zstd%2Crevlogv1%2Csparserevlog%2Cstore} (mandatory: True) (rust !) + stream2 -- {bytecount: 1693, filecount: 11, requirements: generaldelta%2Crevlogv1%2Csparserevlog} (mandatory: True) (no-zstd !) + stream2 -- {bytecount: 1693, filecount: 11, requirements: generaldelta%2Crevlog-compression-zstd%2Crevlogv1%2Csparserevlog} (mandatory: True) (zstd no-rust !) + stream2 -- {bytecount: 1693, filecount: 11, requirements: generaldelta%2Cpersistent-nodemap%2Crevlog-compression-zstd%2Crevlogv1%2Csparserevlog} (mandatory: True) (rust !) $ hg debugbundle --spec bundle.hg - none-v2;stream=v2;requirements%3Ddotencode%2Cfncache%2Cgeneraldelta%2Crevlogv1%2Csparserevlog%2Cstore (no-zstd !) - none-v2;stream=v2;requirements%3Ddotencode%2Cfncache%2Cgeneraldelta%2Crevlog-compression-zstd%2Crevlogv1%2Csparserevlog%2Cstore (zstd no-rust !) - none-v2;stream=v2;requirements%3Ddotencode%2Cfncache%2Cgeneraldelta%2Cpersistent-nodemap%2Crevlog-compression-zstd%2Crevlogv1%2Csparserevlog%2Cstore (rust !) + none-v2;stream=v2;requirements%3Dgeneraldelta%2Crevlogv1%2Csparserevlog (no-zstd !) + none-v2;stream=v2;requirements%3Dgeneraldelta%2Crevlog-compression-zstd%2Crevlogv1%2Csparserevlog (zstd no-rust !) + none-v2;stream=v2;requirements%3Dgeneraldelta%2Cpersistent-nodemap%2Crevlog-compression-zstd%2Crevlogv1%2Csparserevlog (rust !) Test that we can apply the bundle as a stream clone bundle diff --git a/tests/test-clone-stream.t b/tests/test-clone-stream.t --- a/tests/test-clone-stream.t +++ b/tests/test-clone-stream.t @@ -296,65 +296,65 @@ #if no-zstd no-rust $ f --size --hex --bytes 256 body - body: size=119153 + body: size=119123 : 04 6e 6f 6e 65 48 47 32 30 00 00 00 00 00 00 00 |.noneHG20...| - 0010: 80 07 53 54 52 45 41 4d 32 00 00 00 00 03 00 09 |..STREAM2...| - 0020: 06 09 04 0c 44 62 79 74 65 63 6f 75 6e 74 31 30 |Dbytecount10| + 0010: 62 07 53 54 52 45 41 4d 32 00 00 00 00 03 00 09 |b.STREAM2...| + 0020: 06 09 04 0c 26 62 79 74 65 63 6f 75 6e 74 31 30 || 0030: 34 31 31 35 66 69 6c 65 63 6f 75 6e 74 31 30 39 |4115filecount109| - 0040: 33 72 65 71 75 69 72 65 6d 65 6e 74 73 64 6f 74 |3requirementsdot| - 0050: 65 6e 63 6f 64 65 25 32 43 66 6e 63 61 63 68 65 |encode%2Cfncache| - 0060: 25 32 43 67 65 6e 65 72 61 6c 64 65 6c 74 61 25 |%2Cgeneraldelta%| - 0070: 32 43 72 65 76 6c 6f 67 76 31 25 32 43 73 70 61 |2Crevlogv1%2Cspa| - 0080: 72 73 65 72 65 76 6c 6f 67 25 32 43 73 74 6f 72 |rserevlog%2Cstor| - 0090: 65 00 00 80 00 73 08 42 64 61 74 61 2f 30 2e 69 |es.Bdata/0.i| - 00a0: 00 03 00 01 00 00 00 00 00 00 00 02 00 00 00 01 || - 00b0: 00 00 00 00 00 00 00 01 ff ff ff ff ff ff ff ff || - 00c0: 80 29 63 a0 49 d3 23 87 bf ce fe 56 67 92 67 2c |.)c.I.#Vg.g,| - 00d0: 69 d1 ec 39 00 00 00 00 00 00 00 00 00 00 00 00 |i..9| - 00e0: 75 30 73 26 45 64 61 74 61 2f 30 30 63 68 61 6e |u0s/00chan| - 00f0: 67 65 6c 6f 67 2d 61 62 33 34 39 31 38 30 61 30 |gelog-ab349180a0| + 0040: 33 72 65 71 75 69 72 65 6d 65 6e 74 73 67 65 6e |3requirementsgen| + 0050: 65 72 61 6c 64 65 6c 74 61 25 32 43 72 65 76 6c |eraldelta%2Crevl| + 0060: 6f 67 76 31 25 32 43 73 70 61 72 73 65 72 65 76 |ogv1%2Csparserev| + 0070: 6c 6f 67 00 00 80 00 73 08 42 64 61 74 61 2f 30 |logs.Bdata/0| + 0080: 2e 69 00 03 00
D12080: stream-requirements: smoother matching in test-ssh-proto.t
marmoute created this revision. Herald added a reviewer: hg-reviewers. Herald added a subscriber: mercurial-patches. REVISION SUMMARY The value of `streamreqs` changes depending of the format used, but this is not relevant for this tests. So we doing a smarter matching of the line to avoid this test interfering with format changes in the future. REPOSITORY rHG Mercurial BRANCH default REVISION DETAIL https://phab.mercurial-scm.org/D12080 AFFECTED FILES tests/test-ssh-proto.t tests/test-ssh.t CHANGE DETAILS diff --git a/tests/test-ssh.t b/tests/test-ssh.t --- a/tests/test-ssh.t +++ b/tests/test-ssh.t @@ -531,10 +531,8 @@ devel-peer-request: pairs: 81 bytes sending hello command sending between command - remote: 444 (no-rust !) - remote: 463 (rust !) - remote: capabilities: batch branchmap $USUAL_BUNDLE2_CAPS$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=generaldelta,revlogv1,sparserevlog unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash (no-rust !) - remote: capabilities: batch branchmap $USUAL_BUNDLE2_CAPS$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=generaldelta,persistent-nodemap,revlogv1,sparserevlog unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash (rust !) + remote: \d+ (re) + remote: capabilities: batch branchmap \$USUAL_BUNDLE2_CAPS\$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=[^ ,]+(,[^ ,]+)* unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash (re) remote: 1 devel-peer-request: protocaps devel-peer-request: caps: * bytes (glob) 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 @@ -55,8 +55,8 @@ devel-peer-request: pairs: 81 bytes sending hello command sending between command - remote: 444 - remote: capabilities: batch branchmap $USUAL_BUNDLE2_CAPS$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=generaldelta,revlogv1,sparserevlog unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash + remote: \d+ (re) + remote: capabilities: batch branchmap \$USUAL_BUNDLE2_CAPS\$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=[^ ,]+(,[^ ,]+)* unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash (re) remote: 1 devel-peer-request: protocaps devel-peer-request: caps: * bytes (glob) @@ -77,9 +77,9 @@ i> write(6) -> 6: i> hello\n o> readline() -> 4: - o> 444\n - o> readline() -> 444: - o> capabilities: batch branchmap $USUAL_BUNDLE2_CAPS$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=generaldelta,revlogv1,sparserevlog unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash\n + o> \d+\\n (re) + o> readline\(\) -> \d+: (re) + o> capabilities: batch branchmap \$USUAL_BUNDLE2_CAPS\$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=[^ ,]+(,[^ ,]+)* unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash\\n (re) `hg debugserve --sshstdio` works @@ -87,8 +87,8 @@ $ hg debugserve --sshstdio << EOF > hello > EOF - 444 - capabilities: batch branchmap $USUAL_BUNDLE2_CAPS$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=generaldelta,revlogv1,sparserevlog unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash + \d+ (re) + capabilities: batch branchmap \$USUAL_BUNDLE2_CAPS\$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=[^ ,]+(,[^ ,]+)* unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash (re) I/O logging works @@ -97,25 +97,25 @@ > EOF e> flush() -> None o> write(4) -> 4: - o> 444\n - o> write(444) -> 444: - o> capabilities: batch branchmap $USUAL_BUNDLE2_CAPS$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=generaldelta,revlogv1,sparserevlog unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash\n - 444 - capabilities: batch branchmap $USUAL_BUNDLE2_CAPS$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=generaldelta,revlogv1,sparserevlog unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash + o> \d+\\n (re) + o> write\(\d+\) -> \d+: (re) + o> capabilities: batch branchmap \$USUAL_BUNDLE2_CAPS\$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=[^ ,]+(,[^ ,]+)* unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash\\n (re) + \d+ (re) + capabilities: batch branchmap \$USUAL_BUNDLE2_CAPS\$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=[^ ,]+(,[^ ,]+)* unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash (re) o> flush() -> None $ hg debugserve --sshstdio --logiofile $TESTTMP/io << EOF > hello > EOF - 444 - capabilities: batch branchmap $USUAL_BUNDLE2_CAPS$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=generaldelta,revlogv1,sparserevlog unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash + \d+ (re) + capabilities: batch branchmap \$USUAL_BUNDLE2_CAPS\$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=[^ ,]+(,[^ ,]+)* unbundle=HG10GZ,HG10BZ,HG10UN
D12082: stream-requirements: smoother matching in test-http-protocol.t
marmoute created this revision. Herald added a reviewer: hg-reviewers. Herald added a subscriber: mercurial-patches. REVISION SUMMARY The value of `streamreqs` changes depending of the format used, but this is not relevant for this tests. So we doing a smarter matching of the line to avoid this test interfering with format changes in the future. REPOSITORY rHG Mercurial BRANCH default REVISION DETAIL https://phab.mercurial-scm.org/D12082 AFFECTED FILES tests/test-http-protocol.t CHANGE DETAILS diff --git a/tests/test-http-protocol.t b/tests/test-http-protocol.t --- a/tests/test-http-protocol.t +++ b/tests/test-http-protocol.t @@ -198,7 +198,7 @@ s> Content-Type: application/mercurial-0.1\r\n s> Content-Length: *\r\n (glob) s> \r\n - s> batch branchmap $USUAL_BUNDLE2_CAPS$ changegroupsubset compression=$BUNDLE2_COMPRESSIONS$ getbundle httpheader=1024 httpmediatype=0.1rx,0.1tx,0.2tx known lookup pushkey streamreqs=generaldelta,revlogv1,sparserevlog unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash + s> batch branchmap \$USUAL_BUNDLE2_CAPS\$ changegroupsubset compression=\$BUNDLE2_COMPRESSIONS\$ getbundle httpheader=1024 httpmediatype=0.1rx,0.1tx,0.2tx known lookup pushkey streamreqs=[^ ,]+(,[^ ,]+)* unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash (re) sending listkeys command s> setsockopt(6, 1, 1) -> None (?) s> GET /?cmd=listkeys HTTP/1.1\r\n @@ -327,9 +327,9 @@ s> Server: testing stub value\r\n s> Date: $HTTP_DATE$\r\n s> Content-Type: application/mercurial-0.1\r\n - s> Content-Length: 484\r\n + s> Content-Length: \d+\\r\\n (re) s> \r\n - s> batch branchmap $USUAL_BUNDLE2_CAPS$ changegroupsubset compression=$BUNDLE2_COMPRESSIONS$ getbundle httpheader=1024 httpmediatype=0.1rx,0.1tx,0.2tx known lookup pushkey streamreqs=generaldelta,revlogv1,sparserevlog unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash + s> batch branchmap \$USUAL_BUNDLE2_CAPS\$ changegroupsubset compression=\$BUNDLE2_COMPRESSIONS\$ getbundle httpheader=1024 httpmediatype=0.1rx,0.1tx,0.2tx known lookup pushkey streamreqs=[^ ,]+(,[^ ,]+)* unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash (re) Test with the HTTP peer @@ -364,10 +364,10 @@ s> Server: testing stub value\r\n s> Date: $HTTP_DATE$\r\n s> Content-Type: application/mercurial-0.1\r\n - s> Content-Length: 484\r\n + s> Content-Length: \d+\\r\\n (re) s> \r\n real URL is http://$LOCALIP:$HGPORT/redirected (glob) - s> batch branchmap $USUAL_BUNDLE2_CAPS$ changegroupsubset compression=$BUNDLE2_COMPRESSIONS$ getbundle httpheader=1024 httpmediatype=0.1rx,0.1tx,0.2tx known lookup pushkey streamreqs=generaldelta,revlogv1,sparserevlog unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash + s> batch branchmap \$USUAL_BUNDLE2_CAPS\$ changegroupsubset compression=\$BUNDLE2_COMPRESSIONS\$ getbundle httpheader=1024 httpmediatype=0.1rx,0.1tx,0.2tx known lookup pushkey streamreqs=[^ ,]+(,[^ ,]+)* unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash (re) sending heads command s> setsockopt(6, 1, 1) -> None (?) s> GET /redirected?cmd=heads HTTP/1.1\r\n @@ -635,10 +635,10 @@ s> Server: testing stub value\r\n s> Date: $HTTP_DATE$\r\n s> Content-Type: application/mercurial-0.1\r\n - s> Content-Length: 484\r\n + s> Content-Length: \d+\\r\\n (re) s> \r\n real URL is http://$LOCALIP:$HGPORT/redirected (glob) - s> batch branchmap $USUAL_BUNDLE2_CAPS$ changegroupsubset compression=$BUNDLE2_COMPRESSIONS$ getbundle httpheader=1024 httpmediatype=0.1rx,0.1tx,0.2tx known lookup pushkey streamreqs=generaldelta,revlogv1,sparserevlog unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash + s> batch branchmap \$USUAL_BUNDLE2_CAPS\$ changegroupsubset compression=\$BUNDLE2_COMPRESSIONS\$ getbundle httpheader=1024 httpmediatype=0.1rx,0.1tx,0.2tx known lookup pushkey streamreqs=[^ ,]+(,[^ ,]+)* unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash (re) sending heads command s> setsockopt(6, 1, 1) -> None (?) s> GET /redirected?cmd=heads HTTP/1.1\r\n To: marmoute, #hg-reviewers Cc: mercurial-patches, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D12081: stream-requirements: smoother matching in test-ssh-bundle1.t
marmoute created this revision. Herald added a reviewer: hg-reviewers. Herald added a subscriber: mercurial-patches. REVISION SUMMARY The value of `streamreqs` changes depending of the format used, but this is not relevant for this tests. So we doing a smarter matching of the line to avoid this test interfering with format changes in the future. REPOSITORY rHG Mercurial BRANCH default REVISION DETAIL https://phab.mercurial-scm.org/D12081 AFFECTED FILES tests/test-ssh-bundle1.t CHANGE DETAILS diff --git a/tests/test-ssh-bundle1.t b/tests/test-ssh-bundle1.t --- a/tests/test-ssh-bundle1.t +++ b/tests/test-ssh-bundle1.t @@ -475,10 +475,8 @@ running .* ".*[/\\]dummyssh" ['"]user@dummy['"] ['"]hg -R remote serve --stdio['"] (re) sending hello command sending between command - remote: 444 (no-rust !) - remote: 463 (rust !) - remote: capabilities: batch branchmap $USUAL_BUNDLE2_CAPS$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=generaldelta,revlogv1,sparserevlog unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash (no-rust !) - remote: capabilities: batch branchmap $USUAL_BUNDLE2_CAPS$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=generaldelta,persistent-nodemap,revlogv1,sparserevlog unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash (rust !) + remote: \d+ (re) + remote: capabilities: batch branchmap \$USUAL_BUNDLE2_CAPS\$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=[^ ,]+(,[^ ,]+)* unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash (re) remote: 1 sending protocaps command preparing listkeys for "bookmarks" To: marmoute, #hg-reviewers Cc: mercurial-patches, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D12079: stream-requirements: smoother matching in test-hgweb-commands.t
marmoute created this revision. Herald added a reviewer: hg-reviewers. Herald added a subscriber: mercurial-patches. REVISION SUMMARY The value of `streamreqs` changes depending of the format used, but this is not relevant for this tests. So we doing a smarter matching of the line to avoid this test interfering with format changes in the future. REPOSITORY rHG Mercurial BRANCH default REVISION DETAIL https://phab.mercurial-scm.org/D12079 AFFECTED FILES tests/test-hgweb-commands.t CHANGE DETAILS diff --git a/tests/test-hgweb-commands.t b/tests/test-hgweb-commands.t --- a/tests/test-hgweb-commands.t +++ b/tests/test-hgweb-commands.t @@ -2193,8 +2193,7 @@ lookup pushkey stream-preferred - streamreqs=generaldelta,revlogv1,sparserevlog (no-rust !) - streamreqs=generaldelta,persistent-nodemap,revlogv1,sparserevlog (rust !) + streamreqs=*,* (glob) unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash To: marmoute, #hg-reviewers Cc: mercurial-patches, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D12078: stream-requirements: smoother matching in test-treemanifest.t
marmoute created this revision. Herald added a reviewer: hg-reviewers. Herald added a subscriber: mercurial-patches. REVISION SUMMARY The value of `streamreqs` changes depending of the format used, but this is not relevant for this tests. So we doing a smarter matching of the line to avoid this test interfering with format changes in the future. REPOSITORY rHG Mercurial BRANCH default REVISION DETAIL https://phab.mercurial-scm.org/D12078 AFFECTED FILES tests/test-treemanifest.t CHANGE DETAILS diff --git a/tests/test-treemanifest.t b/tests/test-treemanifest.t --- a/tests/test-treemanifest.t +++ b/tests/test-treemanifest.t @@ -829,11 +829,9 @@ $ hg -R deeprepo debugcreatestreamclonebundle repo-packed.hg writing 5330 bytes for 18 files (no-zstd !) writing 5400 bytes for 18 files (zstd !) - bundle requirements: generaldelta, revlogv1, sparserevlog, treemanifest (no-rust !) - bundle requirements: generaldelta, persistent-nodemap, revlogv1, sparserevlog, treemanifest (rust !) + bundle requirements:.* treemanifest(,.*)? (re) $ hg debugbundle --spec repo-packed.hg - none-packed1;requirements%3Dgeneraldelta%2Crevlogv1%2Csparserevlog%2Ctreemanifest (no-rust !) - none-packed1;requirements%3Dgeneraldelta%2Cpersistent-nodemap%2Crevlogv1%2Csparserevlog%2Ctreemanifest (rust !) + none-packed1;requirements%3D(.*%2C)?treemanifest(%2C.*)? (re) #endif To: marmoute, #hg-reviewers Cc: mercurial-patches, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D12077: stream-requirements: smoother matching in test-ssh-proto-unbundle.t
marmoute created this revision. Herald added a reviewer: hg-reviewers. Herald added a subscriber: mercurial-patches. REVISION SUMMARY The value of `streamreqs` changes depending of the format used, but this is not relevant for this tests. So we doing a smarter matching of the line to avoid this test interfering with format changes in the future. REPOSITORY rHG Mercurial BRANCH default REVISION DETAIL https://phab.mercurial-scm.org/D12077 AFFECTED FILES tests/test-ssh-proto-unbundle.t CHANGE DETAILS diff --git a/tests/test-ssh-proto-unbundle.t b/tests/test-ssh-proto-unbundle.t --- a/tests/test-ssh-proto-unbundle.t +++ b/tests/test-ssh-proto-unbundle.t @@ -50,9 +50,9 @@ i> - i> flush() -> None o> readline() -> 4: - o> 444\n - o> readline() -> 444: - o> capabilities: batch branchmap $USUAL_BUNDLE2_CAPS$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=generaldelta,revlogv1,sparserevlog unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash\n + o> \d+\\n (re) + o> readline\(\) -> \d+: (re) + o> capabilities: batch branchmap \$USUAL_BUNDLE2_CAPS\$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=[^ ,]+(,[^ ,]+)* unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash\\n (re) o> readline() -> 2: o> 1\n o> readline() -> 1: @@ -179,9 +179,9 @@ i> - i> flush() -> None o> readline() -> 4: - o> 444\n - o> readline() -> 444: - o> capabilities: batch branchmap $USUAL_BUNDLE2_CAPS$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=generaldelta,revlogv1,sparserevlog unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash\n + o> \d+\\n (re) + o> readline\(\) -> \d+: (re) + o> capabilities: batch branchmap \$USUAL_BUNDLE2_CAPS\$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=[^ ,]+(,[^ ,]+)* unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash\\n (re) o> readline() -> 2: o> 1\n o> readline() -> 1: @@ -247,10 +247,10 @@ i> pairs 81\n i> - i> flush() -> None - o> readline() -> 4: - o> 444\n - o> readline() -> 444: - o> capabilities: batch branchmap $USUAL_BUNDLE2_CAPS$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=generaldelta,revlogv1,sparserevlog unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash\n + o> readline\(\) -> \d+: (re) + o> \d+\\n (re) + o> readline\(\) -> \d+: (re) + o> capabilities: batch branchmap \$USUAL_BUNDLE2_CAPS\$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=[^ ,]+(,[^ ,]+)* unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash\\n (re) o> readline() -> 2: o> 1\n o> readline() -> 1: @@ -318,9 +318,9 @@ i> - i> flush() -> None o> readline() -> 4: - o> 444\n - o> readline() -> 444: - o> capabilities: batch branchmap $USUAL_BUNDLE2_CAPS$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=generaldelta,revlogv1,sparserevlog unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash\n + o> \d+\\n (re) + o> readline\(\) -> \d+: (re) + o> capabilities: batch branchmap \$USUAL_BUNDLE2_CAPS\$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=[^ ,]+(,[^ ,]+)* unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash\\n (re) o> readline() -> 2: o> 1\n o> readline() -> 1: @@ -387,9 +387,9 @@ i> - i> flush() -> None o> readline() -> 4: - o> 444\n - o> readline() -> 444: - o> capabilities: batch branchmap $USUAL_BUNDLE2_CAPS$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=generaldelta,revlogv1,sparserevlog unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash\n + o> \d+\\n (re) + o> readline\(\) -> \d+: (re) + o> capabilities: batch branchmap \$USUAL_BUNDLE2_CAPS\$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=[^ ,]+(,[^ ,]+)* unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash\\n (re) o> readline() -> 2: o> 1\n o> readline() -> 1: @@ -457,9 +457,9 @@ i> - i> flush() -> None o> readline() -> 4: - o> 444\n - o> readline() -> 444: - o> capabilities: batch branchmap $USUAL_BUNDLE2_CAPS$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=generaldelta,revlogv1,sparserevlog unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash\n + o> \d+\\n (re) + o> readline\(\) -> \d+: (re) + o> capabilities: batch branchmap \$USUAL_BUNDLE2_CAPS\$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=[^ ,]+(,[^
D12074: test-http-bad-server: abstract the `streamreqs` value
marmoute created this revision. Herald added a reviewer: hg-reviewers. Herald added a subscriber: mercurial-patches. REVISION SUMMARY Now that socket closing are decided much closer to the actual closure, we can use fuzzy matching for this part of the exchange that changes on a regular basis. This should make fixing bug in stream requirements and enabling new format much simpler. REPOSITORY rHG Mercurial BRANCH default REVISION DETAIL https://phab.mercurial-scm.org/D12074 AFFECTED FILES tests/test-http-bad-server.t CHANGE DETAILS diff --git a/tests/test-http-bad-server.t b/tests/test-http-bad-server.t --- a/tests/test-http-bad-server.t +++ b/tests/test-http-bad-server.t @@ -130,17 +130,17 @@ readline(*) -> (*) host: localhost:$HGPORT\r\n (glob) readline(*) -> (49) user-agent: mercurial/proto-1.0 (Mercurial 4.2)\r\n (glob) readline(*) -> (2) \r\n (glob) - sendall(160) -> HTTP/1.1 200 Script output follows\r\nServer: badhttpserver\r\nDate: $HTTP_DATE$\r\nContent-Type: application/mercurial-0.1\r\nContent-Length: 431\r\n\r\n (py36 !) - sendall(431) -> batch branchmap $USUAL_BUNDLE2_CAPS_NO_PHASES$ changegroupsubset compression=none getbundle httpheader=1024 httpmediatype=0.1rx,0.1tx,0.2tx known lookup pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash (py36 !) - write(160) -> HTTP/1.1 200 Script output follows\r\nServer: badhttpserver\r\nDate: $HTTP_DATE$\r\nContent-Type: application/mercurial-0.1\r\nContent-Length: 431\r\n\r\n (py3 no-py36 !) - write(431) -> batch branchmap $USUAL_BUNDLE2_CAPS_NO_PHASES$ changegroupsubset compression=none getbundle httpheader=1024 httpmediatype=0.1rx,0.1tx,0.2tx known lookup pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash (py3 no-py36 !) + sendall(160) -> HTTP/1.1 200 Script output follows\r\nServer: badhttpserver\r\nDate: $HTTP_DATE$\r\nContent-Type: application/mercurial-0.1\r\nContent-Length: *\r\n\r\n (glob) (py36 !) + sendall(*) -> batch branchmap $USUAL_BUNDLE2_CAPS_NO_PHASES$ changegroupsubset compression=none getbundle httpheader=1024 httpmediatype=0.1rx,0.1tx,0.2tx known lookup pushkey streamreqs=* unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash (glob) (py36 !) + write(160) -> HTTP/1.1 200 Script output follows\r\nServer: badhttpserver\r\nDate: $HTTP_DATE$\r\nContent-Type: application/mercurial-0.1\r\nContent-Length: *\r\n\r\n (glob) (py3 no-py36 !) + write(*) -> batch branchmap $USUAL_BUNDLE2_CAPS_NO_PHASES$ changegroupsubset compression=none getbundle httpheader=1024 httpmediatype=0.1rx,0.1tx,0.2tx known lookup pushkey streamreqs=* unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash (glob) (py3 no-py36 !) write(36) -> HTTP/1.1 200 Script output follows\r\n (no-py3 !) write(23) -> Server: badhttpserver\r\n (no-py3 !) write(37) -> Date: $HTTP_DATE$\r\n (no-py3 !) write(41) -> Content-Type: application/mercurial-0.1\r\n (no-py3 !) - write(21) -> Content-Length: 431\r\n (no-py3 !) + write(21) -> Content-Length: *\r\n (glob) (no-py3 !) write(2) -> \r\n (no-py3 !) - write(431) -> batch branchmap $USUAL_BUNDLE2_CAPS_NO_PHASES$ changegroupsubset compression=none getbundle httpheader=1024 httpmediatype=0.1rx,0.1tx,0.2tx known lookup pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash (no-py3 !) + write(*) -> batch branchmap $USUAL_BUNDLE2_CAPS_NO_PHASES$ changegroupsubset compression=none getbundle httpheader=1024 httpmediatype=0.1rx,0.1tx,0.2tx known lookup pushkey streamreqs=* unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash (glob) (no-py3 !) readline(~) -> (26) GET /?cmd=batch HTTP/1.1\r\n (glob) readline(*) -> (1?) Accept-Encoding* (glob) read limit reached; closing socket @@ -179,17 +179,17 @@ readline(*) -> (*) host: localhost:$HGPORT\r\n (glob) readline(*) -> (49) user-agent: mercurial/proto-1.0 (Mercurial 4.2)\r\n (glob) readline(*) -> (2) \r\n (glob) - sendall(160) -> HTTP/1.1 200 Script output follows\r\nServer: badhttpserver\r\nDate: $HTTP_DATE$\r\nContent-Type: application/mercurial-0.1\r\nContent-Length: 431\r\n\r\n (py36 !) - sendall(431) -> batch branchmap $USUAL_BUNDLE2_CAPS_NO_PHASES$ changegroupsubset compression=none getbundle httpheader=1024 httpmediatype=0.1rx,0.1tx,0.2tx known lookup pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash (py36 !) - write(160) -> HTTP/1.1 200 Script output follows\r\nServer: badhttpserver\r\nDate: $HTTP_DATE$\r\nContent-Type: application/mercurial-0.1\r\nContent-Length: 431\r\n\r\n (py3 no-py36 !) - write(431) -> batch branchmap $USUAL_BUNDLE2_CAPS_NO_PHASES$ changegroupsubset compression=none getbundle httpheader=1024 httpmediatype=0.1rx,0.1tx,0.2tx known lookup pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash (py3 no-py36 !) + sendall(160) -> HTTP/1.1 200 Script output follows\r\nServer: badhttpserver\r\nDate: $HTTP_DATE$\r\nContent-Type:
D12076: test-bundle: split some variant in there own section
marmoute created this revision. Herald added a reviewer: hg-reviewers. Herald added a subscriber: mercurial-patches. REVISION SUMMARY Same rational as the previous commit about test-bundle.t. These line are quite volatile and having dedicated block will make their update clearer and simpler. REPOSITORY rHG Mercurial BRANCH default REVISION DETAIL https://phab.mercurial-scm.org/D12076 AFFECTED FILES tests/test-debugcommands.t CHANGE DETAILS diff --git a/tests/test-debugcommands.t b/tests/test-debugcommands.t --- a/tests/test-debugcommands.t +++ b/tests/test-debugcommands.t @@ -649,16 +649,16 @@ local: no pushable: yes +#if rust + $ hg --debug debugpeer ssh://user@dummy/debugrevlog running .* ".*[/\\]dummyssh" ['"]user@dummy['"] ['"]hg -R debugrevlog serve --stdio['"] (re) devel-peer-request: hello+between devel-peer-request: pairs: 81 bytes sending hello command sending between command - remote: 444 (no-rust !) - remote: 463 (rust !) - remote: capabilities: batch branchmap $USUAL_BUNDLE2_CAPS$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=generaldelta,revlogv1,sparserevlog unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash (no-rust !) - remote: capabilities: batch branchmap $USUAL_BUNDLE2_CAPS$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=generaldelta,persistent-nodemap,revlogv1,sparserevlog unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash (rust !) + remote: 463 + remote: capabilities: batch branchmap $USUAL_BUNDLE2_CAPS$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=generaldelta,persistent-nodemap,revlogv1,sparserevlog unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash remote: 1 devel-peer-request: protocaps devel-peer-request: caps: * bytes (glob) @@ -666,3 +666,45 @@ url: ssh://user@dummy/debugrevlog local: no pushable: yes + +#endif + +#if no-rust zstd + + $ hg --debug debugpeer ssh://user@dummy/debugrevlog + running .* ".*[/\\]dummyssh" ['"]user@dummy['"] ['"]hg -R debugrevlog serve --stdio['"] (re) + devel-peer-request: hello+between + devel-peer-request: pairs: 81 bytes + sending hello command + sending between command + remote: 444 + remote: capabilities: batch branchmap $USUAL_BUNDLE2_CAPS$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=generaldelta,revlogv1,sparserevlog unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash + remote: 1 + devel-peer-request: protocaps + devel-peer-request: caps: * bytes (glob) + sending protocaps command + url: ssh://user@dummy/debugrevlog + local: no + pushable: yes + +#endif + +#if no-rust no-zstd + + $ hg --debug debugpeer ssh://user@dummy/debugrevlog + running .* ".*[/\\]dummyssh" ['"]user@dummy['"] ['"]hg -R debugrevlog serve --stdio['"] (re) + devel-peer-request: hello+between + devel-peer-request: pairs: 81 bytes + sending hello command + sending between command + remote: 444 + remote: capabilities: batch branchmap $USUAL_BUNDLE2_CAPS$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=generaldelta,revlogv1,sparserevlog unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash + remote: 1 + devel-peer-request: protocaps + devel-peer-request: caps: * bytes (glob) + sending protocaps command + url: ssh://user@dummy/debugrevlog + local: no + pushable: yes + +#endif To: marmoute, #hg-reviewers Cc: mercurial-patches, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D12075: test-bundle: split each variant in there own section
marmoute created this revision. Herald added a reviewer: hg-reviewers. Herald added a subscriber: mercurial-patches. REVISION SUMMARY Having conditional line matching for this kind of big block is quite inconvenient to update. The new way should be simpler to maintain. REPOSITORY rHG Mercurial BRANCH default REVISION DETAIL https://phab.mercurial-scm.org/D12075 AFFECTED FILES tests/test-bundle.t CHANGE DETAILS diff --git a/tests/test-bundle.t b/tests/test-bundle.t --- a/tests/test-bundle.t +++ b/tests/test-bundle.t @@ -292,32 +292,56 @@ packed1 is produced properly -#if reporevlogstore + +#if reporevlogstore rust $ hg -R test debugcreatestreamclonebundle packed.hg - writing 2664 bytes for 6 files (no-zstd !) - writing 2665 bytes for 6 files (zstd !) - bundle requirements: generaldelta, revlogv1, sparserevlog (no-rust !) - bundle requirements: generaldelta, persistent-nodemap, revlogv1, sparserevlog (rust !) + writing 2665 bytes for 6 files + bundle requirements: generaldelta, persistent-nodemap, revlogv1, sparserevlog + + $ f -B 64 --size --sha1 --hexdump packed.hg + packed.hg: size=2860, sha1=81d7a2e535892cda51e82c200f818de2cca828d3 + : 48 47 53 31 55 4e 00 00 00 00 00 00 00 06 00 00 |HGS1UN..| + 0010: 00 00 00 00 0a 69 00 36 67 65 6e 65 72 61 6c 64 |.i.6generald| + 0020: 65 6c 74 61 2c 70 65 72 73 69 73 74 65 6e 74 2d |elta,persistent-| + 0030: 6e 6f 64 65 6d 61 70 2c 72 65 76 6c 6f 67 76 31 |nodemap,revlogv1| + $ hg debugbundle --spec packed.hg + none-packed1;requirements%3Dgeneraldelta%2Cpersistent-nodemap%2Crevlogv1%2Csparserevlog +#endif + +#if reporevlogstore no-rust zstd + + $ hg -R test debugcreatestreamclonebundle packed.hg + writing 2665 bytes for 6 files + bundle requirements: generaldelta, revlogv1, sparserevlog $ f -B 64 --size --sha1 --hexdump packed.hg - packed.hg: size=2840, sha1=12bf3eee3eb8a04c503ce2d29b48f0135c7edff5 (no-zstd !) - packed.hg: size=2841, sha1=8b645a65f49b0ae43042a9f3da56d4bfdf1c7f99 (zstd no-rust !) - packed.hg: size=2860, sha1=81d7a2e535892cda51e82c200f818de2cca828d3 (rust !) + packed.hg: size=2841, sha1=8b645a65f49b0ae43042a9f3da56d4bfdf1c7f99 : 48 47 53 31 55 4e 00 00 00 00 00 00 00 06 00 00 |HGS1UN..| - 0010: 00 00 00 00 0a 68 00 23 67 65 6e 65 72 61 6c 64 |.h.#generald| (no-zstd !) - 0020: 65 6c 74 61 2c 72 65 76 6c 6f 67 76 31 2c 73 70 |elta,revlogv1,sp| (no-zstd !) - 0030: 61 72 73 65 72 65 76 6c 6f 67 00 64 61 74 61 2f |arserevlog.data/| (no-zstd !) - 0010: 00 00 00 00 0a 69 00 23 67 65 6e 65 72 61 6c 64 |.i.#generald| (zstd no-rust !) - 0020: 65 6c 74 61 2c 72 65 76 6c 6f 67 76 31 2c 73 70 |elta,revlogv1,sp| (zstd no-rust !) - 0030: 61 72 73 65 72 65 76 6c 6f 67 00 64 61 74 61 2f |arserevlog.data/| (zstd no-rust !) - 0010: 00 00 00 00 0a 69 00 36 67 65 6e 65 72 61 6c 64 |.i.6generald| (rust !) - 0020: 65 6c 74 61 2c 70 65 72 73 69 73 74 65 6e 74 2d |elta,persistent-| (rust !) - 0030: 6e 6f 64 65 6d 61 70 2c 72 65 76 6c 6f 67 76 31 |nodemap,revlogv1| (rust !) + 0010: 00 00 00 00 0a 69 00 23 67 65 6e 65 72 61 6c 64 |.i.#generald| + 0020: 65 6c 74 61 2c 72 65 76 6c 6f 67 76 31 2c 73 70 |elta,revlogv1,sp| + 0030: 61 72 73 65 72 65 76 6c 6f 67 00 64 61 74 61 2f |arserevlog.data/| + $ hg debugbundle --spec packed.hg + none-packed1;requirements%3Dgeneraldelta%2Crevlogv1%2Csparserevlog +#endif + +#if reporevlogstore no-rust no-zstd + $ hg -R test debugcreatestreamclonebundle packed.hg + writing 2664 bytes for 6 files + bundle requirements: generaldelta, revlogv1, sparserevlog + + $ f -B 64 --size --sha1 --hexdump packed.hg + packed.hg: size=2840, sha1=12bf3eee3eb8a04c503ce2d29b48f0135c7edff5 + : 48 47 53 31 55 4e 00 00 00 00 00 00 00 06 00 00 |HGS1UN..| + 0010: 00 00 00 00 0a 68 00 23 67 65 6e 65 72 61 6c 64 |.h.#generald| + 0020: 65 6c 74 61 2c 72 65 76 6c 6f 67 76 31 2c 73 70 |elta,revlogv1,sp| + 0030: 61 72 73 65 72 65 76 6c 6f 67 00 64 61 74 61 2f |arserevlog.data/| $ hg debugbundle --spec packed.hg - none-packed1;requirements%3Dgeneraldelta%2Crevlogv1%2Csparserevlog (no-rust !) - none-packed1;requirements%3Dgeneraldelta%2Cpersistent-nodemap%2Crevlogv1%2Csparserevlog (rust !) + none-packed1;requirements%3Dgeneraldelta%2Crevlogv1%2Csparserevlog +#endif + +#if reporevlogstore generaldelta requirement is not listed in stream clone bundles unless used @@ -326,25 +350,66 @@ $ touch foo $ hg -q commit -A -m initial $ cd .. + +#endif + +#if reporevlogstore rust + $ hg -R testnongd debugcreatestreamclonebundle packednongd.hg writing 301 bytes for 3 files - bundle requirements: revlogv1 (no-rust !) - bundle requirements: persistent-nodemap, revlogv1 (rust !) + bundle requirements: persistent-nodemap, revlogv1 + + $ f -B 64 --size --sha1 --hexdump packednongd.hg + packednongd.hg: size=402, sha1=d3cc1417f0e8142cf9340520b660ad3ec3ea + : 48 47 53 31 55 4e 00 00 00 00 00 00 00 03 00
D12073: test-http-bad-server: use the new pattern-reading for a test-case
marmoute created this revision. Herald added a reviewer: hg-reviewers. Herald added a subscriber: mercurial-patches. REVISION SUMMARY This test case is now less sensitive to change of unrelated bits of the client/server exchange. Since this introduce some churn in the output, we do it independently for each test cases. This patch is the last of such changes, for both sent and recv cases. REPOSITORY rHG Mercurial BRANCH default REVISION DETAIL https://phab.mercurial-scm.org/D12073 AFFECTED FILES tests/test-http-bad-server.t CHANGE DETAILS diff --git a/tests/test-http-bad-server.t b/tests/test-http-bad-server.t --- a/tests/test-http-bad-server.t +++ b/tests/test-http-bad-server.t @@ -229,7 +229,11 @@ Now do a variation using POST to send arguments === - $ hg serve --config experimental.httppostargs=true --config badserver.close-after-recv-bytes=329,344 -p $HGPORT -d --pid-file=hg.pid -E error.log + $ hg serve \ + > --config badserver.close-after-recv-patterns="x-hgargs-post:,user-agent: mercurial/proto-1.0" \ + > --config badserver.close-after-recv-bytes="14,26" \ + > --config experimental.httppostargs=true \ + > -p $HGPORT -d --pid-file=hg.pid -E error.log $ cat hg.pid > $DAEMON_PIDS $ hg clone http://localhost:$HGPORT/ clone @@ -239,12 +243,12 @@ $ killdaemons.py $DAEMON_PIDS $ cat error.log | "$PYTHON" $TESTDIR/filtertraceback.py - readline(329 from ~) -> (33) GET /?cmd=capabilities HTTP/1.1\r\n - readline(296 from *) -> (27) Accept-Encoding: identity\r\n (glob) - readline(269 from *) -> (35) accept: application/mercurial-0.1\r\n (glob) - readline(234 from *) -> (2?) host: localhost:$HGPORT\r\n (glob) - readline(* from *) -> (49) user-agent: mercurial/proto-1.0 (Mercurial 4.2)\r\n (glob) - readline(* from *) -> (2) \r\n (glob) + readline(~) -> (33) GET /?cmd=capabilities HTTP/1.1\r\n + readline(*) -> (27) Accept-Encoding: identity\r\n (glob) + readline(*) -> (35) accept: application/mercurial-0.1\r\n (glob) + readline(*) -> (2?) host: localhost:$HGPORT\r\n (glob) + readline(*) -> (49) user-agent: mercurial/proto-1.0 (Mercurial 4.2)\r\n (glob) + readline(*) -> (2) \r\n (glob) sendall(160) -> HTTP/1.1 200 Script output follows\r\nServer: badhttpserver\r\nDate: $HTTP_DATE$\r\nContent-Type: application/mercurial-0.1\r\nContent-Length: 444\r\n\r\n (py36 !) sendall(444) -> batch branchmap $USUAL_BUNDLE2_CAPS_NO_PHASES$ changegroupsubset compression=none getbundle httpheader=1024 httpmediatype=0.1rx,0.1tx,0.2tx httppostargs known lookup pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash (py36 !) write(160) -> HTTP/1.1 200 Script output follows\r\nServer: badhttpserver\r\nDate: $HTTP_DATE$\r\nContent-Type: application/mercurial-0.1\r\nContent-Length: 444\r\n\r\n (py3 no-py36 !) @@ -256,25 +260,25 @@ write(21) -> Content-Length: 444\r\n (no-py3 !) write(2) -> \r\n (no-py3 !) write(444) -> batch branchmap $USUAL_BUNDLE2_CAPS_NO_PHASES$ changegroupsubset compression=none getbundle httpheader=1024 httpmediatype=0.1rx,0.1tx,0.2tx httppostargs known lookup pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash (no-py3 !) - readline(1?? from ~) -> (27) POST /?cmd=batch HTTP/1.1\r\n (glob) - readline(1?? from *) -> (27) Accept-Encoding: identity\r\n (glob) - readline(1?? from *) -> (41) content-type: application/mercurial-0.1\r\n (glob) - readline(6? from *) -> (33) vary: X-HgArgs-Post,X-HgProto-1\r\n (glob) - readline(3? from *) -> (19) x-hgargs-post: 28\r\n (glob) - readline(1? from *) -> (1?) x-hgproto-1: * (glob) + readline(~) -> (27) POST /?cmd=batch HTTP/1.1\r\n (glob) + readline(*) -> (27) Accept-Encoding: identity\r\n (glob) + readline(*) -> (41) content-type: application/mercurial-0.1\r\n (glob) + readline(*) -> (33) vary: X-HgArgs-Post,X-HgProto-1\r\n (glob) + readline(*) -> (19) x-hgargs-post: 28\r\n (glob) + readline(*) -> (1?) x-hgproto-1: * (glob) read limit reached; closing socket - readline(344 from ~) -> (27) POST /?cmd=batch HTTP/1.1\r\n - readline(317 from *) -> (27) Accept-Encoding: identity\r\n (glob) - readline(290 from *) -> (41) content-type: application/mercurial-0.1\r\n (glob) - readline(249 from *) -> (33) vary: X-HgArgs-Post,X-HgProto-1\r\n (glob) - readline(216 from *) -> (19) x-hgargs-post: 28\r\n (glob) - readline(197 from *) -> (61) x-hgproto-1: 0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull\r\n (glob) - readline(136 from *) -> (35) accept: application/mercurial-0.1\r\n (glob) - readline(101 from *) -> (20) content-length: 28\r\n (glob) - readline(81 from *) -> (*) host: localhost:$HGPORT\r\n (glob) - readline(* from *) -> (49) user-agent: mercurial/proto-1.0 (Mercurial 4.2)\r\n (glob) - readline(* from *) -> (2) \r\n (glob) - read(* from 28) -> (*) cmds=* (glob) + readline(~) -> (27) POST /?cmd=batch HTTP/1.1\r\n + readline(*) -> (27) Accept-Encoding:
D12072: test-http-bad-server: use the new pattern-reading for a test-case
marmoute created this revision. Herald added a reviewer: hg-reviewers. Herald added a subscriber: mercurial-patches. REVISION SUMMARY This test case is now less sensitive to change of unrelated bits of the client/server exchange. Since this introduce some churn in the output, we do it independently for each test cases. REPOSITORY rHG Mercurial BRANCH default REVISION DETAIL https://phab.mercurial-scm.org/D12072 AFFECTED FILES tests/test-http-bad-server.t CHANGE DETAILS diff --git a/tests/test-http-bad-server.t b/tests/test-http-bad-server.t --- a/tests/test-http-bad-server.t +++ b/tests/test-http-bad-server.t @@ -158,7 +158,10 @@ Failure to read getbundle HTTP request -- - $ hg serve --config badserver.close-after-recv-bytes=308,317,304 -p $HGPORT -d --pid-file=hg.pid -E error.log + $ hg serve \ + > --config badserver.close-after-recv-patterns="GET /\?cmd=batch,user-agent: mercurial/proto-1.0,GET /\?cmd=getbundle" \ + > --config badserver.close-after-recv-bytes=110,26,274 \ + > -p $HGPORT -d --pid-file=hg.pid -E error.log $ cat hg.pid > $DAEMON_PIDS $ hg clone http://localhost:$HGPORT/ clone requesting all changes @@ -170,12 +173,12 @@ $ cat error.log readline(1 from -1) -> (1) x (?) readline(1 from -1) -> (1) x (?) - readline(308 from ~) -> (33) GET /?cmd=capabilities HTTP/1.1\r\n - readline(275 from *) -> (27) Accept-Encoding: identity\r\n (glob) - readline(248 from *) -> (35) accept: application/mercurial-0.1\r\n (glob) - readline(213 from *) -> (*) host: localhost:$HGPORT\r\n (glob) - readline(* from *) -> (49) user-agent: mercurial/proto-1.0 (Mercurial 4.2)\r\n (glob) - readline(* from *) -> (2) \r\n (glob) + readline(~) -> (33) GET /?cmd=capabilities HTTP/1.1\r\n + readline(*) -> (27) Accept-Encoding: identity\r\n (glob) + readline(*) -> (35) accept: application/mercurial-0.1\r\n (glob) + readline(*) -> (*) host: localhost:$HGPORT\r\n (glob) + readline(*) -> (49) user-agent: mercurial/proto-1.0 (Mercurial 4.2)\r\n (glob) + readline(*) -> (2) \r\n (glob) sendall(160) -> HTTP/1.1 200 Script output follows\r\nServer: badhttpserver\r\nDate: $HTTP_DATE$\r\nContent-Type: application/mercurial-0.1\r\nContent-Length: 431\r\n\r\n (py36 !) sendall(431) -> batch branchmap $USUAL_BUNDLE2_CAPS_NO_PHASES$ changegroupsubset compression=none getbundle httpheader=1024 httpmediatype=0.1rx,0.1tx,0.2tx known lookup pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash (py36 !) write(160) -> HTTP/1.1 200 Script output follows\r\nServer: badhttpserver\r\nDate: $HTTP_DATE$\r\nContent-Type: application/mercurial-0.1\r\nContent-Length: 431\r\n\r\n (py3 no-py36 !) @@ -187,21 +190,21 @@ write(21) -> Content-Length: 431\r\n (no-py3 !) write(2) -> \r\n (no-py3 !) write(431) -> batch branchmap $USUAL_BUNDLE2_CAPS_NO_PHASES$ changegroupsubset compression=none getbundle httpheader=1024 httpmediatype=0.1rx,0.1tx,0.2tx known lookup pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash (no-py3 !) - readline(13? from ~) -> (26) GET /?cmd=batch HTTP/1.1\r\n (glob) - readline(1?? from *) -> (27) Accept-Encoding: identity\r\n (glob) - readline(8? from *) -> (29) vary: X-HgArg-1,X-HgProto-1\r\n (glob) - readline(5? from *) -> (41) x-hgarg-1: cmds=heads+%3Bknown+nodes%3D\r\n (glob) - readline(1? from *) -> (1?) x-hgproto-1:* (glob) + readline(~) -> (26) GET /?cmd=batch HTTP/1.1\r\n (glob) + readline(*) -> (27) Accept-Encoding: identity\r\n (glob) + readline(*) -> (29) vary: X-HgArg-1,X-HgProto-1\r\n (glob) + readline(*) -> (41) x-hgarg-1: cmds=heads+%3Bknown+nodes%3D\r\n (glob) + readline(*) -> (1?) x-hgproto-1:* (glob) read limit reached; closing socket - readline(317 from ~) -> (26) GET /?cmd=batch HTTP/1.1\r\n - readline(291 from *) -> (27) Accept-Encoding: identity\r\n (glob) - readline(264 from *) -> (29) vary: X-HgArg-1,X-HgProto-1\r\n (glob) - readline(235 from *) -> (41) x-hgarg-1: cmds=heads+%3Bknown+nodes%3D\r\n (glob) - readline(194 from *) -> (61) x-hgproto-1: 0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull\r\n (glob) - readline(133 from *) -> (35) accept: application/mercurial-0.1\r\n (glob) - readline(98 from *) -> (*) host: localhost:$HGPORT\r\n (glob) - readline(* from *) -> (49) user-agent: mercurial/proto-1.0 (Mercurial 4.2)\r\n (glob) - readline(* from *) -> (2) \r\n (glob) + readline(~) -> (26) GET /?cmd=batch HTTP/1.1\r\n + readline(*) -> (27) Accept-Encoding: identity\r\n (glob) + readline(*) -> (29) vary: X-HgArg-1,X-HgProto-1\r\n (glob) + readline(*) -> (41) x-hgarg-1: cmds=heads+%3Bknown+nodes%3D\r\n (glob) + readline(*) -> (61) x-hgproto-1: 0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull\r\n (glob) + readline(*) -> (35) accept: application/mercurial-0.1\r\n (glob) + readline(*) -> (*) host: localhost:$HGPORT\r\n (glob) + readline(*) -> (49) user-agent: mercurial/proto-1.0 (Mercurial
D12071: test-http-bad-server: use the new pattern-reading for a test-case
marmoute created this revision. Herald added a reviewer: hg-reviewers. Herald added a subscriber: mercurial-patches. REVISION SUMMARY This test case is now less sensitive to change of unrelated bits of the client/server exchange. Since this introduce some churn in the output, we do it independently for each test cases. REPOSITORY rHG Mercurial BRANCH default REVISION DETAIL https://phab.mercurial-scm.org/D12071 AFFECTED FILES tests/test-http-bad-server.t CHANGE DETAILS diff --git a/tests/test-http-bad-server.t b/tests/test-http-bad-server.t --- a/tests/test-http-bad-server.t +++ b/tests/test-http-bad-server.t @@ -113,8 +113,8 @@ - $ hg serve \ - > --config badserver.close-after-recv-patterns="GET /\?cmd=batch," \ - > --config badserver.close-after-recv-bytes=15,223 \ + > --config badserver.close-after-recv-patterns="GET /\?cmd=batch,GET /\?cmd=batch" \ + > --config badserver.close-after-recv-bytes=15,197 \ > -p $HGPORT -d --pid-file=hg.pid -E error.log $ cat hg.pid > $DAEMON_PIDS $ hg clone http://localhost:$HGPORT/ clone @@ -144,12 +144,12 @@ readline(~) -> (26) GET /?cmd=batch HTTP/1.1\r\n (glob) readline(*) -> (1?) Accept-Encoding* (glob) read limit reached; closing socket - readline(223 from ~) -> (26) GET /?cmd=batch HTTP/1.1\r\n - readline(197 from *) -> (27) Accept-Encoding: identity\r\n (glob) - readline(170 from *) -> (29) vary: X-HgArg-1,X-HgProto-1\r\n (glob) - readline(141 from *) -> (41) x-hgarg-1: cmds=heads+%3Bknown+nodes%3D\r\n (glob) - readline(100 from *) -> (61) x-hgproto-1: 0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull\r\n (glob) - readline(39 from *) -> (35) accept: application/mercurial-0.1\r\n (glob) + readline(~) -> (26) GET /?cmd=batch HTTP/1.1\r\n + readline(*) -> (27) Accept-Encoding: identity\r\n (glob) + readline(*) -> (29) vary: X-HgArg-1,X-HgProto-1\r\n (glob) + readline(*) -> (41) x-hgarg-1: cmds=heads+%3Bknown+nodes%3D\r\n (glob) + readline(*) -> (61) x-hgproto-1: 0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull\r\n (glob) + readline(*) -> (35) accept: application/mercurial-0.1\r\n (glob) readline(4 from *) -> (4) host (glob) read limit reached; closing socket To: marmoute, #hg-reviewers Cc: mercurial-patches, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D12070: test-http-bad-server: use the new pattern-reading for a test-case
marmoute created this revision. Herald added a reviewer: hg-reviewers. Herald added a subscriber: mercurial-patches. REVISION SUMMARY This test case is now less sensitive to change of unrelated bits of the client/server exchange. Since this introduce some churn in the output, we do it independently for each test cases. REPOSITORY rHG Mercurial BRANCH default REVISION DETAIL https://phab.mercurial-scm.org/D12070 AFFECTED FILES tests/test-http-bad-server.t CHANGE DETAILS diff --git a/tests/test-http-bad-server.t b/tests/test-http-bad-server.t --- a/tests/test-http-bad-server.t +++ b/tests/test-http-bad-server.t @@ -112,7 +112,10 @@ Failure on subsequent HTTP request on the same socket (cmd?batch) - - $ hg serve --config badserver.close-after-recv-bytes=210,223 -p $HGPORT -d --pid-file=hg.pid -E error.log + $ hg serve \ + > --config badserver.close-after-recv-patterns="GET /\?cmd=batch," \ + > --config badserver.close-after-recv-bytes=15,223 \ + > -p $HGPORT -d --pid-file=hg.pid -E error.log $ cat hg.pid > $DAEMON_PIDS $ hg clone http://localhost:$HGPORT/ clone abort: error: bad HTTP status line: * (glob) @@ -121,12 +124,12 @@ $ killdaemons.py $DAEMON_PIDS $ cat error.log - readline(210 from ~) -> (33) GET /?cmd=capabilities HTTP/1.1\r\n - readline(177 from *) -> (27) Accept-Encoding: identity\r\n (glob) - readline(150 from *) -> (35) accept: application/mercurial-0.1\r\n (glob) - readline(115 from *) -> (*) host: localhost:$HGPORT\r\n (glob) - readline(* from *) -> (49) user-agent: mercurial/proto-1.0 (Mercurial 4.2)\r\n (glob) - readline(* from *) -> (2) \r\n (glob) + readline(~) -> (33) GET /?cmd=capabilities HTTP/1.1\r\n + readline(*) -> (27) Accept-Encoding: identity\r\n (glob) + readline(*) -> (35) accept: application/mercurial-0.1\r\n (glob) + readline(*) -> (*) host: localhost:$HGPORT\r\n (glob) + readline(*) -> (49) user-agent: mercurial/proto-1.0 (Mercurial 4.2)\r\n (glob) + readline(*) -> (2) \r\n (glob) sendall(160) -> HTTP/1.1 200 Script output follows\r\nServer: badhttpserver\r\nDate: $HTTP_DATE$\r\nContent-Type: application/mercurial-0.1\r\nContent-Length: 431\r\n\r\n (py36 !) sendall(431) -> batch branchmap $USUAL_BUNDLE2_CAPS_NO_PHASES$ changegroupsubset compression=none getbundle httpheader=1024 httpmediatype=0.1rx,0.1tx,0.2tx known lookup pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash (py36 !) write(160) -> HTTP/1.1 200 Script output follows\r\nServer: badhttpserver\r\nDate: $HTTP_DATE$\r\nContent-Type: application/mercurial-0.1\r\nContent-Length: 431\r\n\r\n (py3 no-py36 !) @@ -138,8 +141,8 @@ write(21) -> Content-Length: 431\r\n (no-py3 !) write(2) -> \r\n (no-py3 !) write(431) -> batch branchmap $USUAL_BUNDLE2_CAPS_NO_PHASES$ changegroupsubset compression=none getbundle httpheader=1024 httpmediatype=0.1rx,0.1tx,0.2tx known lookup pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash (no-py3 !) - readline(4? from ~) -> (26) GET /?cmd=batch HTTP/1.1\r\n (glob) - readline(1? from *) -> (1?) Accept-Encoding* (glob) + readline(~) -> (26) GET /?cmd=batch HTTP/1.1\r\n (glob) + readline(*) -> (1?) Accept-Encoding* (glob) read limit reached; closing socket readline(223 from ~) -> (26) GET /?cmd=batch HTTP/1.1\r\n readline(197 from *) -> (27) Accept-Encoding: identity\r\n (glob) To: marmoute, #hg-reviewers Cc: mercurial-patches, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D12069: test-http-bad-server: use the new pattern-reading for a test-case
marmoute created this revision. Herald added a reviewer: hg-reviewers. Herald added a subscriber: mercurial-patches. REVISION SUMMARY This test case is now less sensitive to change of unrelated bits of the client/server exchange. Since this introduce some churn in the output, we do it independently for each test cases. REPOSITORY rHG Mercurial BRANCH default REVISION DETAIL https://phab.mercurial-scm.org/D12069 AFFECTED FILES tests/test-http-bad-server.t CHANGE DETAILS diff --git a/tests/test-http-bad-server.t b/tests/test-http-bad-server.t --- a/tests/test-http-bad-server.t +++ b/tests/test-http-bad-server.t @@ -91,7 +91,10 @@ Same failure, but server reads full HTTP request line - - $ hg serve --config badserver.close-after-recv-bytes=40 -p $HGPORT -d --pid-file=hg.pid -E error.log + $ hg serve \ + > --config badserver.close-after-recv-patterns="GET /\?cmd=capabilities" \ + > --config badserver.close-after-recv-bytes=7 \ + > -p $HGPORT -d --pid-file=hg.pid -E error.log $ cat hg.pid > $DAEMON_PIDS $ hg clone http://localhost:$HGPORT/ clone abort: error: bad HTTP status line: * (glob) @@ -100,7 +103,7 @@ $ killdaemons.py $DAEMON_PIDS $ cat error.log - readline(40 from ~) -> (33) GET /?cmd=capabilities HTTP/1.1\r\n + readline(~) -> (33) GET /?cmd=capabilities HTTP/1.1\r\n readline(7 from *) -> (7) Accept- (glob) read limit reached; closing socket To: marmoute, #hg-reviewers Cc: mercurial-patches, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D12067: test-http-bad-server: move on test from bytes-count to pattern
marmoute created this revision. Herald added a reviewer: hg-reviewers. Herald added a subscriber: mercurial-patches. REVISION SUMMARY This specific test case is now using the new "close when a pattern is seen" approach compared to the more fragile "that many bytes were sent" approach. Since such change are still a bit noisy, we split each change in there own changesets. REPOSITORY rHG Mercurial BRANCH default REVISION DETAIL https://phab.mercurial-scm.org/D12067 AFFECTED FILES tests/test-http-bad-server.t CHANGE DETAILS diff --git a/tests/test-http-bad-server.t b/tests/test-http-bad-server.t --- a/tests/test-http-bad-server.t +++ b/tests/test-http-bad-server.t @@ -1276,7 +1276,9 @@ Server sends a size 0 chunked-transfer size without terminating \r\n - $ hg serve --config badserver.close-after-send-bytes=1739 -p $HGPORT -d --pid-file=hg.pid -E error.log + $ hg serve \ + > --config badserver.close-after-send-patterns="(.*4\\r\\n\0\0\0\0\\r\\n0\r\n)" \ + > -p $HGPORT -d --pid-file=hg.pid -E error.log $ cat hg.pid > $DAEMON_PIDS $ hg clone http://localhost:$HGPORT/ clone @@ -1293,21 +1295,21 @@ #if py36 $ "$PYTHON" $TESTDIR/filtertraceback.py < error.log | tail -21 - sendall(9 from 9) -> (747) 4\\r\\n\x00\x00\x00\x00\\r\\n (esc) - sendall(9 from 9) -> (738) 4\\r\\n\x00\x00\x00)\\r\\n (esc) - sendall(47 from 47) -> (691) 29\\r\\n\x0bCHANGEGROUP\x00\x00\x00\x00\x01\x01\x07\x02 \x01version02nbchanges1\\r\\n (esc) - sendall(9 from 9) -> (682) 4\\r\\n\x00\x00\x01\xd2\\r\\n (esc) - sendall(473 from 473) -> (209) 1d2\\r\\n\x00\x00\x00\xb2\x96\xee\x1dsT\xc4\xadsr\x04vr\xc3j\x1fV\x1e:jL\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x96\xee\x1dsT\xc4\xadsr\x04vr\xc3j\x1fV\x1e:jL\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00>6a3df4de388f3c4f8e28f4f9a814299a3cbb5f50\\ntest\\n0 0\\nfoo\\n\\ninitial\x00\x00\x00\x00\x00\x00\x00\xa1j=\xf4\xde8\x8f (200) 4\\r\\n\x00\x00\x00\x00\\r\\n (esc) - sendall(9 from 9) -> (191) 4\\r\\n\x00\x00\x00 \\r\\n (esc) - sendall(38 from 38) -> (153) 20\\r\\n\x08LISTKEYS\x00\x00\x00\x01\x01\x00 \x06namespacephases\\r\\n (esc) - sendall(9 from 9) -> (144) 4\\r\\n\x00\x00\x00:\\r\\n (esc) - sendall(64 from 64) -> (80) 3a\r\n96ee1d7354c4ad7372047672c36a1f561e3a6a4c 1\npublishing True\r\n - sendall(9 from 9) -> (71) 4\\r\\n\x00\x00\x00\x00\\r\\n (esc) - sendall(9 from 9) -> (62) 4\\r\\n\x00\x00\x00#\\r\\n (esc) - sendall(41 from 41) -> (21) 23\\r\\n\x08LISTKEYS\x00\x00\x00\x02\x01\x00 namespacebookmarks\\r\\n (esc) - sendall(9 from 9) -> (12) 4\\r\\n\x00\x00\x00\x00\\r\\n (esc) - sendall(9 from 9) -> (3) 4\\r\\n\x00\x00\x00\x00\\r\\n (esc) + sendall(9) -> 4\\r\\n\x00\x00\x00\x00\\r\\n (esc) + sendall(9) -> 4\\r\\n\x00\x00\x00)\\r\\n (esc) + sendall(47) -> 29\\r\\n\x0bCHANGEGROUP\x00\x00\x00\x00\x01\x01\x07\x02 \x01version02nbchanges1\\r\\n (esc) + sendall(9) -> 4\\r\\n\x00\x00\x01\xd2\\r\\n (esc) + sendall(473) -> 1d2\\r\\n\x00\x00\x00\xb2\x96\xee\x1dsT\xc4\xadsr\x04vr\xc3j\x1fV\x1e:jL\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x96\xee\x1dsT\xc4\xadsr\x04vr\xc3j\x1fV\x1e:jL\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00>6a3df4de388f3c4f8e28f4f9a814299a3cbb5f50\\ntest\\n0 0\\nfoo\\n\\ninitial\x00\x00\x00\x00\x00\x00\x00\xa1j=\xf4\xde8\x8f 4\\r\\n\x00\x00\x00\x00\\r\\n (esc) + sendall(9) -> 4\\r\\n\x00\x00\x00 \\r\\n (esc) + sendall(38) -> 20\\r\\n\x08LISTKEYS\x00\x00\x00\x01\x01\x00 \x06namespacephases\\r\\n (esc) + sendall(9) -> 4\\r\\n\x00\x00\x00:\\r\\n (esc) + sendall(64) -> 3a\r\n96ee1d7354c4ad7372047672c36a1f561e3a6a4c 1\npublishing True\r\n + sendall(9) -> 4\\r\\n\x00\x00\x00\x00\\r\\n (esc) + sendall(9) -> 4\\r\\n\x00\x00\x00#\\r\\n (esc) + sendall(41) -> 23\\r\\n\x08LISTKEYS\x00\x00\x00\x02\x01\x00 namespacebookmarks\\r\\n (esc) + sendall(9) -> 4\\r\\n\x00\x00\x00\x00\\r\\n (esc) + sendall(9) -> 4\\r\\n\x00\x00\x00\x00\\r\\n (esc) sendall(3 from 5) -> (0) 0\r\n write limit reached; closing socket $LOCALIP - - [$ERRDATE$] Exception happened during processing request '/?cmd=getbundle': (glob) @@ -1317,22 +1319,22 @@ #else $ "$PYTHON" $TESTDIR/filtertraceback.py < error.log | tail -22 - write(9 from 9) -> (756) 4\r\nHG20\r\n - write(9 from 9) -> (747) 4\\r\\n\x00\x00\x00\x00\\r\\n (esc) - write(9 from 9) -> (738) 4\\r\\n\x00\x00\x00)\\r\\n (esc) - write(47 from 47) -> (691) 29\\r\\n\x0bCHANGEGROUP\x00\x00\x00\x00\x01\x01\x07\x02 \x01version02nbchanges1\\r\\n (esc) - write(9 from 9) ->
D12068: test-http-bad-server: introduce socket closing after reading a pattern
marmoute created this revision. Herald added a reviewer: hg-reviewers. Herald added a subscriber: mercurial-patches. REVISION SUMMARY We introduce the `close-after-recv-patterns` option. It has the same goal as `close-after-send-patterns` with a slightly different implementation. Reading "up to a pattern" is hard. As we can only check the pattern from what we have already read (inlike writing, were we can check what we are about to write). So instead we make the `close-after-recv-patterns` alter the behavior of the existing `close-after-recv-bytes`. The value from `close-after-recv-bytes` only gets into play after we have seen the pattern from `close-after-recv-patterns`. This allow us to achieve the target benefit without changing the read pattern too much. REPOSITORY rHG Mercurial BRANCH default REVISION DETAIL https://phab.mercurial-scm.org/D12068 AFFECTED FILES tests/testlib/badserverext.py CHANGE DETAILS diff --git a/tests/testlib/badserverext.py b/tests/testlib/badserverext.py --- a/tests/testlib/badserverext.py +++ b/tests/testlib/badserverext.py @@ -27,6 +27,12 @@ (The value is a list, multiple value can use used to close a series of request) +close-after-recv-patterns + If defined, the `close-after-recv-bytes` values only start counting after the + `read` operation that encountered the defined patterns. + (The value is a list, multiple value can use used to close a series of + request) + close-after-send-bytes If defined, close the client socket after sending this many bytes. (The value is a list, multiple value can use used to close a series of @@ -65,6 +71,11 @@ ) configitem( b'badserver', +b'close-after-recv-patterns', +default=b'', +) +configitem( +b'badserver', b'close-after-send-bytes', default=b'0', ) @@ -84,15 +95,19 @@ def __init__( self, close_after_recv_bytes, +close_after_recv_patterns, close_after_send_bytes, close_after_send_patterns, ): self._all_close_after_recv_bytes = close_after_recv_bytes +self._all_close_after_recv_patterns = close_after_recv_patterns self._all_close_after_send_bytes = close_after_send_bytes self._all_close_after_send_patterns = close_after_send_patterns self.target_recv_bytes = None self.remaining_recv_bytes = None +self.recv_patterns = None +self.recv_data = b'' self.target_send_bytes = None self.remaining_send_bytes = None self.send_pattern = None @@ -107,6 +122,12 @@ self.target_recv_bytes = None self.remaining_recv_bytes = None +self.recv_data = b'' +if self._all_close_after_recv_patterns: +self.recv_pattern = self._all_close_after_recv_patterns.pop(0) +else: +self.recv_pattern = None + if self._all_close_after_send_bytes: self.target_send_bytes = self._all_close_after_send_bytes.pop(0) self.remaining_send_bytes = self.target_send_bytes @@ -124,6 +145,8 @@ """True, if any processing will be needed""" if self.remaining_recv_bytes is not None: return True +if self.recv_pattern is not None: +return True if self.remaining_send_bytes is not None: return True if self.send_pattern is not None: @@ -184,6 +207,7 @@ When the condition are met the socket is closed """ remaining = self.remaining_recv_bytes +pattern = self.recv_pattern orig = object.__getattribute__(obj, '_orig') bmethod = method.encode('ascii') @@ -192,7 +216,7 @@ requested_size = size actual_size = size -if remaining: +if pattern is None and remaining: if size < 0: actual_size = remaining else: @@ -200,7 +224,7 @@ result = func(actual_size) -if remaining: +if pattern is None and remaining: remaining -= len(result) self.remaining_recv_bytes = remaining @@ -216,6 +240,12 @@ msg %= (bmethod, actual_size, requested_repr, len(result), result) obj._writelog(msg) +if pattern is not None: +self.recv_data += result +if pattern.search(self.recv_data): +# start counting bytes starting with the next read +self.recv_pattern = None + if remaining is not None and remaining <= 0: obj._writelog(b'read limit reached; closing socket') obj._cond_close() @@ -363,6 +393,10 @@ b'badserver', b'close-after-recv-bytes' ) all_recv_bytes = process_bytes_config(all_recv_bytes) +all_recv_pattern = self._ui.config( +b'badserver', b'close-after-recv-patterns' +) +all_recv_pattern =
D12066: test-http-bad-server: move on test from bytes-count to pattern
marmoute created this revision. Herald added a reviewer: hg-reviewers. Herald added a subscriber: mercurial-patches. REVISION SUMMARY This specific test case is now using the new "close when a pattern is seen" approach compared to the more fragile "that many bytes were sent" approach. Since such change are still a bit noisy, we split each change in there own changesets. REPOSITORY rHG Mercurial BRANCH default REVISION DETAIL https://phab.mercurial-scm.org/D12066 AFFECTED FILES tests/test-http-bad-server.t CHANGE DETAILS diff --git a/tests/test-http-bad-server.t b/tests/test-http-bad-server.t --- a/tests/test-http-bad-server.t +++ b/tests/test-http-bad-server.t @@ -1205,7 +1205,9 @@ This is before the 0 size chunked transfer part that signals end of HTTP response. - $ hg serve --config badserver.close-after-send-bytes=1736 -p $HGPORT -d --pid-file=hg.pid -E error.log + $ hg serve \ + > --config badserver.close-after-send-patterns='(.*4\r\n\0\0\0\0\r\n){5}' \ + > -p $HGPORT -d --pid-file=hg.pid -E error.log $ cat hg.pid > $DAEMON_PIDS $ hg clone http://localhost:$HGPORT/ clone @@ -1222,20 +1224,20 @@ #if py36 $ "$PYTHON" $TESTDIR/filtertraceback.py < error.log | tail -20 - sendall(9 from 9) -> (744) 4\\r\\n\x00\x00\x00\x00\\r\\n (esc) - sendall(9 from 9) -> (735) 4\\r\\n\x00\x00\x00)\\r\\n (esc) - sendall(47 from 47) -> (688) 29\\r\\n\x0bCHANGEGROUP\x00\x00\x00\x00\x01\x01\x07\x02 \x01version02nbchanges1\\r\\n (esc) - sendall(9 from 9) -> (679) 4\\r\\n\x00\x00\x01\xd2\\r\\n (esc) - sendall(473 from 473) -> (206) 1d2\\r\\n\x00\x00\x00\xb2\x96\xee\x1dsT\xc4\xadsr\x04vr\xc3j\x1fV\x1e:jL\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x96\xee\x1dsT\xc4\xadsr\x04vr\xc3j\x1fV\x1e:jL\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00>6a3df4de388f3c4f8e28f4f9a814299a3cbb5f50\\ntest\\n0 0\\nfoo\\n\\ninitial\x00\x00\x00\x00\x00\x00\x00\xa1j=\xf4\xde8\x8f (197) 4\\r\\n\x00\x00\x00\x00\\r\\n (esc) - sendall(9 from 9) -> (188) 4\\r\\n\x00\x00\x00 \\r\\n (esc) - sendall(38 from 38) -> (150) 20\\r\\n\x08LISTKEYS\x00\x00\x00\x01\x01\x00 \x06namespacephases\\r\\n (esc) - sendall(9 from 9) -> (141) 4\\r\\n\x00\x00\x00:\\r\\n (esc) - sendall(64 from 64) -> (77) 3a\r\n96ee1d7354c4ad7372047672c36a1f561e3a6a4c 1\npublishing True\r\n - sendall(9 from 9) -> (68) 4\\r\\n\x00\x00\x00\x00\\r\\n (esc) - sendall(9 from 9) -> (59) 4\\r\\n\x00\x00\x00#\\r\\n (esc) - sendall(41 from 41) -> (18) 23\\r\\n\x08LISTKEYS\x00\x00\x00\x02\x01\x00 namespacebookmarks\\r\\n (esc) - sendall(9 from 9) -> (9) 4\\r\\n\x00\x00\x00\x00\\r\\n (esc) + sendall(9) -> 4\\r\\n\x00\x00\x00\x00\\r\\n (esc) + sendall(9) -> 4\\r\\n\x00\x00\x00)\\r\\n (esc) + sendall(47) -> 29\\r\\n\x0bCHANGEGROUP\x00\x00\x00\x00\x01\x01\x07\x02 \x01version02nbchanges1\\r\\n (esc) + sendall(9) -> 4\\r\\n\x00\x00\x01\xd2\\r\\n (esc) + sendall(473) -> 1d2\\r\\n\x00\x00\x00\xb2\x96\xee\x1dsT\xc4\xadsr\x04vr\xc3j\x1fV\x1e:jL\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x96\xee\x1dsT\xc4\xadsr\x04vr\xc3j\x1fV\x1e:jL\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00>6a3df4de388f3c4f8e28f4f9a814299a3cbb5f50\\ntest\\n0 0\\nfoo\\n\\ninitial\x00\x00\x00\x00\x00\x00\x00\xa1j=\xf4\xde8\x8f 4\\r\\n\x00\x00\x00\x00\\r\\n (esc) + sendall(9) -> 4\\r\\n\x00\x00\x00 \\r\\n (esc) + sendall(38) -> 20\\r\\n\x08LISTKEYS\x00\x00\x00\x01\x01\x00 \x06namespacephases\\r\\n (esc) + sendall(9) -> 4\\r\\n\x00\x00\x00:\\r\\n (esc) + sendall(64) -> 3a\r\n96ee1d7354c4ad7372047672c36a1f561e3a6a4c 1\npublishing True\r\n + sendall(9) -> 4\\r\\n\x00\x00\x00\x00\\r\\n (esc) + sendall(9) -> 4\\r\\n\x00\x00\x00#\\r\\n (esc) + sendall(41) -> 23\\r\\n\x08LISTKEYS\x00\x00\x00\x02\x01\x00 namespacebookmarks\\r\\n (esc) + sendall(9) -> 4\\r\\n\x00\x00\x00\x00\\r\\n (esc) sendall(9 from 9) -> (0) 4\\r\\n\x00\x00\x00\x00\\r\\n (esc) write limit reached; closing socket $LOCALIP - - [$ERRDATE$] Exception happened during processing request '/?cmd=getbundle': (glob) @@ -1245,21 +1247,21 @@ #else $ "$PYTHON" $TESTDIR/filtertraceback.py < error.log | tail -21 - write(9 from 9) -> (753) 4\r\nHG20\r\n - write(9 from 9) -> (744) 4\\r\\n\x00\x00\x00\x00\\r\\n (esc) - write(9 from 9) -> (735) 4\\r\\n\x00\x00\x00)\\r\\n (esc) - write(47 from 47) -> (688) 29\\r\\n\x0bCHANGEGROUP\x00\x00\x00\x00\x01\x01\x07\x02 \x01version02nbchanges1\\r\\n (esc) - write(9 from 9) -> (679) 4\\r\\n\x00\x00\x01\xd2\\r\\n (esc) - write(473 from 473) -> (206)
D12065: test-http-bad-server: move on test from bytes-count to pattern
marmoute created this revision. Herald added a reviewer: hg-reviewers. Herald added a subscriber: mercurial-patches. REVISION SUMMARY This specific test case is now using the new "close when a pattern is seen" approach compared to the more fragile "that many bytes were sent" approach. Since such change are still a bit noisy, we split each change in there own changesets. REPOSITORY rHG Mercurial BRANCH default REVISION DETAIL https://phab.mercurial-scm.org/D12065 AFFECTED FILES tests/test-http-bad-server.t CHANGE DETAILS diff --git a/tests/test-http-bad-server.t b/tests/test-http-bad-server.t --- a/tests/test-http-bad-server.t +++ b/tests/test-http-bad-server.t @@ -1139,7 +1139,9 @@ Server stops sending after 0 length payload chunk size -- - $ hg serve --config badserver.close-after-send-bytes=1561 -p $HGPORT -d --pid-file=hg.pid -E error.log + $ hg serve \ + > --config badserver.close-after-send-patterns=LISTKEYS \ + > -p $HGPORT -d --pid-file=hg.pid -E error.log $ cat hg.pid > $DAEMON_PIDS $ hg clone http://localhost:$HGPORT/ clone @@ -1158,16 +1160,16 @@ #if py36 $ "$PYTHON" $TESTDIR/filtertraceback.py < error.log | tail -16 - sendall(6 from 6) -> (596) 1\\r\\n\x04\\r\\n (esc) - sendall(9 from 9) -> (587) 4\r\nnone\r\n - sendall(9 from 9) -> (578) 4\r\nHG20\r\n - sendall(9 from 9) -> (569) 4\\r\\n\x00\x00\x00\x00\\r\\n (esc) - sendall(9 from 9) -> (560) 4\\r\\n\x00\x00\x00)\\r\\n (esc) - sendall(47 from 47) -> (513) 29\\r\\n\x0bCHANGEGROUP\x00\x00\x00\x00\x01\x01\x07\x02 \x01version02nbchanges1\\r\\n (esc) - sendall(9 from 9) -> (504) 4\\r\\n\x00\x00\x01\xd2\\r\\n (esc) - sendall(473 from 473) -> (31) 1d2\\r\\n\x00\x00\x00\xb2\x96\xee\x1dsT\xc4\xadsr\x04vr\xc3j\x1fV\x1e:jL\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x96\xee\x1dsT\xc4\xadsr\x04vr\xc3j\x1fV\x1e:jL\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00>6a3df4de388f3c4f8e28f4f9a814299a3cbb5f50\\ntest\\n0 0\\nfoo\\n\\ninitial\x00\x00\x00\x00\x00\x00\x00\xa1j=\xf4\xde8\x8f (22) 4\\r\\n\x00\x00\x00\x00\\r\\n (esc) - sendall(9 from 9) -> (13) 4\\r\\n\x00\x00\x00 \\r\\n (esc) + sendall(6) -> 1\\r\\n\x04\\r\\n (esc) + sendall(9) -> 4\r\nnone\r\n + sendall(9) -> 4\r\nHG20\r\n + sendall(9) -> 4\\r\\n\x00\x00\x00\x00\\r\\n (esc) + sendall(9) -> 4\\r\\n\x00\x00\x00)\\r\\n (esc) + sendall(47) -> 29\\r\\n\x0bCHANGEGROUP\x00\x00\x00\x00\x01\x01\x07\x02 \x01version02nbchanges1\\r\\n (esc) + sendall(9) -> 4\\r\\n\x00\x00\x01\xd2\\r\\n (esc) + sendall(473) -> 1d2\\r\\n\x00\x00\x00\xb2\x96\xee\x1dsT\xc4\xadsr\x04vr\xc3j\x1fV\x1e:jL\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x96\xee\x1dsT\xc4\xadsr\x04vr\xc3j\x1fV\x1e:jL\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00>6a3df4de388f3c4f8e28f4f9a814299a3cbb5f50\\ntest\\n0 0\\nfoo\\n\\ninitial\x00\x00\x00\x00\x00\x00\x00\xa1j=\xf4\xde8\x8f 4\\r\\n\x00\x00\x00\x00\\r\\n (esc) + sendall(9) -> 4\\r\\n\x00\x00\x00 \\r\\n (esc) sendall(13 from 38) -> (0) 20\\r\\n\x08LISTKEYS (esc) write limit reached; closing socket $LOCALIP - - [$ERRDATE$] Exception happened during processing request '/?cmd=getbundle': (glob) @@ -1177,17 +1179,17 @@ #else $ "$PYTHON" $TESTDIR/filtertraceback.py < error.log | tail -17 - write(2 from 2) -> (602) \r\n - write(6 from 6) -> (596) 1\\r\\n\x04\\r\\n (esc) - write(9 from 9) -> (587) 4\r\nnone\r\n - write(9 from 9) -> (578) 4\r\nHG20\r\n - write(9 from 9) -> (569) 4\\r\\n\x00\x00\x00\x00\\r\\n (esc) - write(9 from 9) -> (560) 4\\r\\n\x00\x00\x00)\\r\\n (esc) - write(47 from 47) -> (513) 29\\r\\n\x0bCHANGEGROUP\x00\x00\x00\x00\x01\x01\x07\x02 \x01version02nbchanges1\\r\\n (esc) - write(9 from 9) -> (504) 4\\r\\n\x00\x00\x01\xd2\\r\\n (esc) - write(473 from 473) -> (31) 1d2\\r\\n\x00\x00\x00\xb2\x96\xee\x1dsT\xc4\xadsr\x04vr\xc3j\x1fV\x1e:jL\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x96\xee\x1dsT\xc4\xadsr\x04vr\xc3j\x1fV\x1e:jL\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00>6a3df4de388f3c4f8e28f4f9a814299a3cbb5f50\\ntest\\n0 0\\nfoo\\n\\ninitial\x00\x00\x00\x00\x00\x00\x00\xa1j=\xf4\xde8\x8f (22) 4\\r\\n\x00\x00\x00\x00\\r\\n (esc) - write(9 from 9) -> (13) 4\\r\\n\x00\x00\x00 \\r\\n (esc) + write(2) -> \r\n + write(6) -> 1\\r\\n\x04\\r\\n (esc) + write(9) -> 4\r\nnone\r\n + write(9) -> 4\r\nHG20\r\n + write(9) -> 4\\r\\n\x00\x00\x00\x00\\r\\n (esc) + write(9)
D12064: test-http-bad-server: move on test from bytes-count to pattern
marmoute created this revision. Herald added a reviewer: hg-reviewers. Herald added a subscriber: mercurial-patches. REVISION SUMMARY This specific test case is now using the new "close when a pattern is seen" approach compared to the more fragile "that many bytes were sent" approach. Since such change are still a bit noisy, we split each change in there own changesets. REPOSITORY rHG Mercurial BRANCH default REVISION DETAIL https://phab.mercurial-scm.org/D12064 AFFECTED FILES tests/test-http-bad-server.t CHANGE DETAILS diff --git a/tests/test-http-bad-server.t b/tests/test-http-bad-server.t --- a/tests/test-http-bad-server.t +++ b/tests/test-http-bad-server.t @@ -1079,7 +1079,9 @@ Server stops sending in middle of bundle2 payload chunk --- - $ hg serve --config badserver.close-after-send-bytes=1530 -p $HGPORT -d --pid-file=hg.pid -E error.log + $ hg serve \ + > --config badserver.close-after-send-patterns=':jL\0\0\x00\0\0\0\0\0\r\n' \ + > -p $HGPORT -d --pid-file=hg.pid -E error.log $ cat hg.pid > $DAEMON_PIDS $ hg clone http://localhost:$HGPORT/ clone @@ -1095,14 +1097,14 @@ #if py36 $ "$PYTHON" $TESTDIR/filtertraceback.py < error.log | tail -14 - sendall(167 from 167) -> (571) HTTP/1.1 200 Script output follows\r\nServer: badhttpserver\r\nDate: $HTTP_DATE$\r\nContent-Type: application/mercurial-0.2\r\nTransfer-Encoding: chunked\r\n\r\n - sendall(6 from 6) -> (565) 1\\r\\n\x04\\r\\n (esc) - sendall(9 from 9) -> (556) 4\r\nnone\r\n - sendall(9 from 9) -> (547) 4\r\nHG20\r\n - sendall(9 from 9) -> (538) 4\\r\\n\x00\x00\x00\x00\\r\\n (esc) - sendall(9 from 9) -> (529) 4\\r\\n\x00\x00\x00)\\r\\n (esc) - sendall(47 from 47) -> (482) 29\\r\\n\x0bCHANGEGROUP\x00\x00\x00\x00\x01\x01\x07\x02 \x01version02nbchanges1\\r\\n (esc) - sendall(9 from 9) -> (473) 4\\r\\n\x00\x00\x01\xd2\\r\\n (esc) + sendall(167) -> HTTP/1.1 200 Script output follows\r\nServer: badhttpserver\r\nDate: $HTTP_DATE$\r\nContent-Type: application/mercurial-0.2\r\nTransfer-Encoding: chunked\r\n\r\n + sendall(6) -> 1\\r\\n\x04\\r\\n (esc) + sendall(9) -> 4\r\nnone\r\n + sendall(9) -> 4\r\nHG20\r\n + sendall(9) -> 4\\r\\n\x00\x00\x00\x00\\r\\n (esc) + sendall(9) -> 4\\r\\n\x00\x00\x00)\\r\\n (esc) + sendall(47) -> 29\\r\\n\x0bCHANGEGROUP\x00\x00\x00\x00\x01\x01\x07\x02 \x01version02nbchanges1\\r\\n (esc) + sendall(9) -> 4\\r\\n\x00\x00\x01\xd2\\r\\n (esc) sendall(473 from 473) -> (0) 1d2\\r\\n\x00\x00\x00\xb2\x96\xee\x1dsT\xc4\xadsr\x04vr\xc3j\x1fV\x1e:jL\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x96\xee\x1dsT\xc4\xadsr\x04vr\xc3j\x1fV\x1e:jL\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00>6a3df4de388f3c4f8e28f4f9a814299a3cbb5f50\\ntest\\n0 0\\nfoo\\n\\ninitial\x00\x00\x00\x00\x00\x00\x00\xa1j=\xf4\xde8\x8f (2) \r\n (py3 !) - write(167 from 167) -> (571) HTTP/1.1 200 Script output follows\r\nServer: badhttpserver\r\nDate: $HTTP_DATE$\r\nContent-Type: application/mercurial-0.2\r\nTransfer-Encoding: chunked\r\n\r\n (py3 !) - write(41 from 41) -> (601) Content-Type: application/mercurial-0.2\r\n - write(28 from 28) -> (573) Transfer-Encoding: chunked\r\n - write(2 from 2) -> (571) \r\n - write(6 from 6) -> (565) 1\\r\\n\x04\\r\\n (esc) - write(9 from 9) -> (556) 4\r\nnone\r\n - write(9 from 9) -> (547) 4\r\nHG20\r\n - write(9 from 9) -> (538) 4\\r\\n\x00\x00\x00\x00\\r\\n (esc) - write(9 from 9) -> (529) 4\\r\\n\x00\x00\x00)\\r\\n (esc) - write(47 from 47) -> (482) 29\\r\\n\x0bCHANGEGROUP\x00\x00\x00\x00\x01\x01\x07\x02 \x01version02nbchanges1\\r\\n (esc) - write(9 from 9) -> (473) 4\\r\\n\x00\x00\x01\xd2\\r\\n (esc) + write(167) -> HTTP/1.1 200 Script output follows\r\nServer: badhttpserver\r\nDate: $HTTP_DATE$\r\nContent-Type: application/mercurial-0.2\r\nTransfer-Encoding: chunked\r\n\r\n (py3 !) + write(41) -> Content-Type: application/mercurial-0.2\r\n + write(28) -> Transfer-Encoding: chunked\r\n (no-py3 !) + write(2) -> \r\n (no-py3 !) + write(6) -> 1\\r\\n\x04\\r\\n (esc) + write(9) -> 4\r\nnone\r\n + write(9) -> 4\r\nHG20\r\n + write(9) -> 4\\r\\n\x00\x00\x00\x00\\r\\n (esc) + write(9) -> 4\\r\\n\x00\x00\x00)\\r\\n (esc) + write(47) -> 29\\r\\n\x0bCHANGEGROUP\x00\x00\x00\x00\x01\x01\x07\x02 \x01version02nbchanges1\\r\\n (esc) + write(9) -> 4\\r\\n\x00\x00\x01\xd2\\r\\n (esc) write(473 from 473) -> (0)
D12063: test-http-bad-server: move on test from bytes-count to pattern
marmoute created this revision. Herald added a reviewer: hg-reviewers. Herald added a subscriber: mercurial-patches. REVISION SUMMARY This specific test case is now using the new "close when a pattern is seen" approach compared to the more fragile "that many bytes were sent" approach. Since such change are still a bit noisy, we split each change in there own changesets. REPOSITORY rHG Mercurial BRANCH default REVISION DETAIL https://phab.mercurial-scm.org/D12063 AFFECTED FILES tests/test-http-bad-server.t CHANGE DETAILS diff --git a/tests/test-http-bad-server.t b/tests/test-http-bad-server.t --- a/tests/test-http-bad-server.t +++ b/tests/test-http-bad-server.t @@ -1020,7 +1020,9 @@ Server stops after bundle2 part payload chunk size -- - $ hg serve --config badserver.close-after-send-bytes=1069 -p $HGPORT -d --pid-file=hg.pid -E error.log + $ hg serve \ + > --config badserver.close-after-send-patterns='1d2\r\n...' \ + > -p $HGPORT -d --pid-file=hg.pid -E error.log $ cat hg.pid > $DAEMON_PIDS $ hg clone http://localhost:$HGPORT/ clone @@ -1037,14 +1039,14 @@ #if py36 $ "$PYTHON" $TESTDIR/filtertraceback.py < error.log | tail -14 - sendall(167 from 167) -> (110) HTTP/1.1 200 Script output follows\r\nServer: badhttpserver\r\nDate: $HTTP_DATE$\r\nContent-Type: application/mercurial-0.2\r\nTransfer-Encoding: chunked\r\n\r\n - sendall(6 from 6) -> (104) 1\\r\\n\x04\\r\\n (esc) - sendall(9 from 9) -> (95) 4\r\nnone\r\n - sendall(9 from 9) -> (86) 4\r\nHG20\r\n - sendall(9 from 9) -> (77) 4\\r\\n\x00\x00\x00\x00\\r\\n (esc) - sendall(9 from 9) -> (68) 4\\r\\n\x00\x00\x00)\\r\\n (esc) - sendall(47 from 47) -> (21) 29\\r\\n\x0bCHANGEGROUP\x00\x00\x00\x00\x01\x01\x07\x02 \x01version02nbchanges1\\r\\n (esc) - sendall(9 from 9) -> (12) 4\\r\\n\x00\x00\x01\xd2\\r\\n (esc) + sendall(167) -> HTTP/1.1 200 Script output follows\r\nServer: badhttpserver\r\nDate: $HTTP_DATE$\r\nContent-Type: application/mercurial-0.2\r\nTransfer-Encoding: chunked\r\n\r\n + sendall(6) -> 1\\r\\n\x04\\r\\n (esc) + sendall(9) -> 4\r\nnone\r\n + sendall(9) -> 4\r\nHG20\r\n + sendall(9) -> 4\\r\\n\x00\x00\x00\x00\\r\\n (esc) + sendall(9) -> 4\\r\\n\x00\x00\x00)\\r\\n (esc) + sendall(47) -> 29\\r\\n\x0bCHANGEGROUP\x00\x00\x00\x00\x01\x01\x07\x02 \x01version02nbchanges1\\r\\n (esc) + sendall(9) -> 4\\r\\n\x00\x00\x01\xd2\\r\\n (esc) sendall(12 from 473) -> (0) 1d2\\r\\n\x00\x00\x00\xb2\x96\xee\x1d (esc) write limit reached; closing socket $LOCALIP - - [$ERRDATE$] Exception happened during processing request '/?cmd=getbundle': (glob) @@ -1054,16 +1056,16 @@ #else $ "$PYTHON" $TESTDIR/filtertraceback.py < error.log | tail -15 - write(167 from 167) -> (110) HTTP/1.1 200 Script output follows\r\nServer: badhttpserver\r\nDate: $HTTP_DATE$\r\nContent-Type: application/mercurial-0.2\r\nTransfer-Encoding: chunked\r\n\r\n (py3 !) - write(28 from 28) -> (112) Transfer-Encoding: chunked\r\n - write(2 from 2) -> (110) \r\n - write(6 from 6) -> (104) 1\\r\\n\x04\\r\\n (esc) - write(9 from 9) -> (95) 4\r\nnone\r\n - write(9 from 9) -> (86) 4\r\nHG20\r\n - write(9 from 9) -> (77) 4\\r\\n\x00\x00\x00\x00\\r\\n (esc) - write(9 from 9) -> (68) 4\\r\\n\x00\x00\x00)\\r\\n (esc) - write(47 from 47) -> (21) 29\\r\\n\x0bCHANGEGROUP\x00\x00\x00\x00\x01\x01\x07\x02 \x01version02nbchanges1\\r\\n (esc) - write(9 from 9) -> (12) 4\\r\\n\x00\x00\x01\xd2\\r\\n (esc) + write(167) -> HTTP/1.1 200 Script output follows\r\nServer: badhttpserver\r\nDate: $HTTP_DATE$\r\nContent-Type: application/mercurial-0.2\r\nTransfer-Encoding: chunked\r\n\r\n (py3 !) + write(28) -> Transfer-Encoding: chunked\r\n + write(2) -> \r\n (no-py3 !) + write(6) -> 1\\r\\n\x04\\r\\n (esc) + write(9) -> 4\r\nnone\r\n + write(9) -> 4\r\nHG20\r\n + write(9) -> 4\\r\\n\x00\x00\x00\x00\\r\\n (esc) + write(9) -> 4\\r\\n\x00\x00\x00)\\r\\n (esc) + write(47) -> 29\\r\\n\x0bCHANGEGROUP\x00\x00\x00\x00\x01\x01\x07\x02 \x01version02nbchanges1\\r\\n (esc) + write(9) -> 4\\r\\n\x00\x00\x01\xd2\\r\\n (esc) write(12 from 473) -> (0) 1d2\\r\\n\x00\x00\x00\xb2\x96\xee\x1d (esc) write limit reached; closing socket $LOCALIP - - [$ERRDATE$] Exception happened during processing request '/?cmd=getbundle': (glob) To: marmoute, #hg-reviewers Cc: mercurial-patches, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D12062: test-http-bad-server: move on test from bytes-count to pattern
marmoute created this revision. Herald added a reviewer: hg-reviewers. Herald added a subscriber: mercurial-patches. REVISION SUMMARY This specific test case is now using the new "close when a pattern is seen" approach compared to the more fragile "that many bytes were sent" approach. Since such change are still a bit noisy, we split each change in there own changesets. REPOSITORY rHG Mercurial BRANCH default REVISION DETAIL https://phab.mercurial-scm.org/D12062 AFFECTED FILES tests/test-http-bad-server.t CHANGE DETAILS diff --git a/tests/test-http-bad-server.t b/tests/test-http-bad-server.t --- a/tests/test-http-bad-server.t +++ b/tests/test-http-bad-server.t @@ -964,7 +964,9 @@ Server stops sending after bundle2 part header -- - $ hg serve --config badserver.close-after-send-bytes=1048 -p $HGPORT -d --pid-file=hg.pid -E error.log + $ hg serve \ + > --config badserver.close-after-send-patterns="version02nbchanges1\\r\\n" \ + > -p $HGPORT -d --pid-file=hg.pid -E error.log $ cat hg.pid > $DAEMON_PIDS $ hg clone http://localhost:$HGPORT/ clone @@ -980,12 +982,12 @@ #if py36 $ "$PYTHON" $TESTDIR/filtertraceback.py < error.log | tail -12 - sendall(167 from 167) -> (89) HTTP/1.1 200 Script output follows\r\nServer: badhttpserver\r\nDate: $HTTP_DATE$\r\nContent-Type: application/mercurial-0.2\r\nTransfer-Encoding: chunked\r\n\r\n - sendall(6 from 6) -> (83) 1\\r\\n\x04\\r\\n (esc) - sendall(9 from 9) -> (74) 4\r\nnone\r\n - sendall(9 from 9) -> (65) 4\r\nHG20\r\n - sendall(9 from 9) -> (56) 4\\r\\n\x00\x00\x00\x00\\r\\n (esc) - sendall(9 from 9) -> (47) 4\\r\\n\x00\x00\x00)\\r\\n (esc) + sendall(167) -> HTTP/1.1 200 Script output follows\r\nServer: badhttpserver\r\nDate: $HTTP_DATE$\r\nContent-Type: application/mercurial-0.2\r\nTransfer-Encoding: chunked\r\n\r\n + sendall(6) -> 1\\r\\n\x04\\r\\n (esc) + sendall(9) -> 4\r\nnone\r\n + sendall(9) -> 4\r\nHG20\r\n + sendall(9) -> 4\\r\\n\x00\x00\x00\x00\\r\\n (esc) + sendall(9) -> 4\\r\\n\x00\x00\x00)\\r\\n (esc) sendall(47 from 47) -> (0) 29\\r\\n\x0bCHANGEGROUP\x00\x00\x00\x00\x01\x01\x07\x02 \x01version02nbchanges1\\r\\n (esc) write limit reached; closing socket $LOCALIP - - [$ERRDATE$] Exception happened during processing request '/?cmd=getbundle': (glob) @@ -996,15 +998,15 @@ #else $ "$PYTHON" $TESTDIR/filtertraceback.py < error.log | tail -14 readline(~) -> (2) \r\n (py3 !) - write(167 from 167) -> (89) HTTP/1.1 200 Script output follows\r\nServer: badhttpserver\r\nDate: $HTTP_DATE$\r\nContent-Type: application/mercurial-0.2\r\nTransfer-Encoding: chunked\r\n\r\n (py3 !) - write(41 from 41) -> (119) Content-Type: application/mercurial-0.2\r\n - write(28 from 28) -> (91) Transfer-Encoding: chunked\r\n - write(2 from 2) -> (89) \r\n - write(6 from 6) -> (83) 1\\r\\n\x04\\r\\n (esc) - write(9 from 9) -> (74) 4\r\nnone\r\n - write(9 from 9) -> (65) 4\r\nHG20\r\n - write(9 from 9) -> (56) 4\\r\\n\x00\x00\x00\x00\\r\\n (esc) - write(9 from 9) -> (47) 4\\r\\n\x00\x00\x00)\\r\\n (esc) + write(167) -> HTTP/1.1 200 Script output follows\r\nServer: badhttpserver\r\nDate: $HTTP_DATE$\r\nContent-Type: application/mercurial-0.2\r\nTransfer-Encoding: chunked\r\n\r\n (py3 !) + write(41) -> Content-Type: application/mercurial-0.2\r\n + write(28) -> Transfer-Encoding: chunked\r\n (no-py3 !) + write(2) -> \r\n (no-py3 !) + write(6) -> 1\\r\\n\x04\\r\\n (esc) + write(9) -> 4\r\nnone\r\n + write(9) -> 4\r\nHG20\r\n + write(9) -> 4\\r\\n\x00\x00\x00\x00\\r\\n (esc) + write(9) -> 4\\r\\n\x00\x00\x00)\\r\\n (esc) write(47 from 47) -> (0) 29\\r\\n\x0bCHANGEGROUP\x00\x00\x00\x00\x01\x01\x07\x02 \x01version02nbchanges1\\r\\n (esc) write limit reached; closing socket $LOCALIP - - [$ERRDATE$] Exception happened during processing request '/?cmd=getbundle': (glob) To: marmoute, #hg-reviewers Cc: mercurial-patches, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D12061: test-http-bad-server: move on test from bytes-count to pattern
marmoute created this revision. Herald added a reviewer: hg-reviewers. Herald added a subscriber: mercurial-patches. REVISION SUMMARY This specific test case is now using the new "close when a pattern is seen" approach compared to the more fragile "that many bytes were sent" approach. Since such change are still a bit noisy, we split each change in there own changesets. REPOSITORY rHG Mercurial BRANCH default REVISION DETAIL https://phab.mercurial-scm.org/D12061 AFFECTED FILES tests/test-http-bad-server.t CHANGE DETAILS diff --git a/tests/test-http-bad-server.t b/tests/test-http-bad-server.t --- a/tests/test-http-bad-server.t +++ b/tests/test-http-bad-server.t @@ -912,7 +912,9 @@ Server stops sending after bundle2 part header length - - $ hg serve --config badserver.close-after-send-bytes=1001 -p $HGPORT -d --pid-file=hg.pid -E error.log + $ hg serve \ + > --config badserver.close-after-send-patterns='4\r\n\0\0\0\)\r\n' \ + > -p $HGPORT -d --pid-file=hg.pid -E error.log $ cat hg.pid > $DAEMON_PIDS $ hg clone http://localhost:$HGPORT/ clone @@ -925,11 +927,11 @@ #if py36 $ "$PYTHON" $TESTDIR/filtertraceback.py < error.log | tail -11 - sendall(167 from 167) -> (42) HTTP/1.1 200 Script output follows\r\nServer: badhttpserver\r\nDate: $HTTP_DATE$\r\nContent-Type: application/mercurial-0.2\r\nTransfer-Encoding: chunked\r\n\r\n - sendall(6 from 6) -> (36) 1\\r\\n\x04\\r\\n (esc) - sendall(9 from 9) -> (27) 4\r\nnone\r\n - sendall(9 from 9) -> (18) 4\r\nHG20\r\n - sendall(9 from 9) -> (9) 4\\r\\n\x00\x00\x00\x00\\r\\n (esc) + sendall(167) -> HTTP/1.1 200 Script output follows\r\nServer: badhttpserver\r\nDate: $HTTP_DATE$\r\nContent-Type: application/mercurial-0.2\r\nTransfer-Encoding: chunked\r\n\r\n + sendall(6) -> 1\\r\\n\x04\\r\\n (esc) + sendall(9) -> 4\r\nnone\r\n + sendall(9) -> 4\r\nHG20\r\n + sendall(9) -> 4\\r\\n\x00\x00\x00\x00\\r\\n (esc) sendall(9 from 9) -> (0) 4\\r\\n\x00\x00\x00)\\r\\n (esc) write limit reached; closing socket $LOCALIP - - [$ERRDATE$] Exception happened during processing request '/?cmd=getbundle': (glob) @@ -941,14 +943,14 @@ $ "$PYTHON" $TESTDIR/filtertraceback.py < error.log | tail -13 readline(~) -> (2) \r\n (py3 !) - write(167 from 167) -> (42) HTTP/1.1 200 Script output follows\r\nServer: badhttpserver\r\nDate: $HTTP_DATE$\r\nContent-Type: application/mercurial-0.2\r\nTransfer-Encoding: chunked\r\n\r\n (py3 !) - write(41 from 41) -> (72) Content-Type: application/mercurial-0.2\r\n - write(28 from 28) -> (44) Transfer-Encoding: chunked\r\n - write(2 from 2) -> (42) \r\n - write(6 from 6) -> (36) 1\\r\\n\x04\\r\\n (esc) - write(9 from 9) -> (27) 4\r\nnone\r\n - write(9 from 9) -> (18) 4\r\nHG20\r\n - write(9 from 9) -> (9) 4\\r\\n\x00\x00\x00\x00\\r\\n (esc) + write(167) -> HTTP/1.1 200 Script output follows\r\nServer: badhttpserver\r\nDate: $HTTP_DATE$\r\nContent-Type: application/mercurial-0.2\r\nTransfer-Encoding: chunked\r\n\r\n (py3 !) + write(41) -> Content-Type: application/mercurial-0.2\r\n + write(28) -> Transfer-Encoding: chunked\r\n (no-py3 !) + write(2) -> \r\n (no-py3 !) + write(6) -> 1\\r\\n\x04\\r\\n (esc) + write(9) -> 4\r\nnone\r\n + write(9) -> 4\r\nHG20\r\n + write(9) -> 4\\r\\n\x00\x00\x00\x00\\r\\n (esc) write(9 from 9) -> (0) 4\\r\\n\x00\x00\x00)\\r\\n (esc) write limit reached; closing socket $LOCALIP - - [$ERRDATE$] Exception happened during processing request '/?cmd=getbundle': (glob) To: marmoute, #hg-reviewers Cc: mercurial-patches, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D12060: test-http-bad-server: move on test from bytes-count to pattern
marmoute created this revision. Herald added a reviewer: hg-reviewers. Herald added a subscriber: mercurial-patches. REVISION SUMMARY This specific test case is now using the new "close when a pattern is seen" approach compared to the more fragile "that many bytes were sent" approach. Since such change are still a bit noisy, we split each change in there own changesets. REPOSITORY rHG Mercurial BRANCH default REVISION DETAIL https://phab.mercurial-scm.org/D12060 AFFECTED FILES tests/test-http-bad-server.t CHANGE DETAILS diff --git a/tests/test-http-bad-server.t b/tests/test-http-bad-server.t --- a/tests/test-http-bad-server.t +++ b/tests/test-http-bad-server.t @@ -863,7 +863,9 @@ Servers stops after bundle2 stream params header - $ hg serve --config badserver.close-after-send-bytes=992 -p $HGPORT -d --pid-file=hg.pid -E error.log + $ hg serve \ + > --config badserver.close-after-send-patterns='4\r\n\0\0\0\0\r\n' \ + > -p $HGPORT -d --pid-file=hg.pid -E error.log $ cat hg.pid > $DAEMON_PIDS $ hg clone http://localhost:$HGPORT/ clone @@ -876,10 +878,10 @@ #if py36 $ "$PYTHON" $TESTDIR/filtertraceback.py < error.log | tail -10 - sendall(167 from 167) -> (33) HTTP/1.1 200 Script output follows\r\nServer: badhttpserver\r\nDate: $HTTP_DATE$\r\nContent-Type: application/mercurial-0.2\r\nTransfer-Encoding: chunked\r\n\r\n - sendall(6 from 6) -> (27) 1\\r\\n\x04\\r\\n (esc) - sendall(9 from 9) -> (18) 4\r\nnone\r\n - sendall(9 from 9) -> (9) 4\r\nHG20\r\n + sendall(167) -> HTTP/1.1 200 Script output follows\r\nServer: badhttpserver\r\nDate: $HTTP_DATE$\r\nContent-Type: application/mercurial-0.2\r\nTransfer-Encoding: chunked\r\n\r\n + sendall(6) -> 1\\r\\n\x04\\r\\n (esc) + sendall(9) -> 4\r\nnone\r\n + sendall(9) -> 4\r\nHG20\r\n sendall(9 from 9) -> (0) 4\\r\\n\x00\x00\x00\x00\\r\\n (esc) write limit reached; closing socket $LOCALIP - - [$ERRDATE$] Exception happened during processing request '/?cmd=getbundle': (glob) @@ -890,13 +892,13 @@ #else $ "$PYTHON" $TESTDIR/filtertraceback.py < error.log | tail -12 readline(~) -> (2) \r\n (py3 !) - write(167 from 167) -> (33) HTTP/1.1 200 Script output follows\r\nServer: badhttpserver\r\nDate: $HTTP_DATE$\r\nContent-Type: application/mercurial-0.2\r\nTransfer-Encoding: chunked\r\n\r\n (py3 !) - write(41 from 41) -> (63) Content-Type: application/mercurial-0.2\r\n - write(28 from 28) -> (35) Transfer-Encoding: chunked\r\n - write(2 from 2) -> (33) \r\n - write(6 from 6) -> (27) 1\\r\\n\x04\\r\\n (esc) - write(9 from 9) -> (18) 4\r\nnone\r\n - write(9 from 9) -> (9) 4\r\nHG20\r\n + write(167) -> HTTP/1.1 200 Script output follows\r\nServer: badhttpserver\r\nDate: $HTTP_DATE$\r\nContent-Type: application/mercurial-0.2\r\nTransfer-Encoding: chunked\r\n\r\n (py3 !) + write(41) -> Content-Type: application/mercurial-0.2\r\n + write(28) -> Transfer-Encoding: chunked\r\n (no-py3 !) + write(2) -> \r\n (no-py3 !) + write(6) -> 1\\r\\n\x04\\r\\n (esc) + write(9) -> 4\r\nnone\r\n + write(9) -> 4\r\nHG20\r\n write(9 from 9) -> (0) 4\\r\\n\x00\x00\x00\x00\\r\\n (esc) write limit reached; closing socket $LOCALIP - - [$ERRDATE$] Exception happened during processing request '/?cmd=getbundle': (glob) To: marmoute, #hg-reviewers Cc: mercurial-patches, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D12059: test-http-bad-server: move on test from bytes-count to pattern
marmoute created this revision. Herald added a reviewer: hg-reviewers. Herald added a subscriber: mercurial-patches. REVISION SUMMARY This specific test case is now using the new "close when a pattern is seen" approach compared to the more fragile "that many bytes were sent" approach. Since such change are still a bit noisy, we split each change in there own changesets. REPOSITORY rHG Mercurial BRANCH default REVISION DETAIL https://phab.mercurial-scm.org/D12059 AFFECTED FILES tests/test-http-bad-server.t CHANGE DETAILS diff --git a/tests/test-http-bad-server.t b/tests/test-http-bad-server.t --- a/tests/test-http-bad-server.t +++ b/tests/test-http-bad-server.t @@ -813,7 +813,9 @@ Server sends incomplete bundle2 stream params length - $ hg serve --config badserver.close-after-send-bytes=989 -p $HGPORT -d --pid-file=hg.pid -E error.log + $ hg serve \ + > --config badserver.close-after-send-patterns='4\r\n\0\0\0' \ + > -p $HGPORT -d --pid-file=hg.pid -E error.log $ cat hg.pid > $DAEMON_PIDS $ hg clone http://localhost:$HGPORT/ clone @@ -827,10 +829,10 @@ #if py36 $ "$PYTHON" $TESTDIR/filtertraceback.py < error.log | tail -10 - sendall(167 from 167) -> (30) HTTP/1.1 200 Script output follows\r\nServer: badhttpserver\r\nDate: $HTTP_DATE$\r\nContent-Type: application/mercurial-0.2\r\nTransfer-Encoding: chunked\r\n\r\n - sendall(6 from 6) -> (24) 1\\r\\n\x04\\r\\n (esc) - sendall(9 from 9) -> (15) 4\r\nnone\r\n - sendall(9 from 9) -> (6) 4\r\nHG20\r\n + sendall(167) -> HTTP/1.1 200 Script output follows\r\nServer: badhttpserver\r\nDate: $HTTP_DATE$\r\nContent-Type: application/mercurial-0.2\r\nTransfer-Encoding: chunked\r\n\r\n + sendall(6) -> 1\\r\\n\x04\\r\\n (esc) + sendall(9) -> 4\r\nnone\r\n + sendall(9) -> 4\r\nHG20\r\n sendall(6 from 9) -> (0) 4\\r\\n\x00\x00\x00 (esc) write limit reached; closing socket $LOCALIP - - [$ERRDATE$] Exception happened during processing request '/?cmd=getbundle': (glob) @@ -841,13 +843,13 @@ #else $ "$PYTHON" $TESTDIR/filtertraceback.py < error.log | tail -12 readline(~) -> (2) \r\n (py3 !) - write(167 from 167) -> (30) HTTP/1.1 200 Script output follows\r\nServer: badhttpserver\r\nDate: $HTTP_DATE$\r\nContent-Type: application/mercurial-0.2\r\nTransfer-Encoding: chunked\r\n\r\n (py3 !) - write(41 from 41) -> (60) Content-Type: application/mercurial-0.2\r\n - write(28 from 28) -> (32) Transfer-Encoding: chunked\r\n - write(2 from 2) -> (30) \r\n - write(6 from 6) -> (24) 1\\r\\n\x04\\r\\n (esc) - write(9 from 9) -> (15) 4\r\nnone\r\n - write(9 from 9) -> (6) 4\r\nHG20\r\n + write(167) -> HTTP/1.1 200 Script output follows\r\nServer: badhttpserver\r\nDate: $HTTP_DATE$\r\nContent-Type: application/mercurial-0.2\r\nTransfer-Encoding: chunked\r\n\r\n (py3 !) + write(41) -> Content-Type: application/mercurial-0.2\r\n + write(28) -> Transfer-Encoding: chunked\r\n (no-py3 !) + write(2) -> \r\n (no-py3 !) + write(6) -> 1\\r\\n\x04\\r\\n (esc) + write(9) -> 4\r\nnone\r\n + write(9) -> 4\r\nHG20\r\n write(6 from 9) -> (0) 4\\r\\n\x00\x00\x00 (esc) write limit reached; closing socket $LOCALIP - - [$ERRDATE$] Exception happened during processing request '/?cmd=getbundle': (glob) To: marmoute, #hg-reviewers Cc: mercurial-patches, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D12058: test-http-bad-server: move on test from bytes-count to pattern
marmoute created this revision. Herald added a reviewer: hg-reviewers. Herald added a subscriber: mercurial-patches. REVISION SUMMARY This specific test case is now using the new "close when a pattern is seen" approach compared to the more fragile "that many bytes were sent" approach. Since such change are still a bit noisy, we split each change in there own changesets. REPOSITORY rHG Mercurial BRANCH default REVISION DETAIL https://phab.mercurial-scm.org/D12058 AFFECTED FILES tests/test-http-bad-server.t CHANGE DETAILS diff --git a/tests/test-http-bad-server.t b/tests/test-http-bad-server.t --- a/tests/test-http-bad-server.t +++ b/tests/test-http-bad-server.t @@ -765,7 +765,9 @@ Server sends partial bundle2 header magic - - $ hg serve --config badserver.close-after-send-bytes=980 -p $HGPORT -d --pid-file=hg.pid -E error.log + $ hg serve \ + > --config badserver.close-after-send-patterns='4\r\nHG2' \ + > -p $HGPORT -d --pid-file=hg.pid -E error.log $ cat hg.pid > $DAEMON_PIDS $ hg clone http://localhost:$HGPORT/ clone @@ -779,9 +781,9 @@ #if py36 $ "$PYTHON" $TESTDIR/filtertraceback.py < error.log | tail -9 - sendall(167 from 167) -> (21) HTTP/1.1 200 Script output follows\r\nServer: badhttpserver\r\nDate: $HTTP_DATE$\r\nContent-Type: application/mercurial-0.2\r\nTransfer-Encoding: chunked\r\n\r\n - sendall(6 from 6) -> (15) 1\\r\\n\x04\\r\\n (esc) - sendall(9 from 9) -> (6) 4\r\nnone\r\n + sendall(167) -> HTTP/1.1 200 Script output follows\r\nServer: badhttpserver\r\nDate: $HTTP_DATE$\r\nContent-Type: application/mercurial-0.2\r\nTransfer-Encoding: chunked\r\n\r\n + sendall(6) -> 1\\r\\n\x04\\r\\n (esc) + sendall(9) -> 4\r\nnone\r\n sendall(6 from 9) -> (0) 4\r\nHG2 write limit reached; closing socket $LOCALIP - - [$ERRDATE$] Exception happened during processing request '/?cmd=getbundle': (glob) @@ -792,12 +794,12 @@ #else $ "$PYTHON" $TESTDIR/filtertraceback.py < error.log | tail -11 readline(~) -> (2) \r\n (py3 !) - write(167 from 167) -> (21) HTTP/1.1 200 Script output follows\r\nServer: badhttpserver\r\nDate: $HTTP_DATE$\r\nContent-Type: application/mercurial-0.2\r\nTransfer-Encoding: chunked\r\n\r\n (py3 !) - write(41 from 41) -> (51) Content-Type: application/mercurial-0.2\r\n - write(28 from 28) -> (23) Transfer-Encoding: chunked\r\n - write(2 from 2) -> (21) \r\n - write(6 from 6) -> (15) 1\\r\\n\x04\\r\\n (esc) - write(9 from 9) -> (6) 4\r\nnone\r\n + write(167) -> HTTP/1.1 200 Script output follows\r\nServer: badhttpserver\r\nDate: $HTTP_DATE$\r\nContent-Type: application/mercurial-0.2\r\nTransfer-Encoding: chunked\r\n\r\n (py3 !) + write(41) -> Content-Type: application/mercurial-0.2\r\n (no-py3 !) + write(28) -> Transfer-Encoding: chunked\r\n (no-py3 !) + write(2) -> \r\n (no-py3 !) + write(6) -> 1\\r\\n\x04\\r\\n (esc) + write(9) -> 4\r\nnone\r\n write(6 from 9) -> (0) 4\r\nHG2 write limit reached; closing socket $LOCALIP - - [$ERRDATE$] Exception happened during processing request '/?cmd=getbundle': (glob) To: marmoute, #hg-reviewers Cc: mercurial-patches, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D12057: test-http-bad-server: move on test from bytes-count to pattern
marmoute created this revision. Herald added a reviewer: hg-reviewers. Herald added a subscriber: mercurial-patches. REVISION SUMMARY This specific test case is now using the new "close when a pattern is seen" approach compared to the more fragile "that many bytes were sent" approach. Since such change are still a bit noisy, we split each change in there own changesets. REPOSITORY rHG Mercurial BRANCH default REVISION DETAIL https://phab.mercurial-scm.org/D12057 AFFECTED FILES tests/test-http-bad-server.t CHANGE DETAILS diff --git a/tests/test-http-bad-server.t b/tests/test-http-bad-server.t --- a/tests/test-http-bad-server.t +++ b/tests/test-http-bad-server.t @@ -681,7 +681,9 @@ Server sends partial compression string --- - $ hg serve --config badserver.close-after-send-bytes=983 -p $HGPORT -d --pid-file=hg.pid -E error.log + $ hg serve \ + > --config badserver.close-after-send-patterns='4\r\nHG20\r\n' \ + > -p $HGPORT -d --pid-file=hg.pid -E error.log $ cat hg.pid > $DAEMON_PIDS $ hg clone http://localhost:$HGPORT/ clone @@ -699,17 +701,17 @@ readline(*) -> (2?) host: localhost:$HGPORT\r\n (glob) readline(*) -> (49) user-agent: mercurial/proto-1.0 (Mercurial 4.2)\r\n (glob) readline(*) -> (2) \r\n (glob) - sendall(160 from 160) -> (823) HTTP/1.1 200 Script output follows\r\nServer: badhttpserver\r\nDate: $HTTP_DATE$\r\nContent-Type: application/mercurial-0.1\r\nContent-Length: 431\r\n\r\n (py36 !) - sendall(431 from 431) -> (392) batch branchmap $USUAL_BUNDLE2_CAPS_NO_PHASES$ changegroupsubset compression=none getbundle httpheader=1024 httpmediatype=0.1rx,0.1tx,0.2tx known lookup pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash (py36 !) - write(160 from 160) -> (842) HTTP/1.1 200 Script output follows\r\nServer: badhttpserver\r\nDate: $HTTP_DATE$\r\nContent-Type: application/mercurial-0.1\r\nContent-Length: 431\r\n\r\n (py3 no-py36 !) - write(431 from 431) -> (392) batch branchmap $USUAL_BUNDLE2_CAPS_NO_PHASES$ changegroupsubset compression=none getbundle httpheader=1024 httpmediatype=0.1rx,0.1tx,0.2tx known lookup pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash (py3 no-py36 !) - write(36 from 36) -> (947) HTTP/1.1 200 Script output follows\r\n (no-py3 !) - write(23 from 23) -> (924) Server: badhttpserver\r\n (no-py3 !) - write(37 from 37) -> (887) Date: $HTTP_DATE$\r\n (no-py3 !) - write(41 from 41) -> (846) Content-Type: application/mercurial-0.1\r\n (no-py3 !) - write(21 from 21) -> (825) Content-Length: 431\r\n (no-py3 !) - write(2 from 2) -> (823) \r\n (no-py3 !) - write(431 from 431) -> (392) batch branchmap $USUAL_BUNDLE2_CAPS_NO_PHASES$ changegroupsubset compression=none getbundle httpheader=1024 httpmediatype=0.1rx,0.1tx,0.2tx known lookup pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash (no-py3 !) + sendall(160) -> HTTP/1.1 200 Script output follows\r\nServer: badhttpserver\r\nDate: $HTTP_DATE$\r\nContent-Type: application/mercurial-0.1\r\nContent-Length: 431\r\n\r\n (py36 !) + sendall(431) -> batch branchmap $USUAL_BUNDLE2_CAPS_NO_PHASES$ changegroupsubset compression=none getbundle httpheader=1024 httpmediatype=0.1rx,0.1tx,0.2tx known lookup pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash (py36 !) + write(160) -> HTTP/1.1 200 Script output follows\r\nServer: badhttpserver\r\nDate: $HTTP_DATE$\r\nContent-Type: application/mercurial-0.1\r\nContent-Length: 431\r\n\r\n (py3 no-py36 !) + write(431) -> batch branchmap $USUAL_BUNDLE2_CAPS_NO_PHASES$ changegroupsubset compression=none getbundle httpheader=1024 httpmediatype=0.1rx,0.1tx,0.2tx known lookup pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash (py3 no-py36 !) + write(36) -> HTTP/1.1 200 Script output follows\r\n (no-py3 !) + write(23) -> Server: badhttpserver\r\n (no-py3 !) + write(37) -> Date: $HTTP_DATE$\r\n (no-py3 !) + write(41) -> Content-Type: application/mercurial-0.1\r\n (no-py3 !) + write(21) -> Content-Length: 431\r\n (no-py3 !) + write(2) -> \r\n (no-py3 !) + write(431) -> batch branchmap $USUAL_BUNDLE2_CAPS_NO_PHASES$ changegroupsubset compression=none getbundle httpheader=1024 httpmediatype=0.1rx,0.1tx,0.2tx known lookup pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash (no-py3 !) readline(~) -> (26) GET /?cmd=batch HTTP/1.1\r\n readline(*) -> (27) Accept-Encoding: identity\r\n (glob) readline(*) -> (29) vary: X-HgArg-1,X-HgProto-1\r\n (glob) @@ -719,16 +721,16 @@ readline(*) -> (2?) host: localhost:$HGPORT\r\n (glob) readline(*) -> (49) user-agent: mercurial/proto-1.0 (Mercurial 4.2)\r\n (glob) readline(*) -> (2) \r\n (glob) - sendall(159 from 159) -> (233) HTTP/1.1 200 Script output follows\r\nServer: badhttpserver\r\nDate: $HTTP_DATE$\r\nContent-Type:
D12056: test-http-bad-server: move on test from bytes-count to pattern
marmoute created this revision. Herald added a reviewer: hg-reviewers. Herald added a subscriber: mercurial-patches. REVISION SUMMARY This specific test case is now using the new "close when a pattern is seen" approach compared to the more fragile "that many bytes were sent" approach. Since such change are still a bit noisy, we split each change in there own changesets. REPOSITORY rHG Mercurial BRANCH default REVISION DETAIL https://phab.mercurial-scm.org/D12056 AFFECTED FILES tests/test-http-bad-server.t CHANGE DETAILS diff --git a/tests/test-http-bad-server.t b/tests/test-http-bad-server.t --- a/tests/test-http-bad-server.t +++ b/tests/test-http-bad-server.t @@ -601,7 +601,9 @@ Server sends empty HTTP body for getbundle -- - $ hg serve --config badserver.close-after-send-bytes=959 -p $HGPORT -d --pid-file=hg.pid -E error.log + $ hg serve \ + > --config badserver.close-after-send-patterns='Transfer-Encoding: chunked\r\n\r\n' \ + > -p $HGPORT -d --pid-file=hg.pid -E error.log $ cat hg.pid > $DAEMON_PIDS $ hg clone http://localhost:$HGPORT/ clone @@ -619,17 +621,17 @@ readline(*) -> (2?) host: localhost:$HGPORT\r\n (glob) readline(*) -> (49) user-agent: mercurial/proto-1.0 (Mercurial 4.2)\r\n (glob) readline(*) -> (2) \r\n (glob) - sendall(160 from 160) -> (799) HTTP/1.1 200 Script output follows\r\nServer: badhttpserver\r\nDate: $HTTP_DATE$\r\nContent-Type: application/mercurial-0.1\r\nContent-Length: 431\r\n\r\n (py36 !) - sendall(431 from 431) -> (368) batch branchmap $USUAL_BUNDLE2_CAPS_NO_PHASES$ changegroupsubset compression=none getbundle httpheader=1024 httpmediatype=0.1rx,0.1tx,0.2tx known lookup pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash (py36 !) - write(160 from 160) -> (818) HTTP/1.1 200 Script output follows\r\nServer: badhttpserver\r\nDate: $HTTP_DATE$\r\nContent-Type: application/mercurial-0.1\r\nContent-Length: 431\r\n\r\n (py3 no-py36 !) - write(431 from 431) -> (368) batch branchmap $USUAL_BUNDLE2_CAPS_NO_PHASES$ changegroupsubset compression=none getbundle httpheader=1024 httpmediatype=0.1rx,0.1tx,0.2tx known lookup pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash (py3 no-py36 !) - write(36 from 36) -> (923) HTTP/1.1 200 Script output follows\r\n (no-py3 !) - write(23 from 23) -> (900) Server: badhttpserver\r\n (no-py3 !) - write(37 from 37) -> (863) Date: $HTTP_DATE$\r\n (no-py3 !) - write(41 from 41) -> (822) Content-Type: application/mercurial-0.1\r\n (no-py3 !) - write(21 from 21) -> (801) Content-Length: 431\r\n (no-py3 !) - write(2 from 2) -> (799) \r\n (no-py3 !) - write(431 from 431) -> (368) batch branchmap $USUAL_BUNDLE2_CAPS_NO_PHASES$ changegroupsubset compression=none getbundle httpheader=1024 httpmediatype=0.1rx,0.1tx,0.2tx known lookup pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash (no-py3 !) + sendall(160) -> HTTP/1.1 200 Script output follows\r\nServer: badhttpserver\r\nDate: $HTTP_DATE$\r\nContent-Type: application/mercurial-0.1\r\nContent-Length: 431\r\n\r\n (py36 !) + sendall(431) -> batch branchmap $USUAL_BUNDLE2_CAPS_NO_PHASES$ changegroupsubset compression=none getbundle httpheader=1024 httpmediatype=0.1rx,0.1tx,0.2tx known lookup pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash (py36 !) + write(160) -> HTTP/1.1 200 Script output follows\r\nServer: badhttpserver\r\nDate: $HTTP_DATE$\r\nContent-Type: application/mercurial-0.1\r\nContent-Length: 431\r\n\r\n (py3 no-py36 !) + write(431) -> batch branchmap $USUAL_BUNDLE2_CAPS_NO_PHASES$ changegroupsubset compression=none getbundle httpheader=1024 httpmediatype=0.1rx,0.1tx,0.2tx known lookup pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash (py3 no-py36 !) + write(36) -> HTTP/1.1 200 Script output follows\r\n (no-py3 !) + write(23) -> Server: badhttpserver\r\n (no-py3 !) + write(37) -> Date: $HTTP_DATE$\r\n (no-py3 !) + write(41) -> Content-Type: application/mercurial-0.1\r\n (no-py3 !) + write(21) -> Content-Length: 431\r\n (no-py3 !) + write(2) -> \r\n (no-py3 !) + write(431) -> batch branchmap $USUAL_BUNDLE2_CAPS_NO_PHASES$ changegroupsubset compression=none getbundle httpheader=1024 httpmediatype=0.1rx,0.1tx,0.2tx known lookup pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash (no-py3 !) readline(~) -> (26) GET /?cmd=batch HTTP/1.1\r\n readline(*) -> (27) Accept-Encoding: identity\r\n (glob) readline(*) -> (29) vary: X-HgArg-1,X-HgProto-1\r\n (glob) @@ -639,17 +641,17 @@ readline(*) -> (2?) host: localhost:$HGPORT\r\n (glob) readline(*) -> (49) user-agent: mercurial/proto-1.0 (Mercurial 4.2)\r\n (glob) readline(*) -> (2) \r\n (glob) - sendall(159 from 159) -> (209) HTTP/1.1 200 Script output follows\r\nServer: badhttpserver\r\nDate:
D12055: test-http-bad-server: move on test from bytes-count to pattern
marmoute created this revision. Herald added a reviewer: hg-reviewers. Herald added a subscriber: mercurial-patches. REVISION SUMMARY This specific test case is now using the new "close when a pattern is seen" approach compared to the more fragile "that many bytes were sent" approach. Since such change are still a bit noisy, we split each change in there own changesets. REPOSITORY rHG Mercurial BRANCH default REVISION DETAIL https://phab.mercurial-scm.org/D12055 AFFECTED FILES tests/test-http-bad-server.t CHANGE DETAILS diff --git a/tests/test-http-bad-server.t b/tests/test-http-bad-server.t --- a/tests/test-http-bad-server.t +++ b/tests/test-http-bad-server.t @@ -563,7 +563,9 @@ Server stops before it sends transfer encoding -- - $ hg serve --config badserver.close-after-send-bytes=954 -p $HGPORT -d --pid-file=hg.pid -E error.log + $ hg serve \ + > --config badserver.close-after-send-patterns="Transfer-Encoding: chunke" \ + > -p $HGPORT -d --pid-file=hg.pid -E error.log $ cat hg.pid > $DAEMON_PIDS $ hg clone http://localhost:$HGPORT/ clone @@ -584,7 +586,7 @@ #else $ "$PYTHON" $TESTDIR/filtertraceback.py < error.log | tail -7 - write(41 from 41) -> (25) Content-Type: application/mercurial-0.2\r\n + write(41) -> Content-Type: application/mercurial-0.2\r\n write(25 from 28) -> (0) Transfer-Encoding: chunke write limit reached; closing socket $LOCALIP - - [$ERRDATE$] Exception happened during processing request '/?cmd=getbundle': (glob) To: marmoute, #hg-reviewers Cc: mercurial-patches, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D12054: test-http-bad-server: modify some `tail` call fit their goal
marmoute created this revision. Herald added a reviewer: hg-reviewers. Herald added a subscriber: mercurial-patches. REVISION SUMMARY We want to check that we stop writing when we want to stop writing. REPOSITORY rHG Mercurial BRANCH default REVISION DETAIL https://phab.mercurial-scm.org/D12054 AFFECTED FILES tests/test-http-bad-server.t CHANGE DETAILS diff --git a/tests/test-http-bad-server.t b/tests/test-http-bad-server.t --- a/tests/test-http-bad-server.t +++ b/tests/test-http-bad-server.t @@ -574,13 +574,19 @@ $ killdaemons.py $DAEMON_PIDS #if py36 - $ "$PYTHON" $TESTDIR/filtertraceback.py < error.log | tail -3 + $ "$PYTHON" $TESTDIR/filtertraceback.py < error.log | tail -6 + sendall(162 from 167) -> (0) HTTP/1.1 200 Script output follows\r\nServer: badhttpserver\r\nDate: $HTTP_DATE$\r\nContent-Type: application/mercurial-0.2\r\nTransfer-Encoding: chunke + write limit reached; closing socket + $LOCALIP - - [$ERRDATE$] Exception happened during processing request '/?cmd=getbundle': (glob) Traceback (most recent call last): Exception: connection closed after sending N bytes #else - $ "$PYTHON" $TESTDIR/filtertraceback.py < error.log | tail -4 + $ "$PYTHON" $TESTDIR/filtertraceback.py < error.log | tail -7 + write(41 from 41) -> (25) Content-Type: application/mercurial-0.2\r\n + write(25 from 28) -> (0) Transfer-Encoding: chunke + write limit reached; closing socket $LOCALIP - - [$ERRDATE$] Exception happened during processing request '/?cmd=getbundle': (glob) Traceback (most recent call last): Exception: connection closed after sending N bytes To: marmoute, #hg-reviewers Cc: mercurial-patches, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D12053: test-http-bad-server: move on test from bytes-count to pattern
marmoute created this revision. Herald added a reviewer: hg-reviewers. Herald added a subscriber: mercurial-patches. REVISION SUMMARY This specific test case is now using the new "close when a pattern is seen" approach compared to the more fragile "that many bytes were sent" approach. Since such change are still a bit noisy, we split each change in there own changesets. REPOSITORY rHG Mercurial BRANCH default REVISION DETAIL https://phab.mercurial-scm.org/D12053 AFFECTED FILES tests/test-http-bad-server.t CHANGE DETAILS diff --git a/tests/test-http-bad-server.t b/tests/test-http-bad-server.t --- a/tests/test-http-bad-server.t +++ b/tests/test-http-bad-server.t @@ -480,7 +480,9 @@ Server sends incomplete headers for getbundle response -- - $ hg serve --config badserver.close-after-send-bytes=921 -p $HGPORT -d --pid-file=hg.pid -E error.log + $ hg serve \ + > --config badserver.close-after-send-patterns='(.*Content-Type: application/mercuri){3}' \ + > -p $HGPORT -d --pid-file=hg.pid -E error.log $ cat hg.pid > $DAEMON_PIDS TODO this output is terrible @@ -503,17 +505,17 @@ readline(*) -> (2?) host: localhost:$HGPORT\r\n (glob) readline(*) -> (49) user-agent: mercurial/proto-1.0 (Mercurial 4.2)\r\n (glob) readline(*) -> (2) \r\n (glob) - sendall(160 from 160) -> (761) HTTP/1.1 200 Script output follows\r\nServer: badhttpserver\r\nDate: $HTTP_DATE$\r\nContent-Type: application/mercurial-0.1\r\nContent-Length: 431\r\n\r\n (py36 !) - sendall(431 from 431) -> (330) batch branchmap $USUAL_BUNDLE2_CAPS_NO_PHASES$ changegroupsubset compression=none getbundle httpheader=1024 httpmediatype=0.1rx,0.1tx,0.2tx known lookup pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash (py36 !) - write(160 from 160) -> (780) HTTP/1.1 200 Script output follows\r\nServer: badhttpserver\r\nDate: $HTTP_DATE$\r\nContent-Type: application/mercurial-0.1\r\nContent-Length: 431\r\n\r\n (py3 no-py36 !) - write(431 from 431) -> (330) batch branchmap $USUAL_BUNDLE2_CAPS_NO_PHASES$ changegroupsubset compression=none getbundle httpheader=1024 httpmediatype=0.1rx,0.1tx,0.2tx known lookup pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash (py3 no-py36 !) - write(36 from 36) -> (885) HTTP/1.1 200 Script output follows\r\n (no-py3 !) - write(23 from 23) -> (862) Server: badhttpserver\r\n (no-py3 !) - write(37 from 37) -> (825) Date: $HTTP_DATE$\r\n (no-py3 !) - write(41 from 41) -> (784) Content-Type: application/mercurial-0.1\r\n (no-py3 !) - write(21 from 21) -> (763) Content-Length: 431\r\n (no-py3 !) - write(2 from 2) -> (761) \r\n (no-py3 !) - write(431 from 431) -> (330) batch branchmap $USUAL_BUNDLE2_CAPS_NO_PHASES$ changegroupsubset compression=none getbundle httpheader=1024 httpmediatype=0.1rx,0.1tx,0.2tx known lookup pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash (no-py3 !) + sendall(160) -> HTTP/1.1 200 Script output follows\r\nServer: badhttpserver\r\nDate: $HTTP_DATE$\r\nContent-Type: application/mercurial-0.1\r\nContent-Length: 431\r\n\r\n (py36 !) + sendall(431) -> batch branchmap $USUAL_BUNDLE2_CAPS_NO_PHASES$ changegroupsubset compression=none getbundle httpheader=1024 httpmediatype=0.1rx,0.1tx,0.2tx known lookup pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash (py36 !) + write(160) -> HTTP/1.1 200 Script output follows\r\nServer: badhttpserver\r\nDate: $HTTP_DATE$\r\nContent-Type: application/mercurial-0.1\r\nContent-Length: 431\r\n\r\n (py3 no-py36 !) + write(431) -> batch branchmap $USUAL_BUNDLE2_CAPS_NO_PHASES$ changegroupsubset compression=none getbundle httpheader=1024 httpmediatype=0.1rx,0.1tx,0.2tx known lookup pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash (py3 no-py36 !) + write(36) -> HTTP/1.1 200 Script output follows\r\n (no-py3 !) + write(23) -> Server: badhttpserver\r\n (no-py3 !) + write(37) -> Date: $HTTP_DATE$\r\n (no-py3 !) + write(41) -> Content-Type: application/mercurial-0.1\r\n (no-py3 !) + write(21) -> Content-Length: 431\r\n (no-py3 !) + write(2) -> \r\n (no-py3 !) + write(431) -> batch branchmap $USUAL_BUNDLE2_CAPS_NO_PHASES$ changegroupsubset compression=none getbundle httpheader=1024 httpmediatype=0.1rx,0.1tx,0.2tx known lookup pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash (no-py3 !) readline(~) -> (26) GET /?cmd=batch HTTP/1.1\r\n readline(*) -> (27) Accept-Encoding: identity\r\n (glob) readline(*) -> (29) vary: X-HgArg-1,X-HgProto-1\r\n (glob) @@ -523,17 +525,17 @@ readline(*) -> (2?) host: localhost:$HGPORT\r\n (glob) readline(*) -> (49) user-agent: mercurial/proto-1.0 (Mercurial 4.2)\r\n (glob) readline(*) -> (2) \r\n (glob) - sendall(159 from 159) -> (171) HTTP/1.1 200 Script output follows\r\nServer:
D12052: test-http-bad-server: move on test from bytes-count to pattern
marmoute created this revision. Herald added a reviewer: hg-reviewers. Herald added a subscriber: mercurial-patches. REVISION SUMMARY This specific test case is now using the new "close when a pattern is seen" approach compared to the more fragile "that many bytes were sent" approach. Since such change are still a bit noisy, we split each change in there own changesets. REPOSITORY rHG Mercurial BRANCH default REVISION DETAIL https://phab.mercurial-scm.org/D12052 AFFECTED FILES tests/test-http-bad-server.t CHANGE DETAILS diff --git a/tests/test-http-bad-server.t b/tests/test-http-bad-server.t --- a/tests/test-http-bad-server.t +++ b/tests/test-http-bad-server.t @@ -415,7 +415,9 @@ Server sends an incomplete HTTP response body to batch request -- - $ hg serve --config badserver.close-after-send-bytes=774 -p $HGPORT -d --pid-file=hg.pid -E error.log + $ hg serve \ + > --config badserver.close-after-send-patterns=96ee1d7354c4ad7372047672 \ + > -p $HGPORT -d --pid-file=hg.pid -E error.log $ cat hg.pid > $DAEMON_PIDS TODO client spews a stack due to uncaught ValueError in batch.results() @@ -436,17 +438,17 @@ readline(*) -> (2?) host: localhost:$HGPORT\r\n (glob) readline(*) -> (49) user-agent: mercurial/proto-1.0 (Mercurial 4.2)\r\n (glob) readline(*) -> (2) \r\n (glob) - sendall(160 from 160) -> (614) HTTP/1.1 200 Script output follows\r\nServer: badhttpserver\r\nDate: $HTTP_DATE$\r\nContent-Type: application/mercurial-0.1\r\nContent-Length: 431\r\n\r\n (py36 !) - sendall(431 from 431) -> (183) batch branchmap $USUAL_BUNDLE2_CAPS_NO_PHASES$ changegroupsubset compression=none getbundle httpheader=1024 httpmediatype=0.1rx,0.1tx,0.2tx known lookup pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash (py36 !) - write(160 from 160) -> (633) HTTP/1.1 200 Script output follows\r\nServer: badhttpserver\r\nDate: $HTTP_DATE$\r\nContent-Type: application/mercurial-0.1\r\nContent-Length: 431\r\n\r\n (py3 no-py36 !) - write(431 from 431) -> (183) batch branchmap $USUAL_BUNDLE2_CAPS_NO_PHASES$ changegroupsubset compression=none getbundle httpheader=1024 httpmediatype=0.1rx,0.1tx,0.2tx known lookup pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash (py3 no-py36 !) - write(36 from 36) -> (738) HTTP/1.1 200 Script output follows\r\n (no-py3 !) - write(23 from 23) -> (715) Server: badhttpserver\r\n (no-py3 !) - write(37 from 37) -> (678) Date: $HTTP_DATE$\r\n (no-py3 !) - write(41 from 41) -> (637) Content-Type: application/mercurial-0.1\r\n (no-py3 !) - write(21 from 21) -> (616) Content-Length: 431\r\n (no-py3 !) - write(2 from 2) -> (614) \r\n (no-py3 !) - write(431 from 431) -> (183) batch branchmap $USUAL_BUNDLE2_CAPS_NO_PHASES$ changegroupsubset compression=none getbundle httpheader=1024 httpmediatype=0.1rx,0.1tx,0.2tx known lookup pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash (no-py3 !) + sendall(160) -> HTTP/1.1 200 Script output follows\r\nServer: badhttpserver\r\nDate: $HTTP_DATE$\r\nContent-Type: application/mercurial-0.1\r\nContent-Length: 431\r\n\r\n (py36 !) + sendall(431) -> batch branchmap $USUAL_BUNDLE2_CAPS_NO_PHASES$ changegroupsubset compression=none getbundle httpheader=1024 httpmediatype=0.1rx,0.1tx,0.2tx known lookup pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash (py36 !) + write(160) -> HTTP/1.1 200 Script output follows\r\nServer: badhttpserver\r\nDate: $HTTP_DATE$\r\nContent-Type: application/mercurial-0.1\r\nContent-Length: 431\r\n\r\n (py3 no-py36 !) + write(431) -> batch branchmap $USUAL_BUNDLE2_CAPS_NO_PHASES$ changegroupsubset compression=none getbundle httpheader=1024 httpmediatype=0.1rx,0.1tx,0.2tx known lookup pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash (py3 no-py36 !) + write(36) -> HTTP/1.1 200 Script output follows\r\n (no-py3 !) + write(23) -> Server: badhttpserver\r\n (no-py3 !) + write(37) -> Date: $HTTP_DATE$\r\n (no-py3 !) + write(41) -> Content-Type: application/mercurial-0.1\r\n (no-py3 !) + write(21) -> Content-Length: 431\r\n (no-py3 !) + write(2) -> \r\n (no-py3 !) + write(431) -> batch branchmap $USUAL_BUNDLE2_CAPS_NO_PHASES$ changegroupsubset compression=none getbundle httpheader=1024 httpmediatype=0.1rx,0.1tx,0.2tx known lookup pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash (no-py3 !) readline(~) -> (26) GET /?cmd=batch HTTP/1.1\r\n readline(*) -> (27) Accept-Encoding: identity\r\n (glob) readline(*) -> (29) vary: X-HgArg-1,X-HgProto-1\r\n (glob) @@ -456,16 +458,16 @@ readline(*) -> (2?) host: localhost:$HGPORT\r\n (glob) readline(*) -> (49) user-agent: mercurial/proto-1.0 (Mercurial 4.2)\r\n (glob) readline(*) -> (2) \r\n (glob) - sendall(159 from 159) -> (24) HTTP/1.1 200 Script
D12051: test-http-bad-server: move on test from bytes-count to pattern
marmoute created this revision. Herald added a reviewer: hg-reviewers. Herald added a subscriber: mercurial-patches. REVISION SUMMARY This specific test case is now using the new "close when a pattern is seen" approach compared to the more fragile "that many bytes were sent" approach. Since such change are still a bit noisy, we split each change in there own changesets. REPOSITORY rHG Mercurial BRANCH default REVISION DETAIL https://phab.mercurial-scm.org/D12051 AFFECTED FILES tests/test-http-bad-server.t CHANGE DETAILS diff --git a/tests/test-http-bad-server.t b/tests/test-http-bad-server.t --- a/tests/test-http-bad-server.t +++ b/tests/test-http-bad-server.t @@ -353,7 +353,9 @@ Server sends incomplete headers for batch request - - $ hg serve --config badserver.close-after-send-bytes=709 -p $HGPORT -d --pid-file=hg.pid -E error.log + $ hg serve \ + > --config badserver.close-after-send-patterns='(.*Content-Type: applicat){2}' \ + > -p $HGPORT -d --pid-file=hg.pid -E error.log $ cat hg.pid > $DAEMON_PIDS TODO this output is horrible @@ -375,17 +377,17 @@ readline(*) -> (2?) host: localhost:$HGPORT\r\n (glob) readline(*) -> (49) user-agent: mercurial/proto-1.0 (Mercurial 4.2)\r\n (glob) readline(*) -> (2) \r\n (glob) - sendall(160 from 160) -> (549) HTTP/1.1 200 Script output follows\r\nServer: badhttpserver\r\nDate: $HTTP_DATE$\r\nContent-Type: application/mercurial-0.1\r\nContent-Length: 431\r\n\r\n (py36 !) - sendall(431 from 431) -> (118) batch branchmap $USUAL_BUNDLE2_CAPS_NO_PHASES$ changegroupsubset compression=none getbundle httpheader=1024 httpmediatype=0.1rx,0.1tx,0.2tx known lookup pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash (py36 !) - write(160 from 160) -> (568) HTTP/1.1 200 Script output follows\r\nServer: badhttpserver\r\nDate: $HTTP_DATE$\r\nContent-Type: application/mercurial-0.1\r\nContent-Length: 431\r\n\r\n (py3 no-py36 !) - write(431 from 431) -> (118) batch branchmap $USUAL_BUNDLE2_CAPS_NO_PHASES$ changegroupsubset compression=none getbundle httpheader=1024 httpmediatype=0.1rx,0.1tx,0.2tx known lookup pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash (py3 no-py36 !) - write(36 from 36) -> (673) HTTP/1.1 200 Script output follows\r\n (no-py3 !) - write(23 from 23) -> (650) Server: badhttpserver\r\n (no-py3 !) - write(37 from 37) -> (613) Date: $HTTP_DATE$\r\n (no-py3 !) - write(41 from 41) -> (572) Content-Type: application/mercurial-0.1\r\n (no-py3 !) - write(21 from 21) -> (551) Content-Length: 431\r\n (no-py3 !) - write(2 from 2) -> (549) \r\n (no-py3 !) - write(431 from 431) -> (118) batch branchmap $USUAL_BUNDLE2_CAPS_NO_PHASES$ changegroupsubset compression=none getbundle httpheader=1024 httpmediatype=0.1rx,0.1tx,0.2tx known lookup pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash (no-py3 !) + sendall(160) -> HTTP/1.1 200 Script output follows\r\nServer: badhttpserver\r\nDate: $HTTP_DATE$\r\nContent-Type: application/mercurial-0.1\r\nContent-Length: 431\r\n\r\n (py36 !) + sendall(431) -> batch branchmap $USUAL_BUNDLE2_CAPS_NO_PHASES$ changegroupsubset compression=none getbundle httpheader=1024 httpmediatype=0.1rx,0.1tx,0.2tx known lookup pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash (py36 !) + write(160) -> (568) HTTP/1.1 200 Script output follows\r\nServer: badhttpserver\r\nDate: $HTTP_DATE$\r\nContent-Type: application/mercurial-0.1\r\nContent-Length: 431\r\n\r\n (py3 no-py36 !) + write(431) -> batch branchmap $USUAL_BUNDLE2_CAPS_NO_PHASES$ changegroupsubset compression=none getbundle httpheader=1024 httpmediatype=0.1rx,0.1tx,0.2tx known lookup pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash (py3 no-py36 !) + write(36) -> HTTP/1.1 200 Script output follows\r\n (no-py3 !) + write(23) -> Server: badhttpserver\r\n (no-py3 !) + write(37) -> Date: $HTTP_DATE$\r\n (no-py3 !) + write(41) -> Content-Type: application/mercurial-0.1\r\n (no-py3 !) + write(21) -> Content-Length: 431\r\n (no-py3 !) + write(2) -> \r\n (no-py3 !) + write(431) -> batch branchmap $USUAL_BUNDLE2_CAPS_NO_PHASES$ changegroupsubset compression=none getbundle httpheader=1024 httpmediatype=0.1rx,0.1tx,0.2tx known lookup pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash (no-py3 !) readline(~) -> (26) GET /?cmd=batch HTTP/1.1\r\n readline(*) -> (27) Accept-Encoding: identity\r\n (glob) readline(*) -> (29) vary: X-HgArg-1,X-HgProto-1\r\n (glob) @@ -397,9 +399,9 @@ readline(*) -> (2) \r\n (glob) sendall(118 from 159) -> (0) HTTP/1.1 200 Script output follows\r\nServer: badhttpserver\r\nDate: $HTTP_DATE$\r\nContent-Type: applicat (py36 !) write(118 from 159) -> (0) HTTP/1.1 200 Script output follows\r\nServer: badhttpserver\r\nDate:
D12050: test-http-bad-server: move on test from bytes-count to pattern
marmoute created this revision. Herald added a reviewer: hg-reviewers. Herald added a subscriber: mercurial-patches. REVISION SUMMARY This specific test case is now using the new "close when a pattern is seen" approach compared to the more fragile "that many bytes were sent" approach. Since such change are still a bit noisy, we split each change in there own changesets. REPOSITORY rHG Mercurial BRANCH default REVISION DETAIL https://phab.mercurial-scm.org/D12050 AFFECTED FILES tests/test-http-bad-server.t CHANGE DETAILS diff --git a/tests/test-http-bad-server.t b/tests/test-http-bad-server.t --- a/tests/test-http-bad-server.t +++ b/tests/test-http-bad-server.t @@ -312,7 +312,9 @@ Server sends an incomplete capabilities response body - - $ hg serve --config badserver.close-after-send-bytes=180 -p $HGPORT -d --pid-file=hg.pid -E error.log + $ hg serve \ + > --config badserver.close-after-send-patterns='batch branchmap bund' \ + > -p $HGPORT -d --pid-file=hg.pid -E error.log $ cat hg.pid > $DAEMON_PIDS $ hg clone http://localhost:$HGPORT/ clone @@ -329,16 +331,16 @@ readline(*) -> (2?) host: localhost:$HGPORT\r\n (glob) readline(*) -> (49) user-agent: mercurial/proto-1.0 (Mercurial 4.2)\r\n (glob) readline(*) -> (2) \r\n (glob) - sendall(160 from 160) -> (20) HTTP/1.1 200 Script output follows\r\nServer: badhttpserver\r\nDate: $HTTP_DATE$\r\nContent-Type: application/mercurial-0.1\r\nContent-Length: 431\r\n\r\n (py36 !) + sendall(160) -> HTTP/1.1 200 Script output follows\r\nServer: badhttpserver\r\nDate: $HTTP_DATE$\r\nContent-Type: application/mercurial-0.1\r\nContent-Length: 431\r\n\r\n (py36 !) sendall(20 from 431) -> (0) batch branchmap bund (py36 !) - write(160 from 160) -> (20) HTTP/1.1 200 Script output follows\r\nServer: badhttpserver\r\nDate: $HTTP_DATE$\r\nContent-Type: application/mercurial-0.1\r\nContent-Length: 431\r\n\r\n (py3 no-py36 !) + write(160) -> (20) HTTP/1.1 200 Script output follows\r\nServer: badhttpserver\r\nDate: $HTTP_DATE$\r\nContent-Type: application/mercurial-0.1\r\nContent-Length: 431\r\n\r\n (py3 no-py36 !) write(20 from 431) -> (0) batch branchmap bund (py3 no-py36 !) - write(36 from 36) -> (144) HTTP/1.1 200 Script output follows\r\n (no-py3 !) - write(23 from 23) -> (121) Server: badhttpserver\r\n (no-py3 !) - write(37 from 37) -> (84) Date: $HTTP_DATE$\r\n (no-py3 !) - write(41 from 41) -> (43) Content-Type: application/mercurial-0.1\r\n (no-py3 !) - write(21 from 21) -> (22) Content-Length: 431\r\n (no-py3 !) - write(2 from 2) -> (20) \r\n (no-py3 !) + write(36) -> HTTP/1.1 200 Script output follows\r\n (no-py3 !) + write(23) -> Server: badhttpserver\r\n (no-py3 !) + write(37) -> Date: $HTTP_DATE$\r\n (no-py3 !) + write(41) -> Content-Type: application/mercurial-0.1\r\n (no-py3 !) + write(21) -> Content-Length: 431\r\n (no-py3 !) + write(2) -> \r\n (no-py3 !) write(20 from 431) -> (0) batch branchmap bund (no-py3 !) write limit reached; closing socket $LOCALIP - - [$ERRDATE$] Exception happened during processing request '/?cmd=capabilities': (glob) To: marmoute, #hg-reviewers Cc: mercurial-patches, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D12046: test-http-bad-server: replace the default 65537 value in output
marmoute created this revision. Herald added a reviewer: hg-reviewers. Herald added a subscriber: mercurial-patches. REVISION SUMMARY This is the default block value that we use here and it make the output overall less readable. So we replace it with `~` REPOSITORY rHG Mercurial BRANCH default REVISION DETAIL https://phab.mercurial-scm.org/D12046 AFFECTED FILES tests/test-http-bad-server.t tests/testlib/badserverext.py CHANGE DETAILS diff --git a/tests/testlib/badserverext.py b/tests/testlib/badserverext.py --- a/tests/testlib/badserverext.py +++ b/tests/testlib/badserverext.py @@ -172,12 +172,16 @@ remaining -= len(result) self.remaining_recv_bytes = remaining +if requested_size == 65537: +requested_repr = b'~' +else: +requested_repr = b'%d' % requested_size if requested_size == actual_size: -msg = b'%s(%d) -> (%d) %s' -msg %= (bmethod, requested_size, len(result), result) +msg = b'%s(%s) -> (%d) %s' +msg %= (bmethod, requested_repr, len(result), result) else: -msg = b'%s(%d from %d) -> (%d) %s' -msg %= (bmethod, actual_size, requested_size, len(result), result) +msg = b'%s(%d from %s) -> (%d) %s' +msg %= (bmethod, actual_size, requested_repr, len(result), result) obj._writelog(msg) if remaining is not None and remaining <= 0: diff --git a/tests/test-http-bad-server.t b/tests/test-http-bad-server.t --- a/tests/test-http-bad-server.t +++ b/tests/test-http-bad-server.t @@ -83,7 +83,7 @@ $ killdaemons.py $DAEMON_PIDS $ cat error.log - readline(1 from 65537) -> (1) G + readline(1 from ~) -> (1) G read limit reached; closing socket $ rm -f error.log @@ -100,7 +100,7 @@ $ killdaemons.py $DAEMON_PIDS $ cat error.log - readline(40 from 65537) -> (33) GET /?cmd=capabilities HTTP/1.1\r\n + readline(40 from ~) -> (33) GET /?cmd=capabilities HTTP/1.1\r\n readline(7 from *) -> (7) Accept- (glob) read limit reached; closing socket @@ -118,7 +118,7 @@ $ killdaemons.py $DAEMON_PIDS $ cat error.log - readline(210 from 65537) -> (33) GET /?cmd=capabilities HTTP/1.1\r\n + readline(210 from ~) -> (33) GET /?cmd=capabilities HTTP/1.1\r\n readline(177 from *) -> (27) Accept-Encoding: identity\r\n (glob) readline(150 from *) -> (35) accept: application/mercurial-0.1\r\n (glob) readline(115 from *) -> (*) host: localhost:$HGPORT\r\n (glob) @@ -135,10 +135,10 @@ write(21) -> Content-Length: 431\r\n (no-py3 !) write(2) -> \r\n (no-py3 !) write(431) -> batch branchmap $USUAL_BUNDLE2_CAPS_NO_PHASES$ changegroupsubset compression=none getbundle httpheader=1024 httpmediatype=0.1rx,0.1tx,0.2tx known lookup pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash (no-py3 !) - readline(4? from 65537) -> (26) GET /?cmd=batch HTTP/1.1\r\n (glob) + readline(4? from ~) -> (26) GET /?cmd=batch HTTP/1.1\r\n (glob) readline(1? from *) -> (1?) Accept-Encoding* (glob) read limit reached; closing socket - readline(223 from 65537) -> (26) GET /?cmd=batch HTTP/1.1\r\n + readline(223 from ~) -> (26) GET /?cmd=batch HTTP/1.1\r\n readline(197 from *) -> (27) Accept-Encoding: identity\r\n (glob) readline(170 from *) -> (29) vary: X-HgArg-1,X-HgProto-1\r\n (glob) readline(141 from *) -> (41) x-hgarg-1: cmds=heads+%3Bknown+nodes%3D\r\n (glob) @@ -164,7 +164,7 @@ $ cat error.log readline(1 from -1) -> (1) x (?) readline(1 from -1) -> (1) x (?) - readline(308 from 65537) -> (33) GET /?cmd=capabilities HTTP/1.1\r\n + readline(308 from ~) -> (33) GET /?cmd=capabilities HTTP/1.1\r\n readline(275 from *) -> (27) Accept-Encoding: identity\r\n (glob) readline(248 from *) -> (35) accept: application/mercurial-0.1\r\n (glob) readline(213 from *) -> (*) host: localhost:$HGPORT\r\n (glob) @@ -181,13 +181,13 @@ write(21) -> Content-Length: 431\r\n (no-py3 !) write(2) -> \r\n (no-py3 !) write(431) -> batch branchmap $USUAL_BUNDLE2_CAPS_NO_PHASES$ changegroupsubset compression=none getbundle httpheader=1024 httpmediatype=0.1rx,0.1tx,0.2tx known lookup pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash (no-py3 !) - readline(13? from 65537) -> (26) GET /?cmd=batch HTTP/1.1\r\n (glob) + readline(13? from ~) -> (26) GET /?cmd=batch HTTP/1.1\r\n (glob) readline(1?? from *) -> (27) Accept-Encoding: identity\r\n (glob) readline(8? from *) -> (29) vary: X-HgArg-1,X-HgProto-1\r\n (glob) readline(5? from *) -> (41) x-hgarg-1: cmds=heads+%3Bknown+nodes%3D\r\n (glob) readline(1? from *) -> (1?) x-hgproto-1:* (glob) read limit reached; closing socket - readline(317 from 65537) -> (26) GET /?cmd=batch HTTP/1.1\r\n + readline(317 from ~) -> (26) GET /?cmd=batch HTTP/1.1\r\n readline(291 from *) -> (27) Accept-Encoding: identity\r\n (glob) readline(264 from *)
D12049: test-bad-http-server: introduce sock closing when writing a pattern
marmoute created this revision. Herald added a reviewer: hg-reviewers. Herald added a subscriber: mercurial-patches. REVISION SUMMARY Instead of using a fixed number a bytes, a very unstable method. We introduce a new config that can define a regex. One this regex is detected, nothing after it will be written and the socket will be closed. Tests will be migrated to this new method in later changesets. REPOSITORY rHG Mercurial BRANCH default REVISION DETAIL https://phab.mercurial-scm.org/D12049 AFFECTED FILES tests/testlib/badserverext.py CHANGE DETAILS diff --git a/tests/testlib/badserverext.py b/tests/testlib/badserverext.py --- a/tests/testlib/badserverext.py +++ b/tests/testlib/badserverext.py @@ -31,10 +31,16 @@ If defined, close the client socket after sending this many bytes. (The value is a list, multiple value can use used to close a series of request) + +close-after-send-patterns + If defined, close the client socket after the configured regexp is seen. + (The value is a list, multiple value can use used to close a series of + request) """ from __future__ import absolute_import +import re import socket from mercurial import ( @@ -64,20 +70,33 @@ ) configitem( b'badserver', +b'close-after-send-patterns', +default=b'', +) +configitem( +b'badserver', b'close-before-accept', default=False, ) class ConditionTracker(object): -def __init__(self, close_after_recv_bytes, close_after_send_bytes): +def __init__( +self, +close_after_recv_bytes, +close_after_send_bytes, +close_after_send_patterns, +): self._all_close_after_recv_bytes = close_after_recv_bytes self._all_close_after_send_bytes = close_after_send_bytes +self._all_close_after_send_patterns = close_after_send_patterns self.target_recv_bytes = None self.remaining_recv_bytes = None self.target_send_bytes = None self.remaining_send_bytes = None +self.send_pattern = None +self.send_data = b'' def start_next_request(self): """move to the next set of close condition""" @@ -87,6 +106,7 @@ else: self.target_recv_bytes = None self.remaining_recv_bytes = None + if self._all_close_after_send_bytes: self.target_send_bytes = self._all_close_after_send_bytes.pop(0) self.remaining_send_bytes = self.target_send_bytes @@ -94,12 +114,20 @@ self.target_send_bytes = None self.remaining_send_bytes = None +self.send_data = b'' +if self._all_close_after_send_patterns: +self.send_pattern = self._all_close_after_send_patterns.pop(0) +else: +self.send_pattern = None + def might_close(self): """True, if any processing will be needed""" if self.remaining_recv_bytes is not None: return True if self.remaining_send_bytes is not None: return True +if self.send_pattern is not None: +return True return False def forward_write(self, obj, method, data, *args, **kwargs): @@ -108,11 +136,19 @@ When the condition are met the socket is closed """ remaining = self.remaining_send_bytes +pattern = self.send_pattern orig = object.__getattribute__(obj, '_orig') bmethod = method.encode('ascii') func = getattr(orig, method) +if pattern: +self.send_data += data +pieces = pattern.split(self.send_data, maxsplit=1) +if len(pieces) > 1: +dropped = len(pieces[-1]) +remaining = len(data) - dropped + if remaining: remaining = max(0, remaining) @@ -131,16 +167,9 @@ if remaining is None: obj._writelog(b'%s(%d) -> %s' % (bmethod, len(data), data)) else: -obj._writelog( -b'%s(%d from %d) -> (%d) %s' -% ( -bmethod, -len(newdata), -len(data), -remaining, -newdata, -) -) +msg = b'%s(%d from %d) -> (%d) %s' +msg %= (bmethod, len(newdata), len(data), remaining, newdata) +obj._writelog(msg) if remaining is not None and remaining <= 0: obj._writelog(b'write limit reached; closing socket') @@ -305,12 +334,23 @@ self._close() -def process_config(value): +def process_bytes_config(value): parts = value.split(b',') integers = [int(v) for v in parts if v] return [v if v else None for v in integers] +def process_pattern_config(value): +patterns = [] +for p in value.split(b','): +if not p: +p = None +else: +p = re.compile(p, re.DOTALL | re.MULTILINE) +
D12048: test-http-bad-server: document that the value are actually a list
marmoute created this revision. Herald added a reviewer: hg-reviewers. Herald added a subscriber: mercurial-patches. REVISION SUMMARY I don't really expect this doc to be read a lot, but mentioning that this is a list seems important. REPOSITORY rHG Mercurial BRANCH default REVISION DETAIL https://phab.mercurial-scm.org/D12048 AFFECTED FILES tests/testlib/badserverext.py CHANGE DETAILS diff --git a/tests/testlib/badserverext.py b/tests/testlib/badserverext.py --- a/tests/testlib/badserverext.py +++ b/tests/testlib/badserverext.py @@ -24,9 +24,13 @@ close-after-recv-bytes If defined, close the client socket after receiving this many bytes. + (The value is a list, multiple value can use used to close a series of + request) close-after-send-bytes If defined, close the client socket after sending this many bytes. + (The value is a list, multiple value can use used to close a series of + request) """ from __future__ import absolute_import To: marmoute, #hg-reviewers Cc: mercurial-patches, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D12047: test-http-bad-server: refactor the writing logic to avoid early return
marmoute created this revision. Herald added a reviewer: hg-reviewers. Herald added a subscriber: mercurial-patches. REVISION SUMMARY Our ultimate goal is to add another way to define the connection needs to be closed. To do so, we need the "read" code to be more unified. REPOSITORY rHG Mercurial BRANCH default REVISION DETAIL https://phab.mercurial-scm.org/D12047 AFFECTED FILES tests/testlib/badserverext.py CHANGE DETAILS diff --git a/tests/testlib/badserverext.py b/tests/testlib/badserverext.py --- a/tests/testlib/badserverext.py +++ b/tests/testlib/badserverext.py @@ -108,22 +108,25 @@ orig = object.__getattribute__(obj, '_orig') bmethod = method.encode('ascii') func = getattr(orig, method) -# No byte limit on this operation. Call original function. + +if remaining: +remaining = max(0, remaining) + if not remaining: -result = func(data, *args, **kwargs) -obj._writelog(b'%s(%d) -> %s' % (bmethod, len(data), data)) -return result - -remaining = max(0, remaining) - -if remaining > 0: +newdata = data +else: if remaining < len(data): newdata = data[0:remaining] else: newdata = data +remaining -= len(newdata) +self.remaining_send_bytes = remaining -remaining -= len(newdata) +result = func(newdata, *args, **kwargs) +if remaining is None: +obj._writelog(b'%s(%d) -> %s' % (bmethod, len(data), data)) +else: obj._writelog( b'%s(%d from %d) -> (%d) %s' % ( @@ -135,11 +138,7 @@ ) ) -result = func(newdata, *args, **kwargs) - -self.remaining_send_bytes = remaining - -if remaining <= 0: +if remaining is not None and remaining <= 0: obj._writelog(b'write limit reached; closing socket') object.__getattribute__(obj, '_cond_close')() raise Exception('connection closed after sending N bytes') To: marmoute, #hg-reviewers Cc: mercurial-patches, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D12042: test-http-bad-server: unify log printing for `sendall` and `write`o
marmoute created this revision. Herald added a reviewer: hg-reviewers. Herald added a subscriber: mercurial-patches. REVISION SUMMARY The `write` function was logging before calling the function while the `sendall` function were logging after calling the function. We align the `write` behavior on the `sendall` behavior before unifying the code. REPOSITORY rHG Mercurial BRANCH default REVISION DETAIL https://phab.mercurial-scm.org/D12042 AFFECTED FILES tests/test-http-bad-server.t tests/testlib/badserverext.py CHANGE DETAILS diff --git a/tests/testlib/badserverext.py b/tests/testlib/badserverext.py --- a/tests/testlib/badserverext.py +++ b/tests/testlib/badserverext.py @@ -284,8 +284,8 @@ # No byte limit on this operation. Call original function. if not remaining: +result = object.__getattribute__(self, '_orig').write(data) self._writelog(b'write(%d) -> %s' % (len(data), data)) -result = object.__getattribute__(self, '_orig').write(data) return result if len(data) > remaining: @@ -295,13 +295,13 @@ remaining -= len(newdata) +result = object.__getattribute__(self, '_orig').write(newdata) + self._writelog( b'write(%d from %d) -> (%d) %s' % (len(newdata), len(data), remaining, newdata) ) -result = object.__getattribute__(self, '_orig').write(newdata) - object.__getattribute__(self, '_cond').remaining_send_bytes = remaining if remaining <= 0: diff --git a/tests/test-http-bad-server.t b/tests/test-http-bad-server.t --- a/tests/test-http-bad-server.t +++ b/tests/test-http-bad-server.t @@ -272,7 +272,6 @@ Exception: connection closed after receiving N bytes write(126) -> HTTP/1.1 500 Internal Server Error\r\nServer: badhttpserver\r\nDate: $HTTP_DATE$\r\nTransfer-Encoding: chunked\r\n\r\n (py3 no-py36 !) - write(36) -> HTTP/1.1 500 Internal Server Error\r\n (no-py3 !) $ rm -f error.log @@ -307,7 +306,6 @@ Exception: connection closed after sending N bytes write(286) -> HTTP/1.1 200 Script output follows\r\nServer: badhttpserver\r\nDate: $HTTP_DATE$\r\nContent-Type: application/mercurial-0.1\r\nContent-Length: 431\r\n\r\nHTTP/1.1 500 Internal Server Error\r\nServer: badhttpserver\r\nDate: $HTTP_DATE$\r\nTransfer-Encoding: chunked\r\n\r\n (py3 no-py36 !) - write(36) -> HTTP/1.1 500 Internal Server Error\r\n (no-py3 !) $ rm -f error.log @@ -407,7 +405,6 @@ Exception: connection closed after sending N bytes write(285) -> HTTP/1.1 200 Script output follows\r\nServer: badhttpserver\r\nDate: $HTTP_DATE$\r\nContent-Type: application/mercurial-0.1\r\nContent-Length: 42\r\n\r\nHTTP/1.1 500 Internal Server Error\r\nServer: badhttpserver\r\nDate: $HTTP_DATE$\r\nTransfer-Encoding: chunked\r\n\r\n (py3 no-py36 !) - write(36) -> HTTP/1.1 500 Internal Server Error\r\n (no-py3 !) $ rm -f error.log @@ -552,7 +549,6 @@ Exception: connection closed after sending N bytes write(293) -> HTTP/1.1 200 Script output follows\r\nServer: badhttpserver\r\nDate: $HTTP_DATE$\r\nContent-Type: application/mercurial-0.2\r\nTransfer-Encoding: chunked\r\n\r\nHTTP/1.1 500 Internal Server Error\r\nServer: badhttpserver\r\nDate: $HTTP_DATE$\r\nTransfer-Encoding: chunked\r\n\r\n (py3 no-py36 !) - write(36) -> HTTP/1.1 500 Internal Server Error\r\n (no-py3 !) $ rm -f error.log @@ -577,11 +573,11 @@ #else $ "$PYTHON" $TESTDIR/filtertraceback.py < error.log | tail -4 + $LOCALIP - - [$ERRDATE$] Exception happened during processing request '/?cmd=getbundle': (glob) Traceback (most recent call last): Exception: connection closed after sending N bytes + write(293) -> HTTP/1.1 200 Script output follows\r\nServer: badhttpserver\r\nDate: $HTTP_DATE$\r\nContent-Type: application/mercurial-0.2\r\nTransfer-Encoding: chunked\r\n\r\nHTTP/1.1 500 Internal Server Error\r\nServer: badhttpserver\r\nDate: $HTTP_DATE$\r\nTransfer-Encoding: chunked\r\n\r\n (py3 !) - write(293) -> HTTP/1.1 200 Script output follows\r\nServer: badhttpserver\r\nDate: $HTTP_DATE$\r\nContent-Type: application/mercurial-0.2\r\nTransfer-Encoding: chunked\r\n\r\nHTTP/1.1 500 Internal Server Error\r\nServer: badhttpserver\r\nDate: $HTTP_DATE$\r\nTransfer-Encoding: chunked\r\n\r\n (py3 !) - write(36) -> HTTP/1.1 500 Internal Server Error\r\n (no-py3 !) #endif $ rm -f error.log @@ -661,7 +657,6 @@ Exception: connection closed after sending N bytes write(293) -> HTTP/1.1 200 Script output follows\r\nServer: badhttpserver\r\nDate: $HTTP_DATE$\r\nContent-Type: application/mercurial-0.2\r\nTransfer-Encoding: chunked\r\n\r\nHTTP/1.1 500 Internal Server Error\r\nServer: badhttpserver\r\nDate: $HTTP_DATE$\r\nTransfer-Encoding: chunked\r\n\r\n (py3 no-py36 !) - write(36) -> HTTP/1.1 500 Internal Server Error\r\n (no-py3 !) $ rm -f error.log @@ -744,7 +739,6 @@
D12045: test-http-bad-server: refactor the reading logic to avoid early return
marmoute created this revision. Herald added a reviewer: hg-reviewers. Herald added a subscriber: mercurial-patches. REVISION SUMMARY Our ultimate goal is to add another way to define the connection needs to be closed. To do so, we need the "read" code to be more unified. REPOSITORY rHG Mercurial BRANCH default REVISION DETAIL https://phab.mercurial-scm.org/D12045 AFFECTED FILES tests/testlib/badserverext.py CHANGE DETAILS diff --git a/tests/testlib/badserverext.py b/tests/testlib/badserverext.py --- a/tests/testlib/badserverext.py +++ b/tests/testlib/badserverext.py @@ -157,32 +157,30 @@ bmethod = method.encode('ascii') func = getattr(orig, method) -# No read limit. Call original function. -if not remaining: -result = func(size) -obj._writelog( -b'%s(%d) -> (%d) %s' % (bmethod, size, len(result), result) -) -return result +requested_size = size +actual_size = size + +if remaining: +if size < 0: +actual_size = remaining +else: +actual_size = min(remaining, requested_size) -origsize = size +result = func(actual_size) -if size < 0: -size = remaining +if remaining: +remaining -= len(result) +self.remaining_recv_bytes = remaining + +if requested_size == actual_size: +msg = b'%s(%d) -> (%d) %s' +msg %= (bmethod, requested_size, len(result), result) else: -size = min(remaining, size) - -result = func(size) -remaining -= len(result) +msg = b'%s(%d from %d) -> (%d) %s' +msg %= (bmethod, actual_size, requested_size, len(result), result) +obj._writelog(msg) -obj._writelog( -b'%s(%d from %d) -> (%d) %s' -% (bmethod, size, origsize, len(result), result) -) - -self.remaining_recv_bytes = remaining - -if remaining <= 0: +if remaining is not None and remaining <= 0: obj._writelog(b'read limit reached; closing socket') obj._cond_close() To: marmoute, #hg-reviewers Cc: mercurial-patches, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D12044: test-http-bad-server: factor code dealing with "read" in the new object
marmoute created this revision. Herald added a reviewer: hg-reviewers. Herald added a subscriber: mercurial-patches. REVISION SUMMARY This will make sure both `read` and `readline` do the same processing and make it simpler to update that processing in the future. REPOSITORY rHG Mercurial BRANCH default REVISION DETAIL https://phab.mercurial-scm.org/D12044 AFFECTED FILES tests/testlib/badserverext.py CHANGE DETAILS diff --git a/tests/testlib/badserverext.py b/tests/testlib/badserverext.py --- a/tests/testlib/badserverext.py +++ b/tests/testlib/badserverext.py @@ -146,6 +146,51 @@ return result +def forward_read(self, obj, method, size=-1): +"""call an underlying read function until condition are met + +When the condition are met the socket is closed +""" +remaining = self.remaining_recv_bytes + +orig = object.__getattribute__(obj, '_orig') +bmethod = method.encode('ascii') +func = getattr(orig, method) + +# No read limit. Call original function. +if not remaining: +result = func(size) +obj._writelog( +b'%s(%d) -> (%d) %s' % (bmethod, size, len(result), result) +) +return result + +origsize = size + +if size < 0: +size = remaining +else: +size = min(remaining, size) + +result = func(size) +remaining -= len(result) + +obj._writelog( +b'%s(%d from %d) -> (%d) %s' +% (bmethod, size, origsize, len(result), result) +) + +self.remaining_recv_bytes = remaining + +if remaining <= 0: +obj._writelog(b'read limit reached; closing socket') +obj._cond_close() + +# This is the easiest way to abort the current request. +raise Exception('connection closed after receiving N bytes') + +return result + # We can't adjust __class__ on a socket instance. So we define a proxy type. class socketproxy(object): @@ -240,78 +285,12 @@ self._sock.shutdown(socket.SHUT_RDWR) def read(self, size=-1): -remaining = object.__getattribute__(self, '_cond').remaining_recv_bytes - -# No read limit. Call original function. -if not remaining: -result = object.__getattribute__(self, '_orig').read(size) -self._writelog( -b'read(%d) -> (%d) (%s) %s' % (size, len(result), result) -) -return result - -origsize = size - -if size < 0: -size = remaining -else: -size = min(remaining, size) - -result = object.__getattribute__(self, '_orig').read(size) -remaining -= len(result) - -self._writelog( -b'read(%d from %d) -> (%d) %s' -% (size, origsize, len(result), result) -) - -object.__getattribute__(self, '_cond').remaining_recv_bytes = remaining - -if remaining <= 0: -self._writelog(b'read limit reached; closing socket') -self._close() - -# This is the easiest way to abort the current request. -raise Exception('connection closed after receiving N bytes') - -return result +cond = object.__getattribute__(self, '_cond') +return cond.forward_read(self, 'read', size) def readline(self, size=-1): -remaining = object.__getattribute__(self, '_cond').remaining_recv_bytes - -# No read limit. Call original function. -if not remaining: -result = object.__getattribute__(self, '_orig').readline(size) -self._writelog( -b'readline(%d) -> (%d) %s' % (size, len(result), result) -) -return result - -origsize = size - -if size < 0: -size = remaining -else: -size = min(remaining, size) - -result = object.__getattribute__(self, '_orig').readline(size) -remaining -= len(result) - -self._writelog( -b'readline(%d from %d) -> (%d) %s' -% (size, origsize, len(result), result) -) - -object.__getattribute__(self, '_cond').remaining_recv_bytes = remaining - -if remaining <= 0: -self._writelog(b'read limit reached; closing socket') -self._close() - -# This is the easiest way to abort the current request. -raise Exception('connection closed after receiving N bytes') - -return result +cond = object.__getattribute__(self, '_cond') +return cond.forward_read(self, 'readline', size) def write(self, data): cond = object.__getattribute__(self, '_cond') To: marmoute, #hg-reviewers Cc: mercurial-patches, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org
D12043: test-http-bad-server: factor code dealing with "write" in the new object
marmoute created this revision. Herald added a reviewer: hg-reviewers. Herald added a subscriber: mercurial-patches. REVISION SUMMARY This will make sure both `sendall` and `write` do the same processing and make it simpler to update that processing in the future. REPOSITORY rHG Mercurial BRANCH default REVISION DETAIL https://phab.mercurial-scm.org/D12043 AFFECTED FILES tests/testlib/badserverext.py CHANGE DETAILS diff --git a/tests/testlib/badserverext.py b/tests/testlib/badserverext.py --- a/tests/testlib/badserverext.py +++ b/tests/testlib/badserverext.py @@ -70,6 +70,11 @@ self._all_close_after_recv_bytes = close_after_recv_bytes self._all_close_after_send_bytes = close_after_send_bytes +self.target_recv_bytes = None +self.remaining_recv_bytes = None +self.target_send_bytes = None +self.remaining_send_bytes = None + def start_next_request(self): """move to the next set of close condition""" if self._all_close_after_recv_bytes: @@ -93,6 +98,54 @@ return True return False +def forward_write(self, obj, method, data, *args, **kwargs): +"""call an underlying write function until condition are met + +When the condition are met the socket is closed +""" +remaining = self.remaining_send_bytes + +orig = object.__getattribute__(obj, '_orig') +bmethod = method.encode('ascii') +func = getattr(orig, method) +# No byte limit on this operation. Call original function. +if not remaining: +result = func(data, *args, **kwargs) +obj._writelog(b'%s(%d) -> %s' % (bmethod, len(data), data)) +return result + +remaining = max(0, remaining) + +if remaining > 0: +if remaining < len(data): +newdata = data[0:remaining] +else: +newdata = data + +remaining -= len(newdata) + +obj._writelog( +b'%s(%d from %d) -> (%d) %s' +% ( +bmethod, +len(newdata), +len(data), +remaining, +newdata, +) +) + +result = func(newdata, *args, **kwargs) + +self.remaining_send_bytes = remaining + +if remaining <= 0: +obj._writelog(b'write limit reached; closing socket') +object.__getattribute__(obj, '_cond_close')() +raise Exception('connection closed after sending N bytes') + +return result + # We can't adjust __class__ on a socket instance. So we define a proxy type. class socketproxy(object): @@ -131,37 +184,11 @@ return fileobjectproxy(f, logfp, cond) def sendall(self, data, flags=0): -remaining = object.__getattribute__(self, '_cond').remaining_send_bytes - -# No read limit. Call original function. -if not remaining: -result = object.__getattribute__(self, '_orig').sendall(data, flags) -self._writelog(b'sendall(%d) -> %s' % (len(data), data)) -return result - -if len(data) > remaining: -newdata = data[0:remaining] -else: -newdata = data - -remaining -= len(newdata) +cond = object.__getattribute__(self, '_cond') +return cond.forward_write(self, 'sendall', data, flags) -result = object.__getattribute__(self, '_orig').sendall(newdata, flags) - -self._writelog( -b'sendall(%d from %d) -> (%d) %s' -% (len(newdata), len(data), remaining, newdata) -) - -object.__getattribute__(self, '_cond').remaining_send_bytes = remaining - -if remaining <= 0: -self._writelog(b'write limit reached; closing socket') -object.__getattribute__(self, '_orig').shutdown(socket.SHUT_RDWR) - -raise Exception('connection closed after sending N bytes') - -return result +def _cond_close(self): +object.__getattribute__(self, '_orig').shutdown(socket.SHUT_RDWR) # We can't adjust __class__ on socket._fileobject, so define a proxy. @@ -174,7 +201,14 @@ object.__setattr__(self, '_cond', condition_tracked) def __getattribute__(self, name): -if name in ('_close', 'read', 'readline', 'write', '_writelog'): +if name in ( +'_close', +'read', +'readline', +'write', +'_writelog', +'_cond_close', +): return object.__getattribute__(self, name) return getattr(object.__getattribute__(self, '_orig'), name) @@ -280,37 +314,11 @@ return result def write(self, data): -remaining = object.__getattribute__(self, '_cond').remaining_send_bytes - -# No byte limit on this operation. Call original function. -if not
D12039: test-http-bad-server: align output by using `;`
marmoute created this revision. Herald added a reviewer: hg-reviewers. Herald added a subscriber: mercurial-patches. REVISION SUMMARY This is the only message using a `,` instead of `;` and that seems unintentional. I am unifying the message before unigying the code. REPOSITORY rHG Mercurial BRANCH default REVISION DETAIL https://phab.mercurial-scm.org/D12039 AFFECTED FILES tests/test-http-bad-server.t tests/testlib/badserverext.py CHANGE DETAILS diff --git a/tests/testlib/badserverext.py b/tests/testlib/badserverext.py --- a/tests/testlib/badserverext.py +++ b/tests/testlib/badserverext.py @@ -230,7 +230,7 @@ object.__setattr__(self, '_closeafterrecvbytes', remaining) if remaining <= 0: -self._writelog(b'read limit reached, closing socket') +self._writelog(b'read limit reached; closing socket') self._close() # This is the easiest way to abort the current request. diff --git a/tests/test-http-bad-server.t b/tests/test-http-bad-server.t --- a/tests/test-http-bad-server.t +++ b/tests/test-http-bad-server.t @@ -266,7 +266,7 @@ readline(* from *) -> (49) user-agent: mercurial/proto-1.0 (Mercurial 4.2)\r\n (glob) readline(* from *) -> (2) \r\n (glob) read(* from 28) -> (*) cmds=* (glob) - read limit reached, closing socket + read limit reached; closing socket $LOCALIP - - [$ERRDATE$] Exception happened during processing request '/?cmd=batch': (glob) Traceback (most recent call last): Exception: connection closed after receiving N bytes To: marmoute, #hg-reviewers Cc: mercurial-patches, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D12038: test-http-bad-server: highlight each test with section
marmoute created this revision. Herald added a reviewer: hg-reviewers. Herald added a subscriber: mercurial-patches. REVISION SUMMARY Small "documentation" change to highlight each individual tests better. REPOSITORY rHG Mercurial BRANCH default REVISION DETAIL https://phab.mercurial-scm.org/D12038 AFFECTED FILES tests/test-http-bad-server.t CHANGE DETAILS diff --git a/tests/test-http-bad-server.t b/tests/test-http-bad-server.t --- a/tests/test-http-bad-server.t +++ b/tests/test-http-bad-server.t @@ -36,6 +36,7 @@ > EOF Failure to accept() socket should result in connection related error message + $ hg serve --config badserver.close-before-accept=true -p $HGPORT -d --pid-file=hg.pid $ cat hg.pid > $DAEMON_PIDS @@ -50,6 +51,7 @@ $ killdaemons.py $DAEMON_PIDS Failure immediately after accept() should yield connection related error message + $ hg serve --config badserver.close-after-accept=true -p $HGPORT -d --pid-file=hg.pid $ cat hg.pid > $DAEMON_PIDS @@ -69,6 +71,7 @@ $ killdaemons.py $DAEMON_PIDS Failure to read all bytes in initial HTTP request should yield connection related error message +--- $ hg serve --config badserver.close-after-recv-bytes=1 -p $HGPORT -d --pid-file=hg.pid -E error.log $ cat hg.pid > $DAEMON_PIDS @@ -86,6 +89,7 @@ $ rm -f error.log Same failure, but server reads full HTTP request line +- $ hg serve --config badserver.close-after-recv-bytes=40 -p $HGPORT -d --pid-file=hg.pid -E error.log $ cat hg.pid > $DAEMON_PIDS @@ -103,6 +107,7 @@ $ rm -f error.log Failure on subsequent HTTP request on the same socket (cmd?batch) +- $ hg serve --config badserver.close-after-recv-bytes=210,223 -p $HGPORT -d --pid-file=hg.pid -E error.log $ cat hg.pid > $DAEMON_PIDS @@ -145,6 +150,7 @@ $ rm -f error.log Failure to read getbundle HTTP request +-- $ hg serve --config badserver.close-after-recv-bytes=308,317,304 -p $HGPORT -d --pid-file=hg.pid -E error.log $ cat hg.pid > $DAEMON_PIDS @@ -212,6 +218,7 @@ $ rm -f error.log Now do a variation using POST to send arguments +=== $ hg serve --config experimental.httppostargs=true --config badserver.close-after-recv-bytes=329,344 -p $HGPORT -d --pid-file=hg.pid -E error.log $ cat hg.pid > $DAEMON_PIDS @@ -270,8 +277,10 @@ $ rm -f error.log Now move on to partial server responses +=== Server sends a single character from the HTTP response line +--- $ hg serve --config badserver.close-after-send-bytes=1 -p $HGPORT -d --pid-file=hg.pid -E error.log $ cat hg.pid > $DAEMON_PIDS @@ -303,6 +312,7 @@ $ rm -f error.log Server sends an incomplete capabilities response body +- $ hg serve --config badserver.close-after-send-bytes=180 -p $HGPORT -d --pid-file=hg.pid -E error.log $ cat hg.pid > $DAEMON_PIDS @@ -341,6 +351,7 @@ $ rm -f error.log Server sends incomplete headers for batch request +- $ hg serve --config badserver.close-after-send-bytes=709 -p $HGPORT -d --pid-file=hg.pid -E error.log $ cat hg.pid > $DAEMON_PIDS @@ -401,6 +412,7 @@ $ rm -f error.log Server sends an incomplete HTTP response body to batch request +-- $ hg serve --config badserver.close-after-send-bytes=774 -p $HGPORT -d --pid-file=hg.pid -E error.log $ cat hg.pid > $DAEMON_PIDS @@ -463,6 +475,7 @@ $ rm -f error.log Server sends incomplete headers for getbundle response +-- $ hg serve --config badserver.close-after-send-bytes=921 -p $HGPORT -d --pid-file=hg.pid -E error.log $ cat hg.pid > $DAEMON_PIDS @@ -544,6 +557,7 @@ $ rm -f error.log Server stops before it sends transfer encoding +-- $ hg serve --config badserver.close-after-send-bytes=954 -p $HGPORT -d --pid-file=hg.pid -E error.log $ cat hg.pid > $DAEMON_PIDS @@ -573,6 +587,7 @@ $ rm -f error.log Server sends empty HTTP body for getbundle +-- $ hg serve --config badserver.close-after-send-bytes=959 -p $HGPORT -d --pid-file=hg.pid -E error.log $ cat hg.pid > $DAEMON_PIDS @@ -651,6 +666,7 @@ $ rm -f error.log Server sends partial compression string +---
D12041: test-http-bad-server: track close condition in an object
marmoute created this revision. Herald added a reviewer: hg-reviewers. Herald added a subscriber: mercurial-patches. REVISION SUMMARY qn order to make the logic more advanced, we need to unify it. To unify it, we introce a small object that will be responsible for tracking and enforcing "premature socket close" conditions for both proxy object (socketproxy and fileobjectproxy). More logic will be moved into the object in later changesets. REPOSITORY rHG Mercurial BRANCH default REVISION DETAIL https://phab.mercurial-scm.org/D12041 AFFECTED FILES tests/testlib/badserverext.py CHANGE DETAILS diff --git a/tests/testlib/badserverext.py b/tests/testlib/badserverext.py --- a/tests/testlib/badserverext.py +++ b/tests/testlib/badserverext.py @@ -64,29 +64,47 @@ default=False, ) + +class ConditionTracker(object): +def __init__(self, close_after_recv_bytes, close_after_send_bytes): +self._all_close_after_recv_bytes = close_after_recv_bytes +self._all_close_after_send_bytes = close_after_send_bytes + +def start_next_request(self): +"""move to the next set of close condition""" +if self._all_close_after_recv_bytes: +self.target_recv_bytes = self._all_close_after_recv_bytes.pop(0) +self.remaining_recv_bytes = self.target_recv_bytes +else: +self.target_recv_bytes = None +self.remaining_recv_bytes = None +if self._all_close_after_send_bytes: +self.target_send_bytes = self._all_close_after_send_bytes.pop(0) +self.remaining_send_bytes = self.target_send_bytes +else: +self.target_send_bytes = None +self.remaining_send_bytes = None + +def might_close(self): +"""True, if any processing will be needed""" +if self.remaining_recv_bytes is not None: +return True +if self.remaining_send_bytes is not None: +return True +return False + + # We can't adjust __class__ on a socket instance. So we define a proxy type. class socketproxy(object): -__slots__ = ( -'_orig', -'_logfp', -'_close_after_recv_bytes', -'_close_after_send_bytes', -) +__slots__ = ('_orig', '_logfp', '_cond') -def __init__( -self, obj, logfp, close_after_recv_bytes=0, close_after_send_bytes=0 -): +def __init__(self, obj, logfp, condition_tracked): object.__setattr__(self, '_orig', obj) object.__setattr__(self, '_logfp', logfp) -object.__setattr__( -self, '_close_after_recv_bytes', close_after_recv_bytes -) -object.__setattr__( -self, '_close_after_send_bytes', close_after_send_bytes -) +object.__setattr__(self, '_cond', condition_tracked) def __getattribute__(self, name): -if name in ('makefile', 'sendall', '_writelog'): +if name in ('makefile', 'sendall', '_writelog', '_cond_close'): return object.__getattribute__(self, name) return getattr(object.__getattribute__(self, '_orig'), name) @@ -108,22 +126,12 @@ f = object.__getattribute__(self, '_orig').makefile(mode, bufsize) logfp = object.__getattribute__(self, '_logfp') -close_after_recv_bytes = object.__getattribute__( -self, '_close_after_recv_bytes' -) -close_after_send_bytes = object.__getattribute__( -self, '_close_after_send_bytes' -) +cond = object.__getattribute__(self, '_cond') -return fileobjectproxy( -f, -logfp, -close_after_recv_bytes=close_after_recv_bytes, -close_after_send_bytes=close_after_send_bytes, -) +return fileobjectproxy(f, logfp, cond) def sendall(self, data, flags=0): -remaining = object.__getattribute__(self, '_close_after_send_bytes') +remaining = object.__getattribute__(self, '_cond').remaining_send_bytes # No read limit. Call original function. if not remaining: @@ -145,7 +153,7 @@ % (len(newdata), len(data), remaining, newdata) ) -object.__setattr__(self, '_close_after_send_bytes', remaining) +object.__getattribute__(self, '_cond').remaining_send_bytes = remaining if remaining <= 0: self._writelog(b'write limit reached; closing socket') @@ -158,24 +166,12 @@ # We can't adjust __class__ on socket._fileobject, so define a proxy. class fileobjectproxy(object): -__slots__ = ( -'_orig', -'_logfp', -'_close_after_recv_bytes', -'_close_after_send_bytes', -) +__slots__ = ('_orig', '_logfp', '_cond') -def __init__( -self, obj, logfp, close_after_recv_bytes=0, close_after_send_bytes=0 -): +def __init__(self, obj, logfp, condition_tracked): object.__setattr__(self, '_orig', obj) object.__setattr__(self,
D12040: test-http-bad-server: use more readable name for variable
marmoute created this revision. Herald added a reviewer: hg-reviewers. Herald added a subscriber: mercurial-patches. REVISION SUMMARY This make the code more accessible overall. REPOSITORY rHG Mercurial BRANCH default REVISION DETAIL https://phab.mercurial-scm.org/D12040 AFFECTED FILES tests/testlib/badserverext.py CHANGE DETAILS diff --git a/tests/testlib/badserverext.py b/tests/testlib/badserverext.py --- a/tests/testlib/badserverext.py +++ b/tests/testlib/badserverext.py @@ -69,17 +69,21 @@ __slots__ = ( '_orig', '_logfp', -'_closeafterrecvbytes', -'_closeaftersendbytes', +'_close_after_recv_bytes', +'_close_after_send_bytes', ) def __init__( -self, obj, logfp, closeafterrecvbytes=0, closeaftersendbytes=0 +self, obj, logfp, close_after_recv_bytes=0, close_after_send_bytes=0 ): object.__setattr__(self, '_orig', obj) object.__setattr__(self, '_logfp', logfp) -object.__setattr__(self, '_closeafterrecvbytes', closeafterrecvbytes) -object.__setattr__(self, '_closeaftersendbytes', closeaftersendbytes) +object.__setattr__( +self, '_close_after_recv_bytes', close_after_recv_bytes +) +object.__setattr__( +self, '_close_after_send_bytes', close_after_send_bytes +) def __getattribute__(self, name): if name in ('makefile', 'sendall', '_writelog'): @@ -104,22 +108,22 @@ f = object.__getattribute__(self, '_orig').makefile(mode, bufsize) logfp = object.__getattribute__(self, '_logfp') -closeafterrecvbytes = object.__getattribute__( -self, '_closeafterrecvbytes' +close_after_recv_bytes = object.__getattribute__( +self, '_close_after_recv_bytes' ) -closeaftersendbytes = object.__getattribute__( -self, '_closeaftersendbytes' +close_after_send_bytes = object.__getattribute__( +self, '_close_after_send_bytes' ) return fileobjectproxy( f, logfp, -closeafterrecvbytes=closeafterrecvbytes, -closeaftersendbytes=closeaftersendbytes, +close_after_recv_bytes=close_after_recv_bytes, +close_after_send_bytes=close_after_send_bytes, ) def sendall(self, data, flags=0): -remaining = object.__getattribute__(self, '_closeaftersendbytes') +remaining = object.__getattribute__(self, '_close_after_send_bytes') # No read limit. Call original function. if not remaining: @@ -141,7 +145,7 @@ % (len(newdata), len(data), remaining, newdata) ) -object.__setattr__(self, '_closeaftersendbytes', remaining) +object.__setattr__(self, '_close_after_send_bytes', remaining) if remaining <= 0: self._writelog(b'write limit reached; closing socket') @@ -157,17 +161,21 @@ __slots__ = ( '_orig', '_logfp', -'_closeafterrecvbytes', -'_closeaftersendbytes', +'_close_after_recv_bytes', +'_close_after_send_bytes', ) def __init__( -self, obj, logfp, closeafterrecvbytes=0, closeaftersendbytes=0 +self, obj, logfp, close_after_recv_bytes=0, close_after_send_bytes=0 ): object.__setattr__(self, '_orig', obj) object.__setattr__(self, '_logfp', logfp) -object.__setattr__(self, '_closeafterrecvbytes', closeafterrecvbytes) -object.__setattr__(self, '_closeaftersendbytes', closeaftersendbytes) +object.__setattr__( +self, '_close_after_recv_bytes', close_after_recv_bytes +) +object.__setattr__( +self, '_close_after_send_bytes', close_after_send_bytes +) def __getattribute__(self, name): if name in ('_close', 'read', 'readline', 'write', '_writelog'): @@ -202,7 +210,7 @@ self._sock.shutdown(socket.SHUT_RDWR) def read(self, size=-1): -remaining = object.__getattribute__(self, '_closeafterrecvbytes') +remaining = object.__getattribute__(self, '_close_after_recv_bytes') # No read limit. Call original function. if not remaining: @@ -227,7 +235,7 @@ % (size, origsize, len(result), result) ) -object.__setattr__(self, '_closeafterrecvbytes', remaining) +object.__setattr__(self, '_close_after_recv_bytes', remaining) if remaining <= 0: self._writelog(b'read limit reached; closing socket') @@ -239,7 +247,7 @@ return result def readline(self, size=-1): -remaining = object.__getattribute__(self, '_closeafterrecvbytes') +remaining = object.__getattribute__(self, '_close_after_recv_bytes') # No read limit. Call original function. if not remaining: @@ -264,7 +272,7 @@ % (size, origsize, len(result),
D12037: test-http-bad-server: rename config to use `-`
marmoute created this revision. Herald added a reviewer: hg-reviewers. Herald added a subscriber: mercurial-patches. REVISION SUMMARY This make things much more readable. REPOSITORY rHG Mercurial BRANCH default REVISION DETAIL https://phab.mercurial-scm.org/D12037 AFFECTED FILES tests/test-http-bad-server.t tests/testlib/badserverext.py CHANGE DETAILS diff --git a/tests/testlib/badserverext.py b/tests/testlib/badserverext.py --- a/tests/testlib/badserverext.py +++ b/tests/testlib/badserverext.py @@ -14,18 +14,18 @@ Various config options in the [badserver] section influence behavior: -closebeforeaccept +close-before-accept If true, close() the server socket when a new connection arrives before accept() is called. The server will then exit. -closeafteraccept +close-after-accept If true, the server will close() the client socket immediately after accept(). -closeafterrecvbytes +close-after-recv-bytes If defined, close the client socket after receiving this many bytes. -closeaftersendbytes +close-after-send-bytes If defined, close the client socket after sending this many bytes. """ @@ -45,22 +45,22 @@ configitem( b'badserver', -b'closeafteraccept', +b'close-after-accept', default=False, ) configitem( b'badserver', -b'closeafterrecvbytes', +b'close-after-recv-bytes', default=b'0', ) configitem( b'badserver', -b'closeaftersendbytes', +b'close-after-send-bytes', default=b'0', ) configitem( b'badserver', -b'closebeforeaccept', +b'close-before-accept', default=False, ) @@ -317,10 +317,10 @@ self._ui = ui super(badserver, self).__init__(ui, *args, **kwargs) -recvbytes = self._ui.config(b'badserver', b'closeafterrecvbytes') +recvbytes = self._ui.config(b'badserver', b'close-after-recv-bytes') recvbytes = recvbytes.split(b',') self.closeafterrecvbytes = [int(v) for v in recvbytes if v] -sendbytes = self._ui.config(b'badserver', b'closeaftersendbytes') +sendbytes = self._ui.config(b'badserver', b'close-after-send-bytes') sendbytes = sendbytes.split(b',') self.closeaftersendbytes = [int(v) for v in sendbytes if v] @@ -341,7 +341,7 @@ # Called to accept() a pending socket. def get_request(self): -if self._ui.configbool(b'badserver', b'closebeforeaccept'): +if self._ui.configbool(b'badserver', b'close-before-accept'): self.socket.close() # Tells the server to stop processing more requests. @@ -350,7 +350,7 @@ # Simulate failure to stop processing this request. raise socket.error('close before accept') -if self._ui.configbool(b'badserver', b'closeafteraccept'): +if self._ui.configbool(b'badserver', b'close-after-accept'): request, client_address = super(badserver, self).get_request() request.close() raise socket.error('close after accept') diff --git a/tests/test-http-bad-server.t b/tests/test-http-bad-server.t --- a/tests/test-http-bad-server.t +++ b/tests/test-http-bad-server.t @@ -37,7 +37,7 @@ Failure to accept() socket should result in connection related error message - $ hg serve --config badserver.closebeforeaccept=true -p $HGPORT -d --pid-file=hg.pid + $ hg serve --config badserver.close-before-accept=true -p $HGPORT -d --pid-file=hg.pid $ cat hg.pid > $DAEMON_PIDS $ hg clone http://localhost:$HGPORT/ clone @@ -51,7 +51,7 @@ Failure immediately after accept() should yield connection related error message - $ hg serve --config badserver.closeafteraccept=true -p $HGPORT -d --pid-file=hg.pid + $ hg serve --config badserver.close-after-accept=true -p $HGPORT -d --pid-file=hg.pid $ cat hg.pid > $DAEMON_PIDS TODO: this usually outputs good results, but sometimes emits abort: @@ -70,7 +70,7 @@ Failure to read all bytes in initial HTTP request should yield connection related error message - $ hg serve --config badserver.closeafterrecvbytes=1 -p $HGPORT -d --pid-file=hg.pid -E error.log + $ hg serve --config badserver.close-after-recv-bytes=1 -p $HGPORT -d --pid-file=hg.pid -E error.log $ cat hg.pid > $DAEMON_PIDS $ hg clone http://localhost:$HGPORT/ clone @@ -87,7 +87,7 @@ Same failure, but server reads full HTTP request line - $ hg serve --config badserver.closeafterrecvbytes=40 -p $HGPORT -d --pid-file=hg.pid -E error.log + $ hg serve --config badserver.close-after-recv-bytes=40 -p $HGPORT -d --pid-file=hg.pid -E error.log $ cat hg.pid > $DAEMON_PIDS $ hg clone http://localhost:$HGPORT/ clone abort: error: bad HTTP status line: * (glob) @@ -104,7 +104,7 @@ Failure on subsequent HTTP request on the same socket (cmd?batch) - $ hg serve --config badserver.closeafterrecvbytes=210,223 -p
D12036: test-http-bad-server: move the extension in `testlib`
marmoute created this revision. Herald added a reviewer: hg-reviewers. Herald added a subscriber: mercurial-patches. REVISION SUMMARY This seems like a better location for it. REPOSITORY rHG Mercurial BRANCH default REVISION DETAIL https://phab.mercurial-scm.org/D12036 AFFECTED FILES tests/badserverext.py tests/test-check-code.t tests/test-http-bad-server.t tests/testlib/badserverext.py CHANGE DETAILS diff --git a/tests/badserverext.py b/tests/testlib/badserverext.py rename from tests/badserverext.py rename to tests/testlib/badserverext.py diff --git a/tests/test-http-bad-server.t b/tests/test-http-bad-server.t --- a/tests/test-http-bad-server.t +++ b/tests/test-http-bad-server.t @@ -30,7 +30,7 @@ $ cat > .hg/hgrc << EOF > [extensions] - > badserver = $TESTDIR/badserverext.py + > badserver = $TESTDIR/testlib/badserverext.py > [server] > compressionengines = none > EOF diff --git a/tests/test-check-code.t b/tests/test-check-code.t --- a/tests/test-check-code.t +++ b/tests/test-check-code.t @@ -33,7 +33,7 @@ Skipping contrib/packaging/hgpackaging/wix.py it has no-che?k-code (glob) Skipping i18n/polib.py it has no-che?k-code (glob) Skipping mercurial/statprof.py it has no-che?k-code (glob) - Skipping tests/badserverext.py it has no-che?k-code (glob) + Skipping tests/testlib/badserverext.py it has no-che?k-code (glob) @commands in debugcommands.py should be in alphabetical order. To: marmoute, #hg-reviewers Cc: mercurial-patches, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D12035: requirements: remove the `localrepo.supportedformat` attribute
marmoute created this revision. Herald added a reviewer: hg-reviewers. Herald added a subscriber: mercurial-patches. REVISION SUMMARY It is not longer used anywhere. REPOSITORY rHG Mercurial BRANCH default REVISION DETAIL https://phab.mercurial-scm.org/D12035 AFFECTED FILES mercurial/interfaces/repository.py mercurial/localrepo.py CHANGE DETAILS diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py --- a/mercurial/localrepo.py +++ b/mercurial/localrepo.py @@ -1274,27 +1274,25 @@ used. """ -supportedformats = { -requirementsmod.REVLOGV1_REQUIREMENT, -requirementsmod.GENERALDELTA_REQUIREMENT, -requirementsmod.TREEMANIFEST_REQUIREMENT, -requirementsmod.COPIESSDC_REQUIREMENT, -requirementsmod.REVLOGV2_REQUIREMENT, +_basesupported = { +requirementsmod.BOOKMARKS_IN_STORE_REQUIREMENT, requirementsmod.CHANGELOGV2_REQUIREMENT, -requirementsmod.SPARSEREVLOG_REQUIREMENT, -requirementsmod.NODEMAP_REQUIREMENT, -requirementsmod.BOOKMARKS_IN_STORE_REQUIREMENT, -requirementsmod.SHARESAFE_REQUIREMENT, +requirementsmod.COPIESSDC_REQUIREMENT, requirementsmod.DIRSTATE_V2_REQUIREMENT, -} -_basesupported = supportedformats | { requirementsmod.DOTENCODE_REQUIREMENT, requirementsmod.FNCACHE_REQUIREMENT, +requirementsmod.GENERALDELTA_REQUIREMENT, requirementsmod.INTERNAL_PHASE_REQUIREMENT, +requirementsmod.NODEMAP_REQUIREMENT, requirementsmod.RELATIVE_SHARED_REQUIREMENT, +requirementsmod.REVLOGV1_REQUIREMENT, +requirementsmod.REVLOGV2_REQUIREMENT, requirementsmod.SHARED_REQUIREMENT, +requirementsmod.SHARESAFE_REQUIREMENT, requirementsmod.SPARSE_REQUIREMENT, +requirementsmod.SPARSEREVLOG_REQUIREMENT, requirementsmod.STORE_REQUIREMENT, +requirementsmod.TREEMANIFEST_REQUIREMENT, } # list of prefix for file which can be written without 'wlock' diff --git a/mercurial/interfaces/repository.py b/mercurial/interfaces/repository.py --- a/mercurial/interfaces/repository.py +++ b/mercurial/interfaces/repository.py @@ -1495,13 +1495,6 @@ """null revision for the hash function used by the repository.""" ) -supportedformats = interfaceutil.Attribute( -"""Set of requirements that apply to stream clone. - -This is actually a class attribute and is shared among all instances. -""" -) - supported = interfaceutil.Attribute( """Set of requirements that this repo is capable of opening.""" ) To: marmoute, #hg-reviewers Cc: mercurial-patches, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D12033: requirements: move the comment about manifestv2 in the module
marmoute created this revision. Herald added a reviewer: hg-reviewers. Herald added a subscriber: mercurial-patches. REVISION SUMMARY This is about requirements, so lets put it into the requirements module. We are about to remove code it was previously attached too. REPOSITORY rHG Mercurial BRANCH default REVISION DETAIL https://phab.mercurial-scm.org/D12033 AFFECTED FILES mercurial/localrepo.py mercurial/requirements.py CHANGE DETAILS diff --git a/mercurial/requirements.py b/mercurial/requirements.py --- a/mercurial/requirements.py +++ b/mercurial/requirements.py @@ -7,6 +7,12 @@ from __future__ import absolute_import +# obsolete experimental requirements: +# - manifestv2: An experimental new manifest format that allowed +#for stem compression of long paths. Experiment ended up not +#being successful (repository sizes went up due to worse delta +#chains), and the code was deleted in 4.6. + GENERALDELTA_REQUIREMENT = b'generaldelta' DOTENCODE_REQUIREMENT = b'dotencode' STORE_REQUIREMENT = b'store' diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py --- a/mercurial/localrepo.py +++ b/mercurial/localrepo.py @@ -1274,11 +1274,6 @@ used. """ -# obsolete experimental requirements: -# - manifestv2: An experimental new manifest format that allowed -#for stem compression of long paths. Experiment ended up not -#being successful (repository sizes went up due to worse delta -#chains), and the code was deleted in 4.6. supportedformats = { requirementsmod.REVLOGV1_REQUIREMENT, requirementsmod.GENERALDELTA_REQUIREMENT, To: marmoute, #hg-reviewers Cc: mercurial-patches, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D12034: requirements: sort _basesupported
marmoute created this revision. Herald added a reviewer: hg-reviewers. Herald added a subscriber: mercurial-patches. REVISION SUMMARY This will make the next changeset clearer. REPOSITORY rHG Mercurial BRANCH default REVISION DETAIL https://phab.mercurial-scm.org/D12034 AFFECTED FILES mercurial/localrepo.py CHANGE DETAILS diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py --- a/mercurial/localrepo.py +++ b/mercurial/localrepo.py @@ -1288,13 +1288,13 @@ requirementsmod.DIRSTATE_V2_REQUIREMENT, } _basesupported = supportedformats | { -requirementsmod.STORE_REQUIREMENT, +requirementsmod.DOTENCODE_REQUIREMENT, requirementsmod.FNCACHE_REQUIREMENT, -requirementsmod.SHARED_REQUIREMENT, +requirementsmod.INTERNAL_PHASE_REQUIREMENT, requirementsmod.RELATIVE_SHARED_REQUIREMENT, -requirementsmod.DOTENCODE_REQUIREMENT, +requirementsmod.SHARED_REQUIREMENT, requirementsmod.SPARSE_REQUIREMENT, -requirementsmod.INTERNAL_PHASE_REQUIREMENT, +requirementsmod.STORE_REQUIREMENT, } # list of prefix for file which can be written without 'wlock' To: marmoute, #hg-reviewers Cc: mercurial-patches, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D12030: requirements: move "bookmark in store" requirements in the right module
marmoute created this revision. Herald added a reviewer: hg-reviewers. Herald added a subscriber: mercurial-patches. REVISION SUMMARY There seems to be no reasons to not have it with the others. REPOSITORY rHG Mercurial BRANCH default REVISION DETAIL https://phab.mercurial-scm.org/D12030 AFFECTED FILES mercurial/bookmarks.py mercurial/localrepo.py mercurial/requirements.py CHANGE DETAILS diff --git a/mercurial/requirements.py b/mercurial/requirements.py --- a/mercurial/requirements.py +++ b/mercurial/requirements.py @@ -66,6 +66,10 @@ # `.hg/store/requires` are present. SHARESAFE_REQUIREMENT = b'share-safe' +# Bookmarks must we stored in the `store` part of the repository and will be +# share accross shares +BOOKMARKS_IN_STORE_REQUIREMENT = b'bookmarksinstore' + # List of requirements which are working directory specific # These requirements cannot be shared between repositories if they # share the same store diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py --- a/mercurial/localrepo.py +++ b/mercurial/localrepo.py @@ -1288,7 +1288,7 @@ requirementsmod.CHANGELOGV2_REQUIREMENT, requirementsmod.SPARSEREVLOG_REQUIREMENT, requirementsmod.NODEMAP_REQUIREMENT, -bookmarks.BOOKMARKS_IN_STORE_REQUIREMENT, +requirementsmod.BOOKMARKS_IN_STORE_REQUIREMENT, requirementsmod.SHARESAFE_REQUIREMENT, requirementsmod.DIRSTATE_V2_REQUIREMENT, } @@ -3652,7 +3652,7 @@ requirements.add(b'lfs') if ui.configbool(b'format', b'bookmarks-in-store'): -requirements.add(bookmarks.BOOKMARKS_IN_STORE_REQUIREMENT) +requirements.add(requirementsmod.BOOKMARKS_IN_STORE_REQUIREMENT) if ui.configbool(b'format', b'use-persistent-nodemap'): requirements.add(requirementsmod.NODEMAP_REQUIREMENT) @@ -3704,7 +3704,7 @@ dropped = set() if requirementsmod.STORE_REQUIREMENT not in requirements: -if bookmarks.BOOKMARKS_IN_STORE_REQUIREMENT in requirements: +if requirementsmod.BOOKMARKS_IN_STORE_REQUIREMENT in requirements: ui.warn( _( b'ignoring enabled \'format.bookmarks-in-store\' config ' @@ -3712,7 +3712,7 @@ b'\'format.usestore\' config\n' ) ) -dropped.add(bookmarks.BOOKMARKS_IN_STORE_REQUIREMENT) +dropped.add(requirementsmod.BOOKMARKS_IN_STORE_REQUIREMENT) if ( requirementsmod.SHARED_REQUIREMENT in requirements diff --git a/mercurial/bookmarks.py b/mercurial/bookmarks.py --- a/mercurial/bookmarks.py +++ b/mercurial/bookmarks.py @@ -22,6 +22,7 @@ error, obsutil, pycompat, +requirements, scmutil, txnutil, util, @@ -36,11 +37,9 @@ # custom styles activebookmarklabel = b'bookmarks.active bookmarks.current' -BOOKMARKS_IN_STORE_REQUIREMENT = b'bookmarksinstore' - def bookmarksinstore(repo): -return BOOKMARKS_IN_STORE_REQUIREMENT in repo.requirements +return requirements.BOOKMARKS_IN_STORE_REQUIREMENT in repo.requirements def bookmarksvfs(repo): To: marmoute, #hg-reviewers Cc: mercurial-patches, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D12031: stream-clone: filter possible missing requirements using all supported one
marmoute created this revision. Herald added a reviewer: hg-reviewers. Herald added a subscriber: mercurial-patches. REVISION SUMMARY The `supportedformat` requirements is missing some important requirements and it seems better to filter out with all requirements we know, not just an "arbitrary" subset. This is especially relevant as we about to phase out the `supportedformat` class attribute. (a backport of this change to stable should be sent soon). REPOSITORY rHG Mercurial BRANCH default REVISION DETAIL https://phab.mercurial-scm.org/D12031 AFFECTED FILES mercurial/streamclone.py tests/test-http-bundle1.t tests/test-http.t CHANGE DETAILS diff --git a/tests/test-http.t b/tests/test-http.t --- a/tests/test-http.t +++ b/tests/test-http.t @@ -59,8 +59,10 @@ $ cat > $TESTTMP/removesupportedformat.py << EOF > from mercurial import localrepo - > def extsetup(ui): - > localrepo.localrepository.supportedformats.remove(b'generaldelta') + > def reposetup(ui, repo): + > local = repo.local() + > if local is not None: + > local.supported.remove(b'generaldelta') > EOF $ hg clone --config extensions.rsf=$TESTTMP/removesupportedformat.py --stream http://localhost:$HGPORT/ copy3 diff --git a/tests/test-http-bundle1.t b/tests/test-http-bundle1.t --- a/tests/test-http-bundle1.t +++ b/tests/test-http-bundle1.t @@ -70,8 +70,10 @@ $ cat > $TESTTMP/removesupportedformat.py << EOF > from mercurial import localrepo - > def extsetup(ui): - > localrepo.localrepository.supportedformats.remove(b'generaldelta') + > def reposetup(ui, repo): + > local = repo.local() + > if local is not None: + > local.supported.remove(b'generaldelta') > EOF $ hg clone --config extensions.rsf=$TESTTMP/removesupportedformat.py --stream http://localhost:$HGPORT/ copy3 diff --git a/mercurial/streamclone.py b/mercurial/streamclone.py --- a/mercurial/streamclone.py +++ b/mercurial/streamclone.py @@ -128,7 +128,7 @@ streamreqs = set(streamreqs.split(b',')) # Server requires something we don't support. Bail. -missingreqs = streamreqs - repo.supportedformats +missingreqs = streamreqs - repo.supported if missingreqs: pullop.repo.ui.warn( _( @@ -503,7 +503,7 @@ ) filecount, bytecount, requirements = readbundle1header(fp) -missingreqs = requirements - repo.supportedformats +missingreqs = requirements - repo.supported if missingreqs: raise error.Abort( _(b'unable to apply stream clone: unsupported format: %s') To: marmoute, #hg-reviewers Cc: mercurial-patches, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D12029: stream-clone: add a explicit test for format change during stream clone
marmoute created this revision. Herald added a reviewer: hg-reviewers. Herald added a subscriber: mercurial-patches. REVISION SUMMARY They are different kind of requirements, the one which impact the data storage and are relevant to the files being streamed and the one which does not. For example some requirements are only relevant to the working copy, like sparse, or dirstate-v2. Since they are irrelevant to the content being streamed, they do not prevent the receiving side to use streaming clone and mercurial skip adverting them over the wire and, ideally, within the bundle. In addition, this let the client decide to use whichever format it desire for the part that does not affect the store itself. So the configuration related to these format are used as normal when doing a streaming clone. In practice, the feature was not really tested and is badly broken with bundle-2, since the requirements are not filtered out from the stream bundle. So we start with adding simple tests as a good base before the fix and adjust the feature. REPOSITORY rHG Mercurial BRANCH default REVISION DETAIL https://phab.mercurial-scm.org/D12029 AFFECTED FILES tests/test-clone-stream-format.t tests/test-clone-stream.t tests/testlib/stream_clone_setup.sh CHANGE DETAILS diff --git a/tests/testlib/stream_clone_setup.sh b/tests/testlib/stream_clone_setup.sh new file mode 100644 --- /dev/null +++ b/tests/testlib/stream_clone_setup.sh @@ -0,0 +1,97 @@ +# setup some files and commit for a good stream clone testing. + +touch foo +hg -q commit -A -m initial + +python3 << EOF +for i in range(1024): +with open(str(i), 'wb') as fh: +fh.write(b"%d" % i) and None +EOF +hg -q commit -A -m 'add a lot of files' + +# (the status call is to check for issue5130) + +hg st + +# add files with "tricky" name: + +echo foo > 00changelog.i +echo foo > 00changelog.d +echo foo > 00changelog.n +echo foo > 00changelog-ab349180a0405010.nd +echo foo > 00manifest.i +echo foo > 00manifest.d +echo foo > foo.i +echo foo > foo.d +echo foo > foo.n +echo foo > undo.py +echo foo > undo.i +echo foo > undo.d +echo foo > undo.n +echo foo > undo.foo.i +echo foo > undo.foo.d +echo foo > undo.foo.n +echo foo > undo.babar +mkdir savanah +echo foo > savanah/foo.i +echo foo > savanah/foo.d +echo foo > savanah/foo.n +echo foo > savanah/undo.py +echo foo > savanah/undo.i +echo foo > savanah/undo.d +echo foo > savanah/undo.n +echo foo > savanah/undo.foo.i +echo foo > savanah/undo.foo.d +echo foo > savanah/undo.foo.n +echo foo > savanah/undo.babar +mkdir data +echo foo > data/foo.i +echo foo > data/foo.d +echo foo > data/foo.n +echo foo > data/undo.py +echo foo > data/undo.i +echo foo > data/undo.d +echo foo > data/undo.n +echo foo > data/undo.foo.i +echo foo > data/undo.foo.d +echo foo > data/undo.foo.n +echo foo > data/undo.babar +mkdir meta +echo foo > meta/foo.i +echo foo > meta/foo.d +echo foo > meta/foo.n +echo foo > meta/undo.py +echo foo > meta/undo.i +echo foo > meta/undo.d +echo foo > meta/undo.n +echo foo > meta/undo.foo.i +echo foo > meta/undo.foo.d +echo foo > meta/undo.foo.n +echo foo > meta/undo.babar +mkdir store +echo foo > store/foo.i +echo foo > store/foo.d +echo foo > store/foo.n +echo foo > store/undo.py +echo foo > store/undo.i +echo foo > store/undo.d +echo foo > store/undo.n +echo foo > store/undo.foo.i +echo foo > store/undo.foo.d +echo foo > store/undo.foo.n +echo foo > store/undo.babar + +# Name with special characters + +echo foo > store/CélesteVille_is_a_Capital_City + +# name causing issue6581 + +mkdir -p container/isam-build-centos7/ +touch container/isam-build-centos7/bazel-coverage-generator-sandboxfs-compatibility-0758e3e4f6057904d44399bd666faba9e7f40686.patch + +# Add all that + +hg add . +hg ci -m 'add files with "tricky" name' diff --git a/tests/test-clone-stream.t b/tests/test-clone-stream.t --- a/tests/test-clone-stream.t +++ b/tests/test-clone-stream.t @@ -10,98 +10,10 @@ #endif Initialize repository -the status call is to check for issue5130 $ hg init server $ cd server - $ touch foo - $ hg -q commit -A -m initial - >>> for i in range(1024): - ... with open(str(i), 'wb') as fh: - ... fh.write(b"%d" % i) and None - $ hg -q commit -A -m 'add a lot of files' - $ hg st - -add files with "tricky" name: - - $ echo foo > 00changelog.i - $ echo foo > 00changelog.d - $ echo foo > 00changelog.n - $ echo foo > 00changelog-ab349180a0405010.nd - $ echo foo > 00manifest.i - $ echo foo > 00manifest.d - $ echo foo > foo.i - $ echo foo > foo.d - $ echo foo > foo.n - $ echo foo > undo.py - $ echo foo > undo.i - $ echo foo > undo.d - $ echo foo > undo.n - $ echo foo > undo.foo.i - $ echo foo > undo.foo.d - $ echo foo > undo.foo.n - $ echo foo > undo.babar - $ mkdir savanah - $ echo foo > savanah/foo.i - $ echo foo > savanah/foo.d - $ echo foo > savanah/foo.n - $ echo foo > savanah/undo.py - $ echo foo > savanah/undo.i - $ echo foo
D12032: stream-clone: add a explicit set list requirements relevant to stream clone
marmoute created this revision. Herald added a reviewer: hg-reviewers. Herald added a subscriber: mercurial-patches. REVISION SUMMARY This set explicitly lists all the requirements that "stream clone" will preserve. Any other one will not be preserved. The role of listing the relevant one was previously filled by `repo.supportedformat`, but it seems clearer to use that such global and explicit set. The `repo.supportedformat` attribute will be cleaned up in a later changeset The true meaning of `repo.supportedformat` vs `repo._basesupported` was lost over time so, the content is currently bad. For example, `dirstate-v2` is currently considered relevant to the stream clone, or internal phase is missing. We kept the same content in this changeset and we will fix them later. REPOSITORY rHG Mercurial BRANCH default REVISION DETAIL https://phab.mercurial-scm.org/D12032 AFFECTED FILES mercurial/bundlecaches.py mercurial/requirements.py mercurial/streamclone.py CHANGE DETAILS diff --git a/mercurial/streamclone.py b/mercurial/streamclone.py --- a/mercurial/streamclone.py +++ b/mercurial/streamclone.py @@ -32,9 +32,7 @@ ) -def new_stream_clone_requirements( -supported_formats, default_requirements, streamed_requirements -): +def new_stream_clone_requirements(default_requirements, streamed_requirements): """determine the final set of requirement for a new stream clone this method combine the "default" requirements that a new repository would @@ -42,7 +40,7 @@ configuration choice when possible. """ requirements = set(default_requirements) -requirements -= supported_formats +requirements -= requirementsmod.STREAM_FIXED_REQUIREMENTS requirements.update(streamed_requirements) return requirements @@ -52,7 +50,9 @@ This is used for advertising the stream options and to generate the actual stream content.""" -requiredformats = repo.requirements & repo.supportedformats +requiredformats = ( +repo.requirements & requirementsmod.STREAM_FIXED_REQUIREMENTS +) return requiredformats @@ -209,7 +209,6 @@ with repo.lock(): consumev1(repo, fp, filecount, bytecount) repo.requirements = new_stream_clone_requirements( -repo.supportedformats, repo.requirements, requirements, ) @@ -820,7 +819,6 @@ consumev2(repo, fp, filecount, filesize) repo.requirements = new_stream_clone_requirements( -repo.supportedformats, repo.requirements, requirements, ) diff --git a/mercurial/requirements.py b/mercurial/requirements.py --- a/mercurial/requirements.py +++ b/mercurial/requirements.py @@ -89,3 +89,23 @@ SHARESAFE_REQUIREMENT, DIRSTATE_V2_REQUIREMENT, } + +# List of requirement that impact "stream-clone" (and hardlink clone) and +# cannot be changed in such cache. +# +# requirements not in this list are safe to be altered during stream-clone. +# +# note: the list is currently inherited from previous code and miss some relevant requirement while containing some irrelevant ones. +STREAM_FIXED_REQUIREMENTS = { +BOOKMARKS_IN_STORE_REQUIREMENT, +CHANGELOGV2_REQUIREMENT, +COPIESSDC_REQUIREMENT, +DIRSTATE_V2_REQUIREMENT, +GENERALDELTA_REQUIREMENT, +NODEMAP_REQUIREMENT, +REVLOGV1_REQUIREMENT, +REVLOGV2_REQUIREMENT, +SHARESAFE_REQUIREMENT, +SPARSEREVLOG_REQUIREMENT, +TREEMANIFEST_REQUIREMENT, +} diff --git a/mercurial/bundlecaches.py b/mercurial/bundlecaches.py --- a/mercurial/bundlecaches.py +++ b/mercurial/bundlecaches.py @@ -195,7 +195,7 @@ # repo supports and error if the bundle isn't compatible. if version == b'packed1' and b'requirements' in params: requirements = set(params[b'requirements'].split(b',')) -missingreqs = requirements - repo.supportedformats +missingreqs = requirements - requirementsmod.STREAM_FIXED_REQUIREMENTS if missingreqs: raise error.UnsupportedBundleSpecification( _(b'missing support for repository features: %s') To: marmoute, #hg-reviewers Cc: mercurial-patches, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D12028: stream-clone: factor computation of requirement of a stream clone
marmoute created this revision. Herald added a reviewer: hg-reviewers. Herald added a subscriber: mercurial-patches. REVISION SUMMARY This gather code duplicated in multiple place and will make it easier to modify it safely in the future. REPOSITORY rHG Mercurial BRANCH default REVISION DETAIL https://phab.mercurial-scm.org/D12028 AFFECTED FILES mercurial/streamclone.py mercurial/wireprotov1server.py CHANGE DETAILS diff --git a/mercurial/wireprotov1server.py b/mercurial/wireprotov1server.py --- a/mercurial/wireprotov1server.py +++ b/mercurial/wireprotov1server.py @@ -300,7 +300,7 @@ if streamclone.allowservergeneration(repo): if repo.ui.configbool(b'server', b'preferuncompressed'): caps.append(b'stream-preferred') -requiredformats = repo.requirements & repo.supportedformats +requiredformats = streamclone.streamed_requirements(repo) # if our local revlogs are just revlogv1, add 'stream' cap if not requiredformats - {requirementsmod.REVLOGV1_REQUIREMENT}: caps.append(b'stream') diff --git a/mercurial/streamclone.py b/mercurial/streamclone.py --- a/mercurial/streamclone.py +++ b/mercurial/streamclone.py @@ -47,6 +47,15 @@ return requirements +def streamed_requirements(repo): +"""the set of requirement the new clone will have to support + +This is used for advertising the stream options and to generate the actual +stream content.""" +requiredformats = repo.requirements & repo.supportedformats +return requiredformats + + def canperformstreamclone(pullop, bundle2=False): """Whether it is possible to perform a streaming clone as part of pull. @@ -346,7 +355,7 @@ if compression != b'UN': raise ValueError(b'we do not support the compression argument yet') -requirements = repo.requirements & repo.supportedformats +requirements = streamed_requirements(repo) requires = b','.join(sorted(requirements)) def gen(): To: marmoute, #hg-reviewers Cc: mercurial-patches, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D12027: stream-clone: factor computation of new clone requirement out
marmoute created this revision. Herald added a reviewer: hg-reviewers. Herald added a subscriber: mercurial-patches. REVISION SUMMARY This gather code duplicated in multiple place and will make it easier to modify it safely in the future. REPOSITORY rHG Mercurial BRANCH default REVISION DETAIL https://phab.mercurial-scm.org/D12027 AFFECTED FILES mercurial/streamclone.py CHANGE DETAILS diff --git a/mercurial/streamclone.py b/mercurial/streamclone.py --- a/mercurial/streamclone.py +++ b/mercurial/streamclone.py @@ -32,6 +32,21 @@ ) +def new_stream_clone_requirements( +supported_formats, default_requirements, streamed_requirements +): +"""determine the final set of requirement for a new stream clone + +this method combine the "default" requirements that a new repository would +use with the constaint we get from the stream clone content. We keep local +configuration choice when possible. +""" +requirements = set(default_requirements) +requirements -= supported_formats +requirements.update(streamed_requirements) +return requirements + + def canperformstreamclone(pullop, bundle2=False): """Whether it is possible to perform a streaming clone as part of pull. @@ -184,12 +199,10 @@ with repo.lock(): consumev1(repo, fp, filecount, bytecount) - -# new requirements = old non-format requirements + -#new format-related remote requirements -# requirements from the streamed-in repository -repo.requirements = requirements | ( -repo.requirements - repo.supportedformats +repo.requirements = new_stream_clone_requirements( +repo.supportedformats, +repo.requirements, +requirements, ) repo.svfs.options = localrepo.resolvestorevfsoptions( repo.ui, repo.requirements, repo.features @@ -797,11 +810,10 @@ consumev2(repo, fp, filecount, filesize) -# new requirements = old non-format requirements + -#new format-related remote requirements -# requirements from the streamed-in repository -repo.requirements = set(requirements) | ( -repo.requirements - repo.supportedformats +repo.requirements = new_stream_clone_requirements( +repo.supportedformats, +repo.requirements, +requirements, ) repo.svfs.options = localrepo.resolvestorevfsoptions( repo.ui, repo.requirements, repo.features To: marmoute, #hg-reviewers Cc: mercurial-patches, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D12026: stream-clone: drop some outdated lines in test-stream-bundle-v2.t
marmoute created this revision. Herald added a reviewer: hg-reviewers. Herald added a subscriber: mercurial-patches. REVISION SUMMARY These line refer to a "dirstate-v2" variant that is no longer in use. The associated line drifted out of sync with reality. REPOSITORY rHG Mercurial BRANCH default REVISION DETAIL https://phab.mercurial-scm.org/D12026 AFFECTED FILES tests/test-stream-bundle-v2.t CHANGE DETAILS diff --git a/tests/test-stream-bundle-v2.t b/tests/test-stream-bundle-v2.t --- a/tests/test-stream-bundle-v2.t +++ b/tests/test-stream-bundle-v2.t @@ -47,13 +47,11 @@ Stream params: {} stream2 -- {bytecount: 1693, filecount: 11, requirements: dotencode%2Cfncache%2Cgeneraldelta%2Crevlogv1%2Csparserevlog%2Cstore} (mandatory: True) (no-zstd !) stream2 -- {bytecount: 1693, filecount: 11, requirements: dotencode%2Cfncache%2Cgeneraldelta%2Crevlog-compression-zstd%2Crevlogv1%2Csparserevlog%2Cstore} (mandatory: True) (zstd no-rust !) - stream2 -- {bytecount: 1693, filecount: 11, requirements: dotencode%2Cfncache%2Cgeneraldelta%2Cpersistent-nodemap%2Crevlog-compression-zstd%2Crevlogv1%2Csparserevlog%2Cstore} (mandatory: True) (rust no-dirstate-v2 !) - stream2 -- {bytecount: 1693, filecount: 11, requirements: dotencode%2Cexp-rc-dirstate-v2%2Cfncache%2Cgeneraldelta%2Cpersistent-nodemap%2Crevlog-compression-zstd%2Crevlogv1%2Csparserevlog%2Cstore} (mandatory: True) (dirstate-v2 !) + stream2 -- {bytecount: 1693, filecount: 11, requirements: dotencode%2Cfncache%2Cgeneraldelta%2Cpersistent-nodemap%2Crevlog-compression-zstd%2Crevlogv1%2Csparserevlog%2Cstore} (mandatory: True) (rust !) $ hg debugbundle --spec bundle.hg none-v2;stream=v2;requirements%3Ddotencode%2Cfncache%2Cgeneraldelta%2Crevlogv1%2Csparserevlog%2Cstore (no-zstd !) none-v2;stream=v2;requirements%3Ddotencode%2Cfncache%2Cgeneraldelta%2Crevlog-compression-zstd%2Crevlogv1%2Csparserevlog%2Cstore (zstd no-rust !) - none-v2;stream=v2;requirements%3Ddotencode%2Cfncache%2Cgeneraldelta%2Cpersistent-nodemap%2Crevlog-compression-zstd%2Crevlogv1%2Csparserevlog%2Cstore (rust no-dirstate-v2 !) - none-v2;stream=v2;requirements%3Ddotencode%2Cexp-rc-dirstate-v2%2Cfncache%2Cgeneraldelta%2Cpersistent-nodemap%2Crevlog-compression-zstd%2Crevlogv1%2Csparserevlog%2Cstore (dirstate-v2 !) + none-v2;stream=v2;requirements%3Ddotencode%2Cfncache%2Cgeneraldelta%2Cpersistent-nodemap%2Crevlog-compression-zstd%2Crevlogv1%2Csparserevlog%2Cstore (rust !) Test that we can apply the bundle as a stream clone bundle To: marmoute, #hg-reviewers Cc: mercurial-patches, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel