annotate tests/test-hg-parseurl.py @ 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 4452cb788404
children 6000f5b25c9b
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
28746
de5808c57f58 py3: use print_function in test-hg-parseurl.py
Robert Stanca <robert.stanca7@gmail.com>
parents: 28745
diff changeset
1 from __future__ import absolute_import, print_function
28806
d26c4af27978 test-hg-parseurl: stop direct symbol import of mercurial.hg.parseurl
Yuya Nishihara <yuya@tcha.org>
parents: 28746
diff changeset
2
37713
11d128a14ec0 tests: port test-hg-parseurl.py to unittest
Augie Fackler <augie@google.com>
parents: 28806
diff changeset
3 import unittest
11d128a14ec0 tests: port test-hg-parseurl.py to unittest
Augie Fackler <augie@google.com>
parents: 28806
diff changeset
4
46908
4452cb788404 urlutil: extract `parseurl` from `hg` into the new module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 43076
diff changeset
5 from mercurial.utils import urlutil
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 37714
diff changeset
6
8174
29bc5d18714a hg: allow hg.parseurl(url, None)
Martijn Pieters <mj@zopatista.com>
parents:
diff changeset
7
37713
11d128a14ec0 tests: port test-hg-parseurl.py to unittest
Augie Fackler <augie@google.com>
parents: 28806
diff changeset
8 class ParseRequestTests(unittest.TestCase):
11d128a14ec0 tests: port test-hg-parseurl.py to unittest
Augie Fackler <augie@google.com>
parents: 28806
diff changeset
9 def testparse(self):
8174
29bc5d18714a hg: allow hg.parseurl(url, None)
Martijn Pieters <mj@zopatista.com>
parents:
diff changeset
10
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 37714
diff changeset
11 self.assertEqual(
46908
4452cb788404 urlutil: extract `parseurl` from `hg` into the new module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 43076
diff changeset
12 urlutil.parseurl(b'http://example.com/no/anchor'),
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 37714
diff changeset
13 (b'http://example.com/no/anchor', (None, [])),
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 37714
diff changeset
14 )
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 37714
diff changeset
15 self.assertEqual(
46908
4452cb788404 urlutil: extract `parseurl` from `hg` into the new module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 43076
diff changeset
16 urlutil.parseurl(b'http://example.com/an/anchor#foo'),
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 37714
diff changeset
17 (b'http://example.com/an/anchor', (b'foo', [])),
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 37714
diff changeset
18 )
37713
11d128a14ec0 tests: port test-hg-parseurl.py to unittest
Augie Fackler <augie@google.com>
parents: 28806
diff changeset
19 self.assertEqual(
46908
4452cb788404 urlutil: extract `parseurl` from `hg` into the new module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 43076
diff changeset
20 urlutil.parseurl(
4452cb788404 urlutil: extract `parseurl` from `hg` into the new module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 43076
diff changeset
21 b'http://example.com/no/anchor/branches', [b'foo']
4452cb788404 urlutil: extract `parseurl` from `hg` into the new module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 43076
diff changeset
22 ),
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 37714
diff changeset
23 (b'http://example.com/no/anchor/branches', (None, [b'foo'])),
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 37714
diff changeset
24 )
37713
11d128a14ec0 tests: port test-hg-parseurl.py to unittest
Augie Fackler <augie@google.com>
parents: 28806
diff changeset
25 self.assertEqual(
46908
4452cb788404 urlutil: extract `parseurl` from `hg` into the new module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 43076
diff changeset
26 urlutil.parseurl(
4452cb788404 urlutil: extract `parseurl` from `hg` into the new module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 43076
diff changeset
27 b'http://example.com/an/anchor/branches#bar', [b'foo']
4452cb788404 urlutil: extract `parseurl` from `hg` into the new module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 43076
diff changeset
28 ),
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 37714
diff changeset
29 (b'http://example.com/an/anchor/branches', (b'bar', [b'foo'])),
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 37714
diff changeset
30 )
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 37714
diff changeset
31 self.assertEqual(
46908
4452cb788404 urlutil: extract `parseurl` from `hg` into the new module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 43076
diff changeset
32 urlutil.parseurl(
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 37714
diff changeset
33 b'http://example.com/an/anchor/branches-None#foo', None
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 37714
diff changeset
34 ),
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 37714
diff changeset
35 (b'http://example.com/an/anchor/branches-None', (b'foo', [])),
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 37714
diff changeset
36 )
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 37714
diff changeset
37 self.assertEqual(
46908
4452cb788404 urlutil: extract `parseurl` from `hg` into the new module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 43076
diff changeset
38 urlutil.parseurl(b'http://example.com/'),
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 37714
diff changeset
39 (b'http://example.com/', (None, [])),
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 37714
diff changeset
40 )
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 37714
diff changeset
41 self.assertEqual(
46908
4452cb788404 urlutil: extract `parseurl` from `hg` into the new module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 43076
diff changeset
42 urlutil.parseurl(b'http://example.com'),
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 37714
diff changeset
43 (b'http://example.com/', (None, [])),
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 37714
diff changeset
44 )
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 37714
diff changeset
45 self.assertEqual(
46908
4452cb788404 urlutil: extract `parseurl` from `hg` into the new module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 43076
diff changeset
46 urlutil.parseurl(b'http://example.com#foo'),
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 37714
diff changeset
47 (b'http://example.com/', (b'foo', [])),
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 37714
diff changeset
48 )
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 37714
diff changeset
49
37713
11d128a14ec0 tests: port test-hg-parseurl.py to unittest
Augie Fackler <augie@google.com>
parents: 28806
diff changeset
50
11d128a14ec0 tests: port test-hg-parseurl.py to unittest
Augie Fackler <augie@google.com>
parents: 28806
diff changeset
51 if __name__ == '__main__':
11d128a14ec0 tests: port test-hg-parseurl.py to unittest
Augie Fackler <augie@google.com>
parents: 28806
diff changeset
52 import silenttestrunner
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 37714
diff changeset
53
37713
11d128a14ec0 tests: port test-hg-parseurl.py to unittest
Augie Fackler <augie@google.com>
parents: 28806
diff changeset
54 silenttestrunner.main(__name__)