Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
freebsd
GitHub Repository: freebsd/phabricator
Path: blob/master/src/applications/diffusion/protocol/__tests__/DiffusionMercurialWireProtocolTests.php
12242 views
1
<?php
2
3
final class DiffusionMercurialWireProtocolTests extends PhabricatorTestCase {
4
5
public function testFilteringBundle2Capability() {
6
// this was the result of running 'capabilities' over
7
// `hg serve --stdio` on my systems with Mercurial 3.5.1, 2.6.2
8
9
$capabilities_with_bundle2_hg_351 =
10
'lookup changegroupsubset branchmap pushkey '.
11
'known getbundle unbundlehash batch stream '.
12
'bundle2=HG20%0Achangegroup%3D01%2C02%0Adigests%3Dmd5%2Csha1%2Csha512'.
13
'%0Aerror%3Dabort%2Cunsupportedcontent%2Cpushraced%2Cpushkey%0A'.
14
'hgtagsfnodes%0Alistkeys%0Apushkey%0Aremote-changegroup%3Dhttp%2Chttps '.
15
'unbundle=HG10GZ,HG10BZ,HG10UN httpheader=1024';
16
17
$capabilities_without_bundle2_hg_351 =
18
'lookup changegroupsubset branchmap pushkey '.
19
'known getbundle unbundlehash batch stream '.
20
'unbundle=HG10GZ,HG10BZ,HG10UN httpheader=1024';
21
22
$capabilities_hg_262 =
23
'lookup changegroupsubset branchmap pushkey '.
24
'known getbundle unbundlehash batch stream '.
25
'unbundle=HG10GZ,HG10BZ,HG10UN httpheader=1024 largefiles=serve';
26
27
$cases = array(
28
array(
29
'name' => pht('Filter bundle2 from Mercurial 3.5.1'),
30
'input' => $capabilities_with_bundle2_hg_351,
31
'expect' => $capabilities_without_bundle2_hg_351,
32
),
33
34
array(
35
'name' => pht('Filter bundle does not affect Mercurial 2.6.2'),
36
'input' => $capabilities_hg_262,
37
'expect' => $capabilities_hg_262,
38
),
39
);
40
41
foreach ($cases as $case) {
42
$actual = DiffusionMercurialWireProtocol::filterBundle2Capability(
43
$case['input']);
44
$this->assertEqual($case['expect'], $actual, $case['name']);
45
}
46
}
47
48
}
49
50