Mercurial > hg
annotate tests/test-bundle2-pushback.t @ 48670:6d2ddea0721a stable
stream-clone: filter possible missing requirements using all supported one
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.
The `supportedformat` set is lacking some important requirements (for example
`revlog-compression-zstd`). This is getting fixed on default (for Mercurial 6.1)
However, fixing that in 6.1 means the stream requirements sent over the wire
will contains more items. And if we don't apply this fix on older version, they
might end up complaining about lacking support for feature they actually support
for years.
This patch does not fix the deeper problem (advertised stream requirement
lacking some of them), but focus on the trivial part : Lets use the full set of
supported requirement for looking for unsupported ones.
This patch should be simple to backport to older version of Mercurial and
packager should be encouraged to do so.
This is a graft of d9017df70135 from default.
Differential Revision: https://phab.mercurial-scm.org/D12091
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Mon, 24 Jan 2022 11:49:06 +0100 |
parents | 9c4204b7f3e4 |
children | 04688c51f81f |
rev | line source |
---|---|
36217
1ee1a42bfdae
tests: test using both versions of SSH protocol
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33947
diff
changeset
|
1 #testcases sshv1 sshv2 |
1ee1a42bfdae
tests: test using both versions of SSH protocol
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33947
diff
changeset
|
2 |
1ee1a42bfdae
tests: test using both versions of SSH protocol
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33947
diff
changeset
|
3 #if sshv2 |
1ee1a42bfdae
tests: test using both versions of SSH protocol
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33947
diff
changeset
|
4 $ cat >> $HGRCPATH << EOF |
1ee1a42bfdae
tests: test using both versions of SSH protocol
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33947
diff
changeset
|
5 > [experimental] |
1ee1a42bfdae
tests: test using both versions of SSH protocol
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33947
diff
changeset
|
6 > sshpeer.advertise-v2 = true |
1ee1a42bfdae
tests: test using both versions of SSH protocol
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33947
diff
changeset
|
7 > sshserver.support-v2 = true |
1ee1a42bfdae
tests: test using both versions of SSH protocol
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33947
diff
changeset
|
8 > EOF |
1ee1a42bfdae
tests: test using both versions of SSH protocol
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33947
diff
changeset
|
9 #endif |
1ee1a42bfdae
tests: test using both versions of SSH protocol
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33947
diff
changeset
|
10 |
23439
743736fc7c41
bundle2-push: provide transaction to reply unbundler
Eric Sumner <ericsumner@fb.com>
parents:
diff
changeset
|
11 $ cat > bundle2.py << EOF |
743736fc7c41
bundle2-push: provide transaction to reply unbundler
Eric Sumner <ericsumner@fb.com>
parents:
diff
changeset
|
12 > """A small extension to test bundle2 pushback parts. |
743736fc7c41
bundle2-push: provide transaction to reply unbundler
Eric Sumner <ericsumner@fb.com>
parents:
diff
changeset
|
13 > Current bundle2 implementation doesn't provide a way to generate those |
743736fc7c41
bundle2-push: provide transaction to reply unbundler
Eric Sumner <ericsumner@fb.com>
parents:
diff
changeset
|
14 > parts, so they must be created by extensions. |
743736fc7c41
bundle2-push: provide transaction to reply unbundler
Eric Sumner <ericsumner@fb.com>
parents:
diff
changeset
|
15 > """ |
33947
0124cf4af3b7
tests: update test-bundle2-pushback to pass the import checker
Augie Fackler <raf@durin42.com>
parents:
33262
diff
changeset
|
16 > from __future__ import absolute_import |
0124cf4af3b7
tests: update test-bundle2-pushback to pass the import checker
Augie Fackler <raf@durin42.com>
parents:
33262
diff
changeset
|
17 > from mercurial import bundle2, exchange, pushkey, util |
23439
743736fc7c41
bundle2-push: provide transaction to reply unbundler
Eric Sumner <ericsumner@fb.com>
parents:
diff
changeset
|
18 > def _newhandlechangegroup(op, inpart): |
743736fc7c41
bundle2-push: provide transaction to reply unbundler
Eric Sumner <ericsumner@fb.com>
parents:
diff
changeset
|
19 > """This function wraps the changegroup part handler for getbundle. |
24686
e0e28e910fa3
bundle2: rename format, parts and config to final names
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
23439
diff
changeset
|
20 > It issues an additional pushkey part to send a new |
23439
743736fc7c41
bundle2-push: provide transaction to reply unbundler
Eric Sumner <ericsumner@fb.com>
parents:
diff
changeset
|
21 > bookmark back to the client""" |
743736fc7c41
bundle2-push: provide transaction to reply unbundler
Eric Sumner <ericsumner@fb.com>
parents:
diff
changeset
|
22 > result = bundle2.handlechangegroup(op, inpart) |
38470
4c358bdaada8
py3: add b'' prefixes in tests/test-bundle2-pushback.t
Pulkit Goyal <7895pulkit@gmail.com>
parents:
36217
diff
changeset
|
23 > if b'pushback' in op.reply.capabilities: |
4c358bdaada8
py3: add b'' prefixes in tests/test-bundle2-pushback.t
Pulkit Goyal <7895pulkit@gmail.com>
parents:
36217
diff
changeset
|
24 > params = {b'namespace': b'bookmarks', |
4c358bdaada8
py3: add b'' prefixes in tests/test-bundle2-pushback.t
Pulkit Goyal <7895pulkit@gmail.com>
parents:
36217
diff
changeset
|
25 > b'key': b'new-server-mark', |
4c358bdaada8
py3: add b'' prefixes in tests/test-bundle2-pushback.t
Pulkit Goyal <7895pulkit@gmail.com>
parents:
36217
diff
changeset
|
26 > b'old': b'', |
4c358bdaada8
py3: add b'' prefixes in tests/test-bundle2-pushback.t
Pulkit Goyal <7895pulkit@gmail.com>
parents:
36217
diff
changeset
|
27 > b'new': b'tip'} |
41738
c70bdd222dcd
tests: bulk changes to avoid whitespace errors of check-code.py
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
39707
diff
changeset
|
28 > encodedparams = [(k, pushkey.encode(v)) |
c70bdd222dcd
tests: bulk changes to avoid whitespace errors of check-code.py
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
39707
diff
changeset
|
29 > for (k, v) in params.items()] |
38470
4c358bdaada8
py3: add b'' prefixes in tests/test-bundle2-pushback.t
Pulkit Goyal <7895pulkit@gmail.com>
parents:
36217
diff
changeset
|
30 > op.reply.newpart(b'pushkey', mandatoryparams=encodedparams) |
23439
743736fc7c41
bundle2-push: provide transaction to reply unbundler
Eric Sumner <ericsumner@fb.com>
parents:
diff
changeset
|
31 > else: |
38470
4c358bdaada8
py3: add b'' prefixes in tests/test-bundle2-pushback.t
Pulkit Goyal <7895pulkit@gmail.com>
parents:
36217
diff
changeset
|
32 > op.reply.newpart(b'output', data=b'pushback not enabled') |
23439
743736fc7c41
bundle2-push: provide transaction to reply unbundler
Eric Sumner <ericsumner@fb.com>
parents:
diff
changeset
|
33 > return result |
743736fc7c41
bundle2-push: provide transaction to reply unbundler
Eric Sumner <ericsumner@fb.com>
parents:
diff
changeset
|
34 > _newhandlechangegroup.params = bundle2.handlechangegroup.params |
38470
4c358bdaada8
py3: add b'' prefixes in tests/test-bundle2-pushback.t
Pulkit Goyal <7895pulkit@gmail.com>
parents:
36217
diff
changeset
|
35 > bundle2.parthandlermapping[b'changegroup'] = _newhandlechangegroup |
23439
743736fc7c41
bundle2-push: provide transaction to reply unbundler
Eric Sumner <ericsumner@fb.com>
parents:
diff
changeset
|
36 > EOF |
743736fc7c41
bundle2-push: provide transaction to reply unbundler
Eric Sumner <ericsumner@fb.com>
parents:
diff
changeset
|
37 |
743736fc7c41
bundle2-push: provide transaction to reply unbundler
Eric Sumner <ericsumner@fb.com>
parents:
diff
changeset
|
38 $ cat >> $HGRCPATH <<EOF |
743736fc7c41
bundle2-push: provide transaction to reply unbundler
Eric Sumner <ericsumner@fb.com>
parents:
diff
changeset
|
39 > [ui] |
743736fc7c41
bundle2-push: provide transaction to reply unbundler
Eric Sumner <ericsumner@fb.com>
parents:
diff
changeset
|
40 > username = nobody <no.reply@example.com> |
743736fc7c41
bundle2-push: provide transaction to reply unbundler
Eric Sumner <ericsumner@fb.com>
parents:
diff
changeset
|
41 > |
743736fc7c41
bundle2-push: provide transaction to reply unbundler
Eric Sumner <ericsumner@fb.com>
parents:
diff
changeset
|
42 > [alias] |
743736fc7c41
bundle2-push: provide transaction to reply unbundler
Eric Sumner <ericsumner@fb.com>
parents:
diff
changeset
|
43 > tglog = log -G -T "{desc} [{phase}:{node|short}]" |
743736fc7c41
bundle2-push: provide transaction to reply unbundler
Eric Sumner <ericsumner@fb.com>
parents:
diff
changeset
|
44 > EOF |
743736fc7c41
bundle2-push: provide transaction to reply unbundler
Eric Sumner <ericsumner@fb.com>
parents:
diff
changeset
|
45 |
743736fc7c41
bundle2-push: provide transaction to reply unbundler
Eric Sumner <ericsumner@fb.com>
parents:
diff
changeset
|
46 Set up server repository |
743736fc7c41
bundle2-push: provide transaction to reply unbundler
Eric Sumner <ericsumner@fb.com>
parents:
diff
changeset
|
47 |
743736fc7c41
bundle2-push: provide transaction to reply unbundler
Eric Sumner <ericsumner@fb.com>
parents:
diff
changeset
|
48 $ hg init server |
743736fc7c41
bundle2-push: provide transaction to reply unbundler
Eric Sumner <ericsumner@fb.com>
parents:
diff
changeset
|
49 $ cd server |
743736fc7c41
bundle2-push: provide transaction to reply unbundler
Eric Sumner <ericsumner@fb.com>
parents:
diff
changeset
|
50 $ echo c0 > f0 |
743736fc7c41
bundle2-push: provide transaction to reply unbundler
Eric Sumner <ericsumner@fb.com>
parents:
diff
changeset
|
51 $ hg commit -Am 0 |
743736fc7c41
bundle2-push: provide transaction to reply unbundler
Eric Sumner <ericsumner@fb.com>
parents:
diff
changeset
|
52 adding f0 |
743736fc7c41
bundle2-push: provide transaction to reply unbundler
Eric Sumner <ericsumner@fb.com>
parents:
diff
changeset
|
53 |
743736fc7c41
bundle2-push: provide transaction to reply unbundler
Eric Sumner <ericsumner@fb.com>
parents:
diff
changeset
|
54 Set up client repository |
743736fc7c41
bundle2-push: provide transaction to reply unbundler
Eric Sumner <ericsumner@fb.com>
parents:
diff
changeset
|
55 |
743736fc7c41
bundle2-push: provide transaction to reply unbundler
Eric Sumner <ericsumner@fb.com>
parents:
diff
changeset
|
56 $ cd .. |
743736fc7c41
bundle2-push: provide transaction to reply unbundler
Eric Sumner <ericsumner@fb.com>
parents:
diff
changeset
|
57 $ hg clone ssh://user@dummy/server client -q |
743736fc7c41
bundle2-push: provide transaction to reply unbundler
Eric Sumner <ericsumner@fb.com>
parents:
diff
changeset
|
58 $ cd client |
743736fc7c41
bundle2-push: provide transaction to reply unbundler
Eric Sumner <ericsumner@fb.com>
parents:
diff
changeset
|
59 |
743736fc7c41
bundle2-push: provide transaction to reply unbundler
Eric Sumner <ericsumner@fb.com>
parents:
diff
changeset
|
60 Enable extension |
743736fc7c41
bundle2-push: provide transaction to reply unbundler
Eric Sumner <ericsumner@fb.com>
parents:
diff
changeset
|
61 $ cat >> $HGRCPATH <<EOF |
743736fc7c41
bundle2-push: provide transaction to reply unbundler
Eric Sumner <ericsumner@fb.com>
parents:
diff
changeset
|
62 > [extensions] |
743736fc7c41
bundle2-push: provide transaction to reply unbundler
Eric Sumner <ericsumner@fb.com>
parents:
diff
changeset
|
63 > bundle2=$TESTTMP/bundle2.py |
743736fc7c41
bundle2-push: provide transaction to reply unbundler
Eric Sumner <ericsumner@fb.com>
parents:
diff
changeset
|
64 > EOF |
743736fc7c41
bundle2-push: provide transaction to reply unbundler
Eric Sumner <ericsumner@fb.com>
parents:
diff
changeset
|
65 |
743736fc7c41
bundle2-push: provide transaction to reply unbundler
Eric Sumner <ericsumner@fb.com>
parents:
diff
changeset
|
66 Without config |
743736fc7c41
bundle2-push: provide transaction to reply unbundler
Eric Sumner <ericsumner@fb.com>
parents:
diff
changeset
|
67 |
743736fc7c41
bundle2-push: provide transaction to reply unbundler
Eric Sumner <ericsumner@fb.com>
parents:
diff
changeset
|
68 $ cd ../client |
743736fc7c41
bundle2-push: provide transaction to reply unbundler
Eric Sumner <ericsumner@fb.com>
parents:
diff
changeset
|
69 $ echo c1 > f1 |
743736fc7c41
bundle2-push: provide transaction to reply unbundler
Eric Sumner <ericsumner@fb.com>
parents:
diff
changeset
|
70 $ hg commit -Am 1 |
743736fc7c41
bundle2-push: provide transaction to reply unbundler
Eric Sumner <ericsumner@fb.com>
parents:
diff
changeset
|
71 adding f1 |
743736fc7c41
bundle2-push: provide transaction to reply unbundler
Eric Sumner <ericsumner@fb.com>
parents:
diff
changeset
|
72 $ hg push |
743736fc7c41
bundle2-push: provide transaction to reply unbundler
Eric Sumner <ericsumner@fb.com>
parents:
diff
changeset
|
73 pushing to ssh://user@dummy/server |
743736fc7c41
bundle2-push: provide transaction to reply unbundler
Eric Sumner <ericsumner@fb.com>
parents:
diff
changeset
|
74 searching for changes |
743736fc7c41
bundle2-push: provide transaction to reply unbundler
Eric Sumner <ericsumner@fb.com>
parents:
diff
changeset
|
75 remote: adding changesets |
743736fc7c41
bundle2-push: provide transaction to reply unbundler
Eric Sumner <ericsumner@fb.com>
parents:
diff
changeset
|
76 remote: adding manifests |
743736fc7c41
bundle2-push: provide transaction to reply unbundler
Eric Sumner <ericsumner@fb.com>
parents:
diff
changeset
|
77 remote: adding file changes |
743736fc7c41
bundle2-push: provide transaction to reply unbundler
Eric Sumner <ericsumner@fb.com>
parents:
diff
changeset
|
78 remote: added 1 changesets with 1 changes to 1 files |
25423
525fbf24b51b
bundle2: stop capturing output for ssh again
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
24754
diff
changeset
|
79 remote: pushback not enabled |
23439
743736fc7c41
bundle2-push: provide transaction to reply unbundler
Eric Sumner <ericsumner@fb.com>
parents:
diff
changeset
|
80 $ hg bookmark |
743736fc7c41
bundle2-push: provide transaction to reply unbundler
Eric Sumner <ericsumner@fb.com>
parents:
diff
changeset
|
81 no bookmarks set |
743736fc7c41
bundle2-push: provide transaction to reply unbundler
Eric Sumner <ericsumner@fb.com>
parents:
diff
changeset
|
82 |
743736fc7c41
bundle2-push: provide transaction to reply unbundler
Eric Sumner <ericsumner@fb.com>
parents:
diff
changeset
|
83 $ cd ../server |
743736fc7c41
bundle2-push: provide transaction to reply unbundler
Eric Sumner <ericsumner@fb.com>
parents:
diff
changeset
|
84 $ hg tglog |
743736fc7c41
bundle2-push: provide transaction to reply unbundler
Eric Sumner <ericsumner@fb.com>
parents:
diff
changeset
|
85 o 1 [public:2b9c7234e035] |
743736fc7c41
bundle2-push: provide transaction to reply unbundler
Eric Sumner <ericsumner@fb.com>
parents:
diff
changeset
|
86 | |
743736fc7c41
bundle2-push: provide transaction to reply unbundler
Eric Sumner <ericsumner@fb.com>
parents:
diff
changeset
|
87 @ 0 [public:6cee5c8f3e5b] |
743736fc7c41
bundle2-push: provide transaction to reply unbundler
Eric Sumner <ericsumner@fb.com>
parents:
diff
changeset
|
88 |
743736fc7c41
bundle2-push: provide transaction to reply unbundler
Eric Sumner <ericsumner@fb.com>
parents:
diff
changeset
|
89 |
743736fc7c41
bundle2-push: provide transaction to reply unbundler
Eric Sumner <ericsumner@fb.com>
parents:
diff
changeset
|
90 |
743736fc7c41
bundle2-push: provide transaction to reply unbundler
Eric Sumner <ericsumner@fb.com>
parents:
diff
changeset
|
91 |
743736fc7c41
bundle2-push: provide transaction to reply unbundler
Eric Sumner <ericsumner@fb.com>
parents:
diff
changeset
|
92 With config |
743736fc7c41
bundle2-push: provide transaction to reply unbundler
Eric Sumner <ericsumner@fb.com>
parents:
diff
changeset
|
93 |
743736fc7c41
bundle2-push: provide transaction to reply unbundler
Eric Sumner <ericsumner@fb.com>
parents:
diff
changeset
|
94 $ cd ../client |
743736fc7c41
bundle2-push: provide transaction to reply unbundler
Eric Sumner <ericsumner@fb.com>
parents:
diff
changeset
|
95 $ echo '[experimental]' >> .hg/hgrc |
743736fc7c41
bundle2-push: provide transaction to reply unbundler
Eric Sumner <ericsumner@fb.com>
parents:
diff
changeset
|
96 $ echo 'bundle2.pushback = True' >> .hg/hgrc |
743736fc7c41
bundle2-push: provide transaction to reply unbundler
Eric Sumner <ericsumner@fb.com>
parents:
diff
changeset
|
97 $ echo c2 > f2 |
743736fc7c41
bundle2-push: provide transaction to reply unbundler
Eric Sumner <ericsumner@fb.com>
parents:
diff
changeset
|
98 $ hg commit -Am 2 |
743736fc7c41
bundle2-push: provide transaction to reply unbundler
Eric Sumner <ericsumner@fb.com>
parents:
diff
changeset
|
99 adding f2 |
743736fc7c41
bundle2-push: provide transaction to reply unbundler
Eric Sumner <ericsumner@fb.com>
parents:
diff
changeset
|
100 $ hg push |
743736fc7c41
bundle2-push: provide transaction to reply unbundler
Eric Sumner <ericsumner@fb.com>
parents:
diff
changeset
|
101 pushing to ssh://user@dummy/server |
743736fc7c41
bundle2-push: provide transaction to reply unbundler
Eric Sumner <ericsumner@fb.com>
parents:
diff
changeset
|
102 searching for changes |
743736fc7c41
bundle2-push: provide transaction to reply unbundler
Eric Sumner <ericsumner@fb.com>
parents:
diff
changeset
|
103 remote: adding changesets |
743736fc7c41
bundle2-push: provide transaction to reply unbundler
Eric Sumner <ericsumner@fb.com>
parents:
diff
changeset
|
104 remote: adding manifests |
743736fc7c41
bundle2-push: provide transaction to reply unbundler
Eric Sumner <ericsumner@fb.com>
parents:
diff
changeset
|
105 remote: adding file changes |
743736fc7c41
bundle2-push: provide transaction to reply unbundler
Eric Sumner <ericsumner@fb.com>
parents:
diff
changeset
|
106 remote: added 1 changesets with 1 changes to 1 files |
743736fc7c41
bundle2-push: provide transaction to reply unbundler
Eric Sumner <ericsumner@fb.com>
parents:
diff
changeset
|
107 $ hg bookmark |
743736fc7c41
bundle2-push: provide transaction to reply unbundler
Eric Sumner <ericsumner@fb.com>
parents:
diff
changeset
|
108 new-server-mark 2:0a76dfb2e179 |
743736fc7c41
bundle2-push: provide transaction to reply unbundler
Eric Sumner <ericsumner@fb.com>
parents:
diff
changeset
|
109 |
743736fc7c41
bundle2-push: provide transaction to reply unbundler
Eric Sumner <ericsumner@fb.com>
parents:
diff
changeset
|
110 $ cd ../server |
743736fc7c41
bundle2-push: provide transaction to reply unbundler
Eric Sumner <ericsumner@fb.com>
parents:
diff
changeset
|
111 $ hg tglog |
743736fc7c41
bundle2-push: provide transaction to reply unbundler
Eric Sumner <ericsumner@fb.com>
parents:
diff
changeset
|
112 o 2 [public:0a76dfb2e179] |
743736fc7c41
bundle2-push: provide transaction to reply unbundler
Eric Sumner <ericsumner@fb.com>
parents:
diff
changeset
|
113 | |
743736fc7c41
bundle2-push: provide transaction to reply unbundler
Eric Sumner <ericsumner@fb.com>
parents:
diff
changeset
|
114 o 1 [public:2b9c7234e035] |
743736fc7c41
bundle2-push: provide transaction to reply unbundler
Eric Sumner <ericsumner@fb.com>
parents:
diff
changeset
|
115 | |
743736fc7c41
bundle2-push: provide transaction to reply unbundler
Eric Sumner <ericsumner@fb.com>
parents:
diff
changeset
|
116 @ 0 [public:6cee5c8f3e5b] |
743736fc7c41
bundle2-push: provide transaction to reply unbundler
Eric Sumner <ericsumner@fb.com>
parents:
diff
changeset
|
117 |
743736fc7c41
bundle2-push: provide transaction to reply unbundler
Eric Sumner <ericsumner@fb.com>
parents:
diff
changeset
|
118 |
743736fc7c41
bundle2-push: provide transaction to reply unbundler
Eric Sumner <ericsumner@fb.com>
parents:
diff
changeset
|
119 |
743736fc7c41
bundle2-push: provide transaction to reply unbundler
Eric Sumner <ericsumner@fb.com>
parents:
diff
changeset
|
120 |