Mercurial > hg
annotate tests/test-rust-discovery.py @ 51977:42a116f1cdc1
branchmap-v3: introduce a "stop_rev" argument to `headsrevs`
The `headsrevs` method of the revlog already have a `revs` argument to compute
the headrevs of a limited set of heads. However, it disable the use of the
native compiled code to compute the heads, which slows down the branchmap v3
code a lot.
The branchmap v3 usage is actually quite constrained as we will always only
ignores a part at the top of the graph. So we could be significantly faster.
We start by making small change to the python side to improve the situation and
introduce the new API. More collaboration with the native code are coming later.
This massively speedup operation and close most of the remaining gaps between
branchmap-v3 and branchmap-v2. especially on repository with many revs like
mozilla-try. A small overhead remains mostly because the `headrevs` logic
currently has some inefficiently. We will look into them from there.
### benchmark.name = hg.command.unbundle
# bin-env-vars.hg.py-re2-module = default
# benchmark.variants.issue6528 = disabled
# benchmark.variants.resource-usage = default
# benchmark.variants.reuse-external-delta-parent = yes
# benchmark.variants.revs = any-1-extra-rev
# benchmark.variants.source = unbundle
# benchmark.variants.validate = default
# benchmark.variants.verbosity = quiet
## data-env-vars.name = netbeans-2018-08-01-zstd-sparse-revlog
# bin-env-vars.hg.flavor = default
branch-v2: 0.233711 ~~~~~
branch-v3 before: 0.368769 (+57.79%, +0.14)
branch-v3 after: 0.239857 (+2.63%, +0.01)
# bin-env-vars.hg.flavor = rust
branch-v2: 0.235230 ~~~~~
branch-v3 before: 0.372460 (+58.34%, +0.14)
branch-v3 after: 0.240972 (+2.44%, +0.01)
## data-env-vars.name = netbeans-2018-08-01-ds2-pnm
# bin-env-vars.hg.flavor = rust
branch-v2: 0.255586 ~~~~~
branch-v3 before: 0.318907 (+24.78%, +0.06)
branch-v3 after: 0.268560 (+5.08%, +0.01)
## data-env-vars.name = mozilla-central-2024-03-22-zstd-sparse-revlog
# bin-env-vars.hg.flavor = default
branch-v2: 0.339010 ~~~~~
branch-v3 before: 0.349752 (+3.17%, +0.01)
branch-v3 after: 0.349389 (+3.06%, +0.01)
# bin-env-vars.hg.flavor = rust
branch-v2: 0.346525 ~~~~~
branch-v3 before: 0.354300 (+2.24%, +0.01)
branch-v3 after: 0.355661 (+2.64%, +0.01)
## data-env-vars.name = mozilla-central-2024-03-22-ds2-pnm
# bin-env-vars.hg.flavor = rust
branch-v2: 0.380202 ~~~~~
branch-v3 before: 0.396293 (+4.23%, +0.02)
branch-v3 after: 0.408851 (+7.54%, +0.03)
## data-env-vars.name = mozilla-unified-2024-03-22-zstd-sparse-revlog
# bin-env-vars.hg.flavor = default
branch-v2: 0.412165 ~~~~~
branch-v3 before: 0.424769 (+3.06%, +0.01)
branch-v3 after: 0.427782 (+3.79%, +0.02)
# bin-env-vars.hg.flavor = rust
branch-v2: 0.412397 ~~~~~
branch-v3 before: 0.421796 (+2.28%, +0.01)
branch-v3 after: 0.422354 (+2.41%, +0.01)
## data-env-vars.name = mozilla-unified-2024-03-22-ds2-pnm
# bin-env-vars.hg.flavor = rust
branch-v2: 0.429501 ~~~~~
branch-v3 before: 0.443849 (+3.34%, +0.01)
branch-v3 after: 0.443197 (+3.19%, +0.01)
## data-env-vars.name = mozilla-try-2024-03-26-zstd-sparse-revlog
# bin-env-vars.hg.flavor = default
branch-v2: 3.403171 ~~~~~
branch-v3 before: 6.234055 (+83.18%, +2.83)
branch-v3 after: 3.819477 (+12.23%, +0.42)
# bin-env-vars.hg.flavor = rust
branch-v2: 3.454876 ~~~~~
branch-v3 before: 6.307813 (+82.58%, +2.85)
branch-v3 after: 3.590284 (+3.92%, +0.14)
## data-env-vars.name = mozilla-try-2024-03-26-ds2-pnm
# bin-env-vars.hg.flavor = rust
branch-v2: 3.465435 ~~~~~
branch-v3 before: 5.176076 (+49.36%, +1.71)
branch-v3 after: 3.633278 (+4.84%, +0.17)
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Tue, 03 Sep 2024 11:11:17 +0200 |
parents | 0b81440e2a73 |
children |
rev | line source |
---|---|
42179
13b64247f48f
rust-discovery: cpython bindings for the core logic
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
1 import unittest |
13b64247f48f
rust-discovery: cpython bindings for the core logic
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
2 |
42670
a7f1a0b3f461
module-policy: update rust extension import to use the new module policy
Raphaël Gomès <rgomes@octobus.net>
parents:
42180
diff
changeset
|
3 from mercurial import policy |
51245
0b81440e2a73
rust-index: using `hg::index::Index` in discovery
Georges Racinet <georges.racinet@octobus.net>
parents:
48946
diff
changeset
|
4 from mercurial.testing import revlog as revlogtesting |
42670
a7f1a0b3f461
module-policy: update rust extension import to use the new module policy
Raphaël Gomès <rgomes@octobus.net>
parents:
42180
diff
changeset
|
5 |
a7f1a0b3f461
module-policy: update rust extension import to use the new module policy
Raphaël Gomès <rgomes@octobus.net>
parents:
42180
diff
changeset
|
6 PartialDiscovery = policy.importrust('discovery', member='PartialDiscovery') |
42179
13b64247f48f
rust-discovery: cpython bindings for the core logic
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
7 |
13b64247f48f
rust-discovery: cpython bindings for the core logic
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
8 try: |
13b64247f48f
rust-discovery: cpython bindings for the core logic
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
9 from mercurial.cext import parsers as cparsers |
13b64247f48f
rust-discovery: cpython bindings for the core logic
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
10 except ImportError: |
13b64247f48f
rust-discovery: cpython bindings for the core logic
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
11 cparsers = None |
13b64247f48f
rust-discovery: cpython bindings for the core logic
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
12 |
13b64247f48f
rust-discovery: cpython bindings for the core logic
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
13 # picked from test-parse-index2, copied rather than imported |
13b64247f48f
rust-discovery: cpython bindings for the core logic
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
14 # so that it stays stable even if test-parse-index2 changes or disappears. |
13b64247f48f
rust-discovery: cpython bindings for the core logic
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
15 data_non_inlined = ( |
13b64247f48f
rust-discovery: cpython bindings for the core logic
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
16 b'\x00\x00\x00\x01\x00\x00\x00\x00\x00\x01D\x19' |
13b64247f48f
rust-discovery: cpython bindings for the core logic
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
17 b'\x00\x07e\x12\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\xff\xff' |
13b64247f48f
rust-discovery: cpython bindings for the core logic
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
18 b'\xff\xff\xff\xff\xd1\xf4\xbb\xb0\xbe\xfc\x13\xbd\x8c\xd3\x9d' |
13b64247f48f
rust-discovery: cpython bindings for the core logic
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
19 b'\x0f\xcd\xd9;\x8c\x07\x8cJ/\x00\x00\x00\x00\x00\x00\x00\x00\x00' |
13b64247f48f
rust-discovery: cpython bindings for the core logic
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
20 b'\x00\x00\x00\x00\x00\x00\x01D\x19\x00\x00\x00\x00\x00\xdf\x00' |
13b64247f48f
rust-discovery: cpython bindings for the core logic
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
21 b'\x00\x01q\x00\x00\x00\x01\x00\x00\x00\x01\x00\x00\x00\x00\xff' |
13b64247f48f
rust-discovery: cpython bindings for the core logic
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
22 b'\xff\xff\xff\xc1\x12\xb9\x04\x96\xa4Z1t\x91\xdfsJ\x90\xf0\x9bh' |
13b64247f48f
rust-discovery: cpython bindings for the core logic
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
23 b'\x07l&\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' |
13b64247f48f
rust-discovery: cpython bindings for the core logic
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
24 b'\x00\x01D\xf8\x00\x00\x00\x00\x01\x1b\x00\x00\x01\xb8\x00\x00' |
13b64247f48f
rust-discovery: cpython bindings for the core logic
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
25 b'\x00\x01\x00\x00\x00\x02\x00\x00\x00\x01\xff\xff\xff\xff\x02\n' |
13b64247f48f
rust-discovery: cpython bindings for the core logic
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
26 b'\x0e\xc6&\xa1\x92\xae6\x0b\x02i\xfe-\xe5\xbao\x05\xd1\xe7\x00' |
13b64247f48f
rust-discovery: cpython bindings for the core logic
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
27 b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01F' |
13b64247f48f
rust-discovery: cpython bindings for the core logic
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
28 b'\x13\x00\x00\x00\x00\x01\xec\x00\x00\x03\x06\x00\x00\x00\x01' |
13b64247f48f
rust-discovery: cpython bindings for the core logic
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
29 b'\x00\x00\x00\x03\x00\x00\x00\x02\xff\xff\xff\xff\x12\xcb\xeby1' |
13b64247f48f
rust-discovery: cpython bindings for the core logic
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
30 b'\xb6\r\x98B\xcb\x07\xbd`\x8f\x92\xd9\xc4\x84\xbdK\x00\x00\x00' |
13b64247f48f
rust-discovery: cpython bindings for the core logic
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
31 b'\x00\x00\x00\x00\x00\x00\x00\x00\x00' |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42759
diff
changeset
|
32 ) |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42759
diff
changeset
|
33 |
42179
13b64247f48f
rust-discovery: cpython bindings for the core logic
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
34 |
48946
642e31cb55f0
py3: use class X: instead of class X(object):
Gregory Szorc <gregory.szorc@gmail.com>
parents:
48875
diff
changeset
|
35 class fakechangelog: |
42759
791791a1fd4e
tests: split joint repo/changelog fake into one for each type
Augie Fackler <augie@google.com>
parents:
42741
diff
changeset
|
36 def __init__(self, idx): |
791791a1fd4e
tests: split joint repo/changelog fake into one for each type
Augie Fackler <augie@google.com>
parents:
42741
diff
changeset
|
37 self.index = idx |
791791a1fd4e
tests: split joint repo/changelog fake into one for each type
Augie Fackler <augie@google.com>
parents:
42741
diff
changeset
|
38 |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42759
diff
changeset
|
39 |
48946
642e31cb55f0
py3: use class X: instead of class X(object):
Gregory Szorc <gregory.szorc@gmail.com>
parents:
48875
diff
changeset
|
40 class fakerepo: |
42736
b6f3f704a561
rust-discovery: read the index from a repo passed at init
Georges Racinet <georges.racinet@octobus.net>
parents:
42735
diff
changeset
|
41 def __init__(self, idx): |
b6f3f704a561
rust-discovery: read the index from a repo passed at init
Georges Racinet <georges.racinet@octobus.net>
parents:
42735
diff
changeset
|
42 """Just make so that self.changelog.index is the given idx.""" |
42759
791791a1fd4e
tests: split joint repo/changelog fake into one for each type
Augie Fackler <augie@google.com>
parents:
42741
diff
changeset
|
43 self.changelog = fakechangelog(idx) |
42179
13b64247f48f
rust-discovery: cpython bindings for the core logic
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
44 |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42759
diff
changeset
|
45 |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42759
diff
changeset
|
46 @unittest.skipIf( |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42759
diff
changeset
|
47 PartialDiscovery is None or cparsers is None, |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42759
diff
changeset
|
48 "rustext or the C Extension parsers module " |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42759
diff
changeset
|
49 "discovery relies on is not available", |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42759
diff
changeset
|
50 ) |
51245
0b81440e2a73
rust-index: using `hg::index::Index` in discovery
Georges Racinet <georges.racinet@octobus.net>
parents:
48946
diff
changeset
|
51 class rustdiscoverytest(revlogtesting.RustRevlogBasedTestBase): |
42179
13b64247f48f
rust-discovery: cpython bindings for the core logic
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
52 """Test the correctness of binding to Rust code. |
13b64247f48f
rust-discovery: cpython bindings for the core logic
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
53 |
13b64247f48f
rust-discovery: cpython bindings for the core logic
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
54 This test is merely for the binding to Rust itself: extraction of |
13b64247f48f
rust-discovery: cpython bindings for the core logic
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
55 Python variable, giving back the results etc. |
13b64247f48f
rust-discovery: cpython bindings for the core logic
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
56 |
13b64247f48f
rust-discovery: cpython bindings for the core logic
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
57 It is not meant to test the algorithmic correctness of the provided |
13b64247f48f
rust-discovery: cpython bindings for the core logic
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
58 methods. Hence the very simple embedded index data is good enough. |
13b64247f48f
rust-discovery: cpython bindings for the core logic
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
59 |
13b64247f48f
rust-discovery: cpython bindings for the core logic
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
60 Algorithmic correctness is asserted by the Rust unit tests. |
13b64247f48f
rust-discovery: cpython bindings for the core logic
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
61 """ |
13b64247f48f
rust-discovery: cpython bindings for the core logic
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
62 |
13b64247f48f
rust-discovery: cpython bindings for the core logic
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
63 def parseindex(self): |
51245
0b81440e2a73
rust-index: using `hg::index::Index` in discovery
Georges Racinet <georges.racinet@octobus.net>
parents:
48946
diff
changeset
|
64 return self.parserustindex(data=data_non_inlined) |
42179
13b64247f48f
rust-discovery: cpython bindings for the core logic
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
65 |
42736
b6f3f704a561
rust-discovery: read the index from a repo passed at init
Georges Racinet <georges.racinet@octobus.net>
parents:
42735
diff
changeset
|
66 def repo(self): |
b6f3f704a561
rust-discovery: read the index from a repo passed at init
Georges Racinet <georges.racinet@octobus.net>
parents:
42735
diff
changeset
|
67 return fakerepo(self.parseindex()) |
b6f3f704a561
rust-discovery: read the index from a repo passed at init
Georges Racinet <georges.racinet@octobus.net>
parents:
42735
diff
changeset
|
68 |
42179
13b64247f48f
rust-discovery: cpython bindings for the core logic
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
69 def testindex(self): |
13b64247f48f
rust-discovery: cpython bindings for the core logic
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
70 idx = self.parseindex() |
13b64247f48f
rust-discovery: cpython bindings for the core logic
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
71 # checking our assumptions about the index binary data: |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42759
diff
changeset
|
72 self.assertEqual( |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42759
diff
changeset
|
73 {i: (r[5], r[6]) for i, r in enumerate(idx)}, |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42759
diff
changeset
|
74 {0: (-1, -1), 1: (0, -1), 2: (1, -1), 3: (2, -1)}, |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42759
diff
changeset
|
75 ) |
42179
13b64247f48f
rust-discovery: cpython bindings for the core logic
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
76 |
13b64247f48f
rust-discovery: cpython bindings for the core logic
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
77 def testaddcommonsmissings(self): |
42736
b6f3f704a561
rust-discovery: read the index from a repo passed at init
Georges Racinet <georges.racinet@octobus.net>
parents:
42735
diff
changeset
|
78 disco = PartialDiscovery(self.repo(), [3], True) |
42179
13b64247f48f
rust-discovery: cpython bindings for the core logic
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
79 self.assertFalse(disco.hasinfo()) |
13b64247f48f
rust-discovery: cpython bindings for the core logic
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
80 self.assertFalse(disco.iscomplete()) |
13b64247f48f
rust-discovery: cpython bindings for the core logic
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
81 |
13b64247f48f
rust-discovery: cpython bindings for the core logic
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
82 disco.addcommons([1]) |
13b64247f48f
rust-discovery: cpython bindings for the core logic
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
83 self.assertTrue(disco.hasinfo()) |
13b64247f48f
rust-discovery: cpython bindings for the core logic
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
84 self.assertFalse(disco.iscomplete()) |
13b64247f48f
rust-discovery: cpython bindings for the core logic
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
85 |
13b64247f48f
rust-discovery: cpython bindings for the core logic
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
86 disco.addmissings([2]) |
13b64247f48f
rust-discovery: cpython bindings for the core logic
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
87 self.assertTrue(disco.hasinfo()) |
13b64247f48f
rust-discovery: cpython bindings for the core logic
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
88 self.assertTrue(disco.iscomplete()) |
13b64247f48f
rust-discovery: cpython bindings for the core logic
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
89 |
13b64247f48f
rust-discovery: cpython bindings for the core logic
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
90 self.assertEqual(disco.commonheads(), {1}) |
13b64247f48f
rust-discovery: cpython bindings for the core logic
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
91 |
42180
1b0be75cb61f
rust-discovery: implementing and exposing stats()
Georges Racinet <georges.racinet@octobus.net>
parents:
42179
diff
changeset
|
92 def testaddmissingsstats(self): |
42736
b6f3f704a561
rust-discovery: read the index from a repo passed at init
Georges Racinet <georges.racinet@octobus.net>
parents:
42735
diff
changeset
|
93 disco = PartialDiscovery(self.repo(), [3], True) |
42180
1b0be75cb61f
rust-discovery: implementing and exposing stats()
Georges Racinet <georges.racinet@octobus.net>
parents:
42179
diff
changeset
|
94 self.assertIsNone(disco.stats()['undecided'], None) |
1b0be75cb61f
rust-discovery: implementing and exposing stats()
Georges Racinet <georges.racinet@octobus.net>
parents:
42179
diff
changeset
|
95 |
1b0be75cb61f
rust-discovery: implementing and exposing stats()
Georges Racinet <georges.racinet@octobus.net>
parents:
42179
diff
changeset
|
96 disco.addmissings([2]) |
1b0be75cb61f
rust-discovery: implementing and exposing stats()
Georges Racinet <georges.racinet@octobus.net>
parents:
42179
diff
changeset
|
97 self.assertEqual(disco.stats()['undecided'], 2) |
1b0be75cb61f
rust-discovery: implementing and exposing stats()
Georges Racinet <georges.racinet@octobus.net>
parents:
42179
diff
changeset
|
98 |
42179
13b64247f48f
rust-discovery: cpython bindings for the core logic
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
99 def testaddinfocommonfirst(self): |
42736
b6f3f704a561
rust-discovery: read the index from a repo passed at init
Georges Racinet <georges.racinet@octobus.net>
parents:
42735
diff
changeset
|
100 disco = PartialDiscovery(self.repo(), [3], True) |
42179
13b64247f48f
rust-discovery: cpython bindings for the core logic
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
101 disco.addinfo([(1, True), (2, False)]) |
13b64247f48f
rust-discovery: cpython bindings for the core logic
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
102 self.assertTrue(disco.hasinfo()) |
13b64247f48f
rust-discovery: cpython bindings for the core logic
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
103 self.assertTrue(disco.iscomplete()) |
13b64247f48f
rust-discovery: cpython bindings for the core logic
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
104 self.assertEqual(disco.commonheads(), {1}) |
13b64247f48f
rust-discovery: cpython bindings for the core logic
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
105 |
13b64247f48f
rust-discovery: cpython bindings for the core logic
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
106 def testaddinfomissingfirst(self): |
42736
b6f3f704a561
rust-discovery: read the index from a repo passed at init
Georges Racinet <georges.racinet@octobus.net>
parents:
42735
diff
changeset
|
107 disco = PartialDiscovery(self.repo(), [3], True) |
42179
13b64247f48f
rust-discovery: cpython bindings for the core logic
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
108 disco.addinfo([(2, False), (1, True)]) |
13b64247f48f
rust-discovery: cpython bindings for the core logic
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
109 self.assertTrue(disco.hasinfo()) |
13b64247f48f
rust-discovery: cpython bindings for the core logic
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
110 self.assertTrue(disco.iscomplete()) |
13b64247f48f
rust-discovery: cpython bindings for the core logic
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
111 self.assertEqual(disco.commonheads(), {1}) |
13b64247f48f
rust-discovery: cpython bindings for the core logic
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
112 |
42741
4e7bd6180b53
rust-discovery: optionally don't randomize at all, for tests
Georges Racinet <georges.racinet@octobus.net>
parents:
42736
diff
changeset
|
113 def testinitnorandom(self): |
4e7bd6180b53
rust-discovery: optionally don't randomize at all, for tests
Georges Racinet <georges.racinet@octobus.net>
parents:
42736
diff
changeset
|
114 PartialDiscovery(self.repo(), [3], True, randomize=False) |
4e7bd6180b53
rust-discovery: optionally don't randomize at all, for tests
Georges Racinet <georges.racinet@octobus.net>
parents:
42736
diff
changeset
|
115 |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42759
diff
changeset
|
116 |
42179
13b64247f48f
rust-discovery: cpython bindings for the core logic
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
117 if __name__ == '__main__': |
13b64247f48f
rust-discovery: cpython bindings for the core logic
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
118 import silenttestrunner |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42759
diff
changeset
|
119 |
42179
13b64247f48f
rust-discovery: cpython bindings for the core logic
Georges Racinet <georges.racinet@octobus.net>
parents:
diff
changeset
|
120 silenttestrunner.main(__name__) |