Mercurial > hg
annotate tests/test-parseindex2.py @ 42044:bb271ec2fbfb
compression: introduce a `storage.revlog.zstd.level` configuration
This option control the zstd compression level used when compressing revlog
chunk. The usage of zstd for revlog compression has not graduated from
experimental yet, but we intend to fix that soon.
The option name for the compression level is more straight forward to pick, so
this changesets comes first. Having a dedicated option for each compression
engine is useful because they don't support the same range of values.
I ran the same measurement as for the zlib compression level (in the parent
changesets). The variation in repository size is stay mostly in the same (small)
range. The "read/write" performance see smallish variation, but are overall much
better than zlib. Write performance show the same tend of having better write
performance for when reaching high-end compression.
Again, we don't intend to change the default zstd compression level (currently:
3) in this series. However this is worth investigating in the future.
The Performance comparison of zlib vs zstd is quite impressive. The repository
size stay in the same range, but the performance are much better in all
situations.
Comparison summary
==================
We are looking at:
- performance range for zlib
- performance range for zstd
- comparison of default zstd (level-3) to default zlib (level 6)
- comparison of the slowest zstd time to the fastest zlib time
Read performance:
-----------------
| zlib | zstd | cmp | f2s
mercurial | 0.170159 - 0.189219 | 0.144127 - 0.149624 | 80% | 88%
pypy | 2.679217 - 2.768691 | 1.532317 - 1.705044 | 60% | 63%
netbeans | 122.477027 - 141.620281 | 72.996346 - 89.731560 | 58% | 73%
mozilla | 147.867662 - 170.572118 | 91.700995 - 105.853099 | 56% | 71%
Write performance:
------------------
| zlib | zstd | cmp | f2s
mercurial | 53.250304 - 56.2936129 | 40.877025 - 45.677286 | 75% | 86%
pypy | 460.721984 - 476.589918 | 270.545409 - 301.002219 | 63% | 65%
netbeans | 520.560316 - 715.930400 | 370.356311 - 428.329652 | 55% | 82%
mozilla | 739.803002 - 987.056093 | 505.152906 - 591.930683 | 57% | 80%
Raw data
--------
repo alg lvl .hg/store size 00manifest.d read write
mercurial zlib 1 49,402,813 5,963,475 0.170159 53.250304
mercurial zlib 6 47,197,397 5,875,730 0.182820 56.264320
mercurial zlib 9 47,121,596 5,849,781 0.189219 56.293612
mercurial zstd 1 49,737,084 5,966,355 0.144127 40.877025
mercurial zstd 3 48,961,867 5,895,208 0.146376 42.268142
mercurial zstd 5 48,200,592 5,938,676 0.149624 43.162875
mercurial zstd 10 47,833,520 5,913,353 0.145185 44.012489
mercurial zstd 15 47,314,604 5,728,679 0.147686 45.677286
mercurial zstd 20 47,330,502 5,830,539 0.145789 45.025407
mercurial zstd 22 47,330,076 5,830,539 0.143996 44.690460
pypy zlib 1 370,830,572 28,462,425 2.679217 460.721984
pypy zlib 6 340,112,317 27,648,747 2.768691 467.537158
pypy zlib 9 338,360,736 27,639,003 2.763495 476.589918
pypy zstd 1 362,377,479 27,916,214 1.532317 270.545409
pypy zstd 3 354,137,693 27,905,988 1.686718 294.951509
pypy zstd 5 342,640,043 27,655,774 1.705044 301.002219
pypy zstd 10 334,224,327 27,164,493 1.567287 285.186239
pypy zstd 15 329,000,363 26,645,965 1.637729 299.561332
pypy zstd 20 324,534,039 26,199,547 1.526813 302.149827
pypy zstd 22 324,530,595 26,198,932 1.525718 307.821218
netbeans zlib 1 1,281,847,810 165,495,457 122.477027 520.560316
netbeans zlib 6 1,205,284,353 159,161,207 139.876147 715.930400
netbeans zlib 9 1,197,135,671 155,034,586 141.620281 678.297064
netbeans zstd 1 1,259,581,737 160,840,613 72.996346 370.356311
netbeans zstd 3 1,232,978,122 157,691,551 81.622317 396.733087
netbeans zstd 5 1,208,034,075 160,246,880 83.080549 364.342626
netbeans zstd 10 1,188,624,176 156,083,417 79.323935 403.594602
netbeans zstd 15 1,176,973,589 153,859,477 89.731560 428.329652
netbeans zstd 20 1,162,958,258 151,147,535 82.842667 392.335349
netbeans zstd 22 1,162,707,029 151,150,220 82.565695 402.840655
mozilla zlib 1 2,775,497,186 298,527,987 147.867662 751.263721
mozilla zlib 6 2,596,856,420 286,597,671 170.572118 987.056093
mozilla zlib 9 2,587,542,494 287,018,264 163.622338 739.803002
mozilla zstd 1 2,723,159,348 286,617,532 91.700995 570.042751
mozilla zstd 3 2,665,055,001 286,152,013 95.240155 561.412805
mozilla zstd 5 2,607,819,817 288,060,030 101.978048 505.152906
mozilla zstd 10 2,558,761,085 283,967,648 104.113481 497.771202
mozilla zstd 15 2,526,216,060 275,581,300 105.853099 591.930683
mozilla zstd 20 2,485,114,806 266,478,859 95.268795 576.515389
mozilla zstd 22 2,484,869,080 266,456,505 94.429282 572.785537
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Wed, 27 Mar 2019 18:35:59 +0100 |
parents | daedb70fd467 |
children | 2372284d9457 |
rev | line source |
---|---|
20742
3681de20b0a7
parsers: fail fast if Python has wrong minor version (issue4110)
Chris Jerdonek <chris.jerdonek@gmail.com>
parents:
20166
diff
changeset
|
1 """This unit test primarily tests parsers.parse_index2(). |
3681de20b0a7
parsers: fail fast if Python has wrong minor version (issue4110)
Chris Jerdonek <chris.jerdonek@gmail.com>
parents:
20166
diff
changeset
|
2 |
3681de20b0a7
parsers: fail fast if Python has wrong minor version (issue4110)
Chris Jerdonek <chris.jerdonek@gmail.com>
parents:
20166
diff
changeset
|
3 It also checks certain aspects of the parsers module as a whole. |
3681de20b0a7
parsers: fail fast if Python has wrong minor version (issue4110)
Chris Jerdonek <chris.jerdonek@gmail.com>
parents:
20166
diff
changeset
|
4 """ |
20166
7eda5bb9ec8f
parsers: clarify documentation of test-parseindex2.py
Chris Jerdonek <chris.jerdonek@gmail.com>
parents:
20159
diff
changeset
|
5 |
28754
7e5744e8334c
py3: use print_function in test-parseindex2.py
Robert Stanca <robert.stanca7@gmail.com>
parents:
28753
diff
changeset
|
6 from __future__ import absolute_import, print_function |
28841
e155b8d5e3b7
tests: move stdlib imports before mercurial modules in test-parseindex2
Yuya Nishihara <yuya@tcha.org>
parents:
28754
diff
changeset
|
7 |
e155b8d5e3b7
tests: move stdlib imports before mercurial modules in test-parseindex2
Yuya Nishihara <yuya@tcha.org>
parents:
28754
diff
changeset
|
8 import struct |
e155b8d5e3b7
tests: move stdlib imports before mercurial modules in test-parseindex2
Yuya Nishihara <yuya@tcha.org>
parents:
28754
diff
changeset
|
9 import subprocess |
e155b8d5e3b7
tests: move stdlib imports before mercurial modules in test-parseindex2
Yuya Nishihara <yuya@tcha.org>
parents:
28754
diff
changeset
|
10 import sys |
38989
01966d45b45e
tests: start moving test-parseindex2.py to a unittest
Augie Fackler <augie@google.com>
parents:
38852
diff
changeset
|
11 import unittest |
28841
e155b8d5e3b7
tests: move stdlib imports before mercurial modules in test-parseindex2
Yuya Nishihara <yuya@tcha.org>
parents:
28754
diff
changeset
|
12 |
28753
0c2295384eea
py3: use absolute_import in test-parseindex2.py
Robert Stanca <robert.stanca7@gmail.com>
parents:
27637
diff
changeset
|
13 from mercurial.node import ( |
0c2295384eea
py3: use absolute_import in test-parseindex2.py
Robert Stanca <robert.stanca7@gmail.com>
parents:
27637
diff
changeset
|
14 nullid, |
0c2295384eea
py3: use absolute_import in test-parseindex2.py
Robert Stanca <robert.stanca7@gmail.com>
parents:
27637
diff
changeset
|
15 nullrev, |
0c2295384eea
py3: use absolute_import in test-parseindex2.py
Robert Stanca <robert.stanca7@gmail.com>
parents:
27637
diff
changeset
|
16 ) |
29205
a0939666b836
py3: move up symbol imports to enforce import-checker rules
Yuya Nishihara <yuya@tcha.org>
parents:
28841
diff
changeset
|
17 from mercurial import ( |
39046
a450d460774e
tests: restore Python 3 compat in test-parseindex2.py
Augie Fackler <augie@google.com>
parents:
39045
diff
changeset
|
18 node as nodemod, |
32372
df448de7cf3b
parsers: switch to policy importer
Yuya Nishihara <yuya@tcha.org>
parents:
29205
diff
changeset
|
19 policy, |
38095
3de58f50afa2
tests: fix test-parseindex2 on Python 3
Augie Fackler <augie@google.com>
parents:
37894
diff
changeset
|
20 pycompat, |
29205
a0939666b836
py3: move up symbol imports to enforce import-checker rules
Yuya Nishihara <yuya@tcha.org>
parents:
28841
diff
changeset
|
21 ) |
7110
75fdc39b6172
Add parseindex2.py test case
Bernhard Leiner <bleiner@gmail.com>
parents:
diff
changeset
|
22 |
32372
df448de7cf3b
parsers: switch to policy importer
Yuya Nishihara <yuya@tcha.org>
parents:
29205
diff
changeset
|
23 parsers = policy.importmod(r'parsers') |
df448de7cf3b
parsers: switch to policy importer
Yuya Nishihara <yuya@tcha.org>
parents:
29205
diff
changeset
|
24 |
7110
75fdc39b6172
Add parseindex2.py test case
Bernhard Leiner <bleiner@gmail.com>
parents:
diff
changeset
|
25 # original python implementation |
75fdc39b6172
Add parseindex2.py test case
Bernhard Leiner <bleiner@gmail.com>
parents:
diff
changeset
|
26 def gettype(q): |
75fdc39b6172
Add parseindex2.py test case
Bernhard Leiner <bleiner@gmail.com>
parents:
diff
changeset
|
27 return int(q & 0xFFFF) |
75fdc39b6172
Add parseindex2.py test case
Bernhard Leiner <bleiner@gmail.com>
parents:
diff
changeset
|
28 |
75fdc39b6172
Add parseindex2.py test case
Bernhard Leiner <bleiner@gmail.com>
parents:
diff
changeset
|
29 def offset_type(offset, type): |
37894
2f00c6e8f6a1
tests: port test-parseindex2.py to Python 3
Augie Fackler <augie@google.com>
parents:
37893
diff
changeset
|
30 return int(int(offset) << 16 | type) |
7110
75fdc39b6172
Add parseindex2.py test case
Bernhard Leiner <bleiner@gmail.com>
parents:
diff
changeset
|
31 |
75fdc39b6172
Add parseindex2.py test case
Bernhard Leiner <bleiner@gmail.com>
parents:
diff
changeset
|
32 indexformatng = ">Qiiiiii20s12x" |
75fdc39b6172
Add parseindex2.py test case
Bernhard Leiner <bleiner@gmail.com>
parents:
diff
changeset
|
33 |
75fdc39b6172
Add parseindex2.py test case
Bernhard Leiner <bleiner@gmail.com>
parents:
diff
changeset
|
34 def py_parseindex(data, inline) : |
75fdc39b6172
Add parseindex2.py test case
Bernhard Leiner <bleiner@gmail.com>
parents:
diff
changeset
|
35 s = 64 |
75fdc39b6172
Add parseindex2.py test case
Bernhard Leiner <bleiner@gmail.com>
parents:
diff
changeset
|
36 cache = None |
75fdc39b6172
Add parseindex2.py test case
Bernhard Leiner <bleiner@gmail.com>
parents:
diff
changeset
|
37 index = [] |
27637
b502138f5faa
cleanup: remove superfluous space after space after equals (python)
timeless <timeless@mozdev.org>
parents:
20742
diff
changeset
|
38 nodemap = {nullid: nullrev} |
7110
75fdc39b6172
Add parseindex2.py test case
Bernhard Leiner <bleiner@gmail.com>
parents:
diff
changeset
|
39 n = off = 0 |
13253 | 40 |
7110
75fdc39b6172
Add parseindex2.py test case
Bernhard Leiner <bleiner@gmail.com>
parents:
diff
changeset
|
41 l = len(data) - s |
75fdc39b6172
Add parseindex2.py test case
Bernhard Leiner <bleiner@gmail.com>
parents:
diff
changeset
|
42 append = index.append |
75fdc39b6172
Add parseindex2.py test case
Bernhard Leiner <bleiner@gmail.com>
parents:
diff
changeset
|
43 if inline: |
75fdc39b6172
Add parseindex2.py test case
Bernhard Leiner <bleiner@gmail.com>
parents:
diff
changeset
|
44 cache = (0, data) |
75fdc39b6172
Add parseindex2.py test case
Bernhard Leiner <bleiner@gmail.com>
parents:
diff
changeset
|
45 while off <= l: |
75fdc39b6172
Add parseindex2.py test case
Bernhard Leiner <bleiner@gmail.com>
parents:
diff
changeset
|
46 e = struct.unpack(indexformatng, data[off:off + s]) |
75fdc39b6172
Add parseindex2.py test case
Bernhard Leiner <bleiner@gmail.com>
parents:
diff
changeset
|
47 nodemap[e[7]] = n |
75fdc39b6172
Add parseindex2.py test case
Bernhard Leiner <bleiner@gmail.com>
parents:
diff
changeset
|
48 append(e) |
75fdc39b6172
Add parseindex2.py test case
Bernhard Leiner <bleiner@gmail.com>
parents:
diff
changeset
|
49 n += 1 |
75fdc39b6172
Add parseindex2.py test case
Bernhard Leiner <bleiner@gmail.com>
parents:
diff
changeset
|
50 if e[1] < 0: |
75fdc39b6172
Add parseindex2.py test case
Bernhard Leiner <bleiner@gmail.com>
parents:
diff
changeset
|
51 break |
75fdc39b6172
Add parseindex2.py test case
Bernhard Leiner <bleiner@gmail.com>
parents:
diff
changeset
|
52 off += e[1] + s |
75fdc39b6172
Add parseindex2.py test case
Bernhard Leiner <bleiner@gmail.com>
parents:
diff
changeset
|
53 else: |
75fdc39b6172
Add parseindex2.py test case
Bernhard Leiner <bleiner@gmail.com>
parents:
diff
changeset
|
54 while off <= l: |
75fdc39b6172
Add parseindex2.py test case
Bernhard Leiner <bleiner@gmail.com>
parents:
diff
changeset
|
55 e = struct.unpack(indexformatng, data[off:off + s]) |
75fdc39b6172
Add parseindex2.py test case
Bernhard Leiner <bleiner@gmail.com>
parents:
diff
changeset
|
56 nodemap[e[7]] = n |
75fdc39b6172
Add parseindex2.py test case
Bernhard Leiner <bleiner@gmail.com>
parents:
diff
changeset
|
57 append(e) |
75fdc39b6172
Add parseindex2.py test case
Bernhard Leiner <bleiner@gmail.com>
parents:
diff
changeset
|
58 n += 1 |
75fdc39b6172
Add parseindex2.py test case
Bernhard Leiner <bleiner@gmail.com>
parents:
diff
changeset
|
59 off += s |
75fdc39b6172
Add parseindex2.py test case
Bernhard Leiner <bleiner@gmail.com>
parents:
diff
changeset
|
60 |
75fdc39b6172
Add parseindex2.py test case
Bernhard Leiner <bleiner@gmail.com>
parents:
diff
changeset
|
61 e = list(index[0]) |
75fdc39b6172
Add parseindex2.py test case
Bernhard Leiner <bleiner@gmail.com>
parents:
diff
changeset
|
62 type = gettype(e[0]) |
75fdc39b6172
Add parseindex2.py test case
Bernhard Leiner <bleiner@gmail.com>
parents:
diff
changeset
|
63 e[0] = offset_type(0, type) |
75fdc39b6172
Add parseindex2.py test case
Bernhard Leiner <bleiner@gmail.com>
parents:
diff
changeset
|
64 index[0] = tuple(e) |
75fdc39b6172
Add parseindex2.py test case
Bernhard Leiner <bleiner@gmail.com>
parents:
diff
changeset
|
65 |
13254
5ef5eb1f3515
revlog: only build the nodemap on demand
Matt Mackall <mpm@selenic.com>
parents:
13253
diff
changeset
|
66 return index, cache |
7110
75fdc39b6172
Add parseindex2.py test case
Bernhard Leiner <bleiner@gmail.com>
parents:
diff
changeset
|
67 |
37893
b4e42a9bd12e
tests: prefer string concatenation with () instead of \ in parseindex2 tests
Augie Fackler <augie@google.com>
parents:
32372
diff
changeset
|
68 data_inlined = ( |
37894
2f00c6e8f6a1
tests: port test-parseindex2.py to Python 3
Augie Fackler <augie@google.com>
parents:
37893
diff
changeset
|
69 b'\x00\x01\x00\x01\x00\x00\x00\x00\x00\x00\x01\x8c' |
2f00c6e8f6a1
tests: port test-parseindex2.py to Python 3
Augie Fackler <augie@google.com>
parents:
37893
diff
changeset
|
70 b'\x00\x00\x04\x07\x00\x00\x00\x00\x00\x00\x15\x15\xff\xff\xff' |
2f00c6e8f6a1
tests: port test-parseindex2.py to Python 3
Augie Fackler <augie@google.com>
parents:
37893
diff
changeset
|
71 b'\xff\xff\xff\xff\xff\xebG\x97\xb7\x1fB\x04\xcf\x13V\x81\tw\x1b' |
2f00c6e8f6a1
tests: port test-parseindex2.py to Python 3
Augie Fackler <augie@google.com>
parents:
37893
diff
changeset
|
72 b'w\xdduR\xda\xc6\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' |
2f00c6e8f6a1
tests: port test-parseindex2.py to Python 3
Augie Fackler <augie@google.com>
parents:
37893
diff
changeset
|
73 b'x\x9c\x9d\x93?O\xc30\x10\xc5\xf7|\x8a\xdb\x9a\xa8m\x06\xd8*\x95' |
2f00c6e8f6a1
tests: port test-parseindex2.py to Python 3
Augie Fackler <augie@google.com>
parents:
37893
diff
changeset
|
74 b'\x81B\xa1\xa2\xa2R\xcb\x86Pd\x9a\x0b5$vd_\x04\xfd\xf6\x9c\xff@' |
2f00c6e8f6a1
tests: port test-parseindex2.py to Python 3
Augie Fackler <augie@google.com>
parents:
37893
diff
changeset
|
75 b'\x11!\x0b\xd9\xec\xf7\xbbw\xe7gG6\xad6\x04\xdaN\xc0\x92\xa0$)' |
2f00c6e8f6a1
tests: port test-parseindex2.py to Python 3
Augie Fackler <augie@google.com>
parents:
37893
diff
changeset
|
76 b'\xb1\x82\xa2\xd1%\x16\xa4\x8b7\xa9\xca\xd4-\xb2Y\x02\xfc\xc9' |
2f00c6e8f6a1
tests: port test-parseindex2.py to Python 3
Augie Fackler <augie@google.com>
parents:
37893
diff
changeset
|
77 b'\xcaS\xf9\xaeX\xed\xb6\xd77Q\x02\x83\xd4\x19\xf5--Y\xea\xe1W' |
2f00c6e8f6a1
tests: port test-parseindex2.py to Python 3
Augie Fackler <augie@google.com>
parents:
37893
diff
changeset
|
78 b'\xab\xed\x10\xceR\x0f_\xdf\xdf\r\xe1,\xf5\xf0\xcb\xf5 \xceR\x0f' |
2f00c6e8f6a1
tests: port test-parseindex2.py to Python 3
Augie Fackler <augie@google.com>
parents:
37893
diff
changeset
|
79 b'_\xdc\x0e\x0e\xc3R\x0f_\xae\x96\x9b!\x9e\xa5\x1e\xbf\xdb,\x06' |
2f00c6e8f6a1
tests: port test-parseindex2.py to Python 3
Augie Fackler <augie@google.com>
parents:
37893
diff
changeset
|
80 b'\xc7q\x9a/\x88\x82\xc3B\xea\xb5\xb4TJ\x93\xb6\x82\x0e\xe16\xe6' |
2f00c6e8f6a1
tests: port test-parseindex2.py to Python 3
Augie Fackler <augie@google.com>
parents:
37893
diff
changeset
|
81 b'KQ\xdb\xaf\xecG\xa3\xd1 \x01\xd3\x0b_^\xe8\xaa\xa0\xae\xad\xd1' |
2f00c6e8f6a1
tests: port test-parseindex2.py to Python 3
Augie Fackler <augie@google.com>
parents:
37893
diff
changeset
|
82 b'&\xbef\x1bz\x08\xb0|\xc9Xz\x06\xf6Z\x91\x90J\xaa\x17\x90\xaa' |
2f00c6e8f6a1
tests: port test-parseindex2.py to Python 3
Augie Fackler <augie@google.com>
parents:
37893
diff
changeset
|
83 b'\xd2\xa6\x11$5C\xcf\xba#\xa0\x03\x02*2\x92-\xfc\xb1\x94\xdf\xe2' |
2f00c6e8f6a1
tests: port test-parseindex2.py to Python 3
Augie Fackler <augie@google.com>
parents:
37893
diff
changeset
|
84 b'\xae\xb8\'m\x8ey0^\x85\xd3\x82\xb4\xf0`:\x9c\x00\x8a\xfd\x01' |
2f00c6e8f6a1
tests: port test-parseindex2.py to Python 3
Augie Fackler <augie@google.com>
parents:
37893
diff
changeset
|
85 b'\xb0\xc6\x86\x8b\xdd\xae\x80\xf3\xa9\x9fd\x16\n\x00R%\x1a\x06' |
2f00c6e8f6a1
tests: port test-parseindex2.py to Python 3
Augie Fackler <augie@google.com>
parents:
37893
diff
changeset
|
86 b'\xe9\xd8b\x98\x1d\xf4\xf3+\x9bf\x01\xd8p\x1b\xf3.\xed\x9f^g\xc3' |
2f00c6e8f6a1
tests: port test-parseindex2.py to Python 3
Augie Fackler <augie@google.com>
parents:
37893
diff
changeset
|
87 b'^\xd9W81T\xdb\xd5\x04sx|\xf2\xeb\xd6`%?x\xed"\x831\xbf\xf3\xdc' |
2f00c6e8f6a1
tests: port test-parseindex2.py to Python 3
Augie Fackler <augie@google.com>
parents:
37893
diff
changeset
|
88 b'b\xeb%gaY\xe1\xad\x9f\xb9f\'1w\xa9\xa5a\x83s\x82J\xb98\xbc4\x8b' |
2f00c6e8f6a1
tests: port test-parseindex2.py to Python 3
Augie Fackler <augie@google.com>
parents:
37893
diff
changeset
|
89 b'\x83\x00\x9f$z\xb8#\xa5\xb1\xdf\x98\xd9\xec\x1b\x89O\xe3Ts\x9a4' |
2f00c6e8f6a1
tests: port test-parseindex2.py to Python 3
Augie Fackler <augie@google.com>
parents:
37893
diff
changeset
|
90 b'\x17m\x8b\xfc\x8f\xa5\x95\x9a\xfc\xfa\xed,\xe5|\xa1\xfe\x15\xb9' |
2f00c6e8f6a1
tests: port test-parseindex2.py to Python 3
Augie Fackler <augie@google.com>
parents:
37893
diff
changeset
|
91 b'\xbc\xb2\x93\x1f\xf2\x95\xff\xdf,\x1a\xc5\xe7\x17*\x93Oz:>\x0e' |
37893
b4e42a9bd12e
tests: prefer string concatenation with () instead of \ in parseindex2 tests
Augie Fackler <augie@google.com>
parents:
32372
diff
changeset
|
92 ) |
7110
75fdc39b6172
Add parseindex2.py test case
Bernhard Leiner <bleiner@gmail.com>
parents:
diff
changeset
|
93 |
37893
b4e42a9bd12e
tests: prefer string concatenation with () instead of \ in parseindex2 tests
Augie Fackler <augie@google.com>
parents:
32372
diff
changeset
|
94 data_non_inlined = ( |
37894
2f00c6e8f6a1
tests: port test-parseindex2.py to Python 3
Augie Fackler <augie@google.com>
parents:
37893
diff
changeset
|
95 b'\x00\x00\x00\x01\x00\x00\x00\x00\x00\x01D\x19' |
2f00c6e8f6a1
tests: port test-parseindex2.py to Python 3
Augie Fackler <augie@google.com>
parents:
37893
diff
changeset
|
96 b'\x00\x07e\x12\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\xff\xff' |
2f00c6e8f6a1
tests: port test-parseindex2.py to Python 3
Augie Fackler <augie@google.com>
parents:
37893
diff
changeset
|
97 b'\xff\xff\xff\xff\xd1\xf4\xbb\xb0\xbe\xfc\x13\xbd\x8c\xd3\x9d' |
2f00c6e8f6a1
tests: port test-parseindex2.py to Python 3
Augie Fackler <augie@google.com>
parents:
37893
diff
changeset
|
98 b'\x0f\xcd\xd9;\x8c\x07\x8cJ/\x00\x00\x00\x00\x00\x00\x00\x00\x00' |
2f00c6e8f6a1
tests: port test-parseindex2.py to Python 3
Augie Fackler <augie@google.com>
parents:
37893
diff
changeset
|
99 b'\x00\x00\x00\x00\x00\x00\x01D\x19\x00\x00\x00\x00\x00\xdf\x00' |
2f00c6e8f6a1
tests: port test-parseindex2.py to Python 3
Augie Fackler <augie@google.com>
parents:
37893
diff
changeset
|
100 b'\x00\x01q\x00\x00\x00\x01\x00\x00\x00\x01\x00\x00\x00\x00\xff' |
2f00c6e8f6a1
tests: port test-parseindex2.py to Python 3
Augie Fackler <augie@google.com>
parents:
37893
diff
changeset
|
101 b'\xff\xff\xff\xc1\x12\xb9\x04\x96\xa4Z1t\x91\xdfsJ\x90\xf0\x9bh' |
2f00c6e8f6a1
tests: port test-parseindex2.py to Python 3
Augie Fackler <augie@google.com>
parents:
37893
diff
changeset
|
102 b'\x07l&\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' |
2f00c6e8f6a1
tests: port test-parseindex2.py to Python 3
Augie Fackler <augie@google.com>
parents:
37893
diff
changeset
|
103 b'\x00\x01D\xf8\x00\x00\x00\x00\x01\x1b\x00\x00\x01\xb8\x00\x00' |
2f00c6e8f6a1
tests: port test-parseindex2.py to Python 3
Augie Fackler <augie@google.com>
parents:
37893
diff
changeset
|
104 b'\x00\x01\x00\x00\x00\x02\x00\x00\x00\x01\xff\xff\xff\xff\x02\n' |
2f00c6e8f6a1
tests: port test-parseindex2.py to Python 3
Augie Fackler <augie@google.com>
parents:
37893
diff
changeset
|
105 b'\x0e\xc6&\xa1\x92\xae6\x0b\x02i\xfe-\xe5\xbao\x05\xd1\xe7\x00' |
2f00c6e8f6a1
tests: port test-parseindex2.py to Python 3
Augie Fackler <augie@google.com>
parents:
37893
diff
changeset
|
106 b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01F' |
2f00c6e8f6a1
tests: port test-parseindex2.py to Python 3
Augie Fackler <augie@google.com>
parents:
37893
diff
changeset
|
107 b'\x13\x00\x00\x00\x00\x01\xec\x00\x00\x03\x06\x00\x00\x00\x01' |
2f00c6e8f6a1
tests: port test-parseindex2.py to Python 3
Augie Fackler <augie@google.com>
parents:
37893
diff
changeset
|
108 b'\x00\x00\x00\x03\x00\x00\x00\x02\xff\xff\xff\xff\x12\xcb\xeby1' |
2f00c6e8f6a1
tests: port test-parseindex2.py to Python 3
Augie Fackler <augie@google.com>
parents:
37893
diff
changeset
|
109 b'\xb6\r\x98B\xcb\x07\xbd`\x8f\x92\xd9\xc4\x84\xbdK\x00\x00\x00' |
2f00c6e8f6a1
tests: port test-parseindex2.py to Python 3
Augie Fackler <augie@google.com>
parents:
37893
diff
changeset
|
110 b'\x00\x00\x00\x00\x00\x00\x00\x00\x00' |
37893
b4e42a9bd12e
tests: prefer string concatenation with () instead of \ in parseindex2 tests
Augie Fackler <augie@google.com>
parents:
32372
diff
changeset
|
111 ) |
7110
75fdc39b6172
Add parseindex2.py test case
Bernhard Leiner <bleiner@gmail.com>
parents:
diff
changeset
|
112 |
16363
2cdd7e63211b
parsers: incrementally parse the revlog index in C
Bryan O'Sullivan <bryano@fb.com>
parents:
13254
diff
changeset
|
113 def parse_index2(data, inline): |
2cdd7e63211b
parsers: incrementally parse the revlog index in C
Bryan O'Sullivan <bryano@fb.com>
parents:
13254
diff
changeset
|
114 index, chunkcache = parsers.parse_index2(data, inline) |
2cdd7e63211b
parsers: incrementally parse the revlog index in C
Bryan O'Sullivan <bryano@fb.com>
parents:
13254
diff
changeset
|
115 return list(index), chunkcache |
7110
75fdc39b6172
Add parseindex2.py test case
Bernhard Leiner <bleiner@gmail.com>
parents:
diff
changeset
|
116 |
20742
3681de20b0a7
parsers: fail fast if Python has wrong minor version (issue4110)
Chris Jerdonek <chris.jerdonek@gmail.com>
parents:
20166
diff
changeset
|
117 def importparsers(hexversion): |
3681de20b0a7
parsers: fail fast if Python has wrong minor version (issue4110)
Chris Jerdonek <chris.jerdonek@gmail.com>
parents:
20166
diff
changeset
|
118 """Import mercurial.parsers with the given sys.hexversion.""" |
3681de20b0a7
parsers: fail fast if Python has wrong minor version (issue4110)
Chris Jerdonek <chris.jerdonek@gmail.com>
parents:
20166
diff
changeset
|
119 # The file parsers.c inspects sys.hexversion to determine the version |
3681de20b0a7
parsers: fail fast if Python has wrong minor version (issue4110)
Chris Jerdonek <chris.jerdonek@gmail.com>
parents:
20166
diff
changeset
|
120 # of the currently-running Python interpreter, so we monkey-patch |
3681de20b0a7
parsers: fail fast if Python has wrong minor version (issue4110)
Chris Jerdonek <chris.jerdonek@gmail.com>
parents:
20166
diff
changeset
|
121 # sys.hexversion to simulate using different versions. |
3681de20b0a7
parsers: fail fast if Python has wrong minor version (issue4110)
Chris Jerdonek <chris.jerdonek@gmail.com>
parents:
20166
diff
changeset
|
122 code = ("import sys; sys.hexversion=%s; " |
32372
df448de7cf3b
parsers: switch to policy importer
Yuya Nishihara <yuya@tcha.org>
parents:
29205
diff
changeset
|
123 "import mercurial.cext.parsers" % hexversion) |
20742
3681de20b0a7
parsers: fail fast if Python has wrong minor version (issue4110)
Chris Jerdonek <chris.jerdonek@gmail.com>
parents:
20166
diff
changeset
|
124 cmd = "python -c \"%s\"" % code |
3681de20b0a7
parsers: fail fast if Python has wrong minor version (issue4110)
Chris Jerdonek <chris.jerdonek@gmail.com>
parents:
20166
diff
changeset
|
125 # We need to do these tests inside a subprocess because parser.c's |
3681de20b0a7
parsers: fail fast if Python has wrong minor version (issue4110)
Chris Jerdonek <chris.jerdonek@gmail.com>
parents:
20166
diff
changeset
|
126 # version-checking code happens inside the module init function, and |
3681de20b0a7
parsers: fail fast if Python has wrong minor version (issue4110)
Chris Jerdonek <chris.jerdonek@gmail.com>
parents:
20166
diff
changeset
|
127 # when using reload() to reimport an extension module, "The init function |
3681de20b0a7
parsers: fail fast if Python has wrong minor version (issue4110)
Chris Jerdonek <chris.jerdonek@gmail.com>
parents:
20166
diff
changeset
|
128 # of extension modules is not called a second time" |
3681de20b0a7
parsers: fail fast if Python has wrong minor version (issue4110)
Chris Jerdonek <chris.jerdonek@gmail.com>
parents:
20166
diff
changeset
|
129 # (from http://docs.python.org/2/library/functions.html?#reload). |
3681de20b0a7
parsers: fail fast if Python has wrong minor version (issue4110)
Chris Jerdonek <chris.jerdonek@gmail.com>
parents:
20166
diff
changeset
|
130 p = subprocess.Popen(cmd, shell=True, |
3681de20b0a7
parsers: fail fast if Python has wrong minor version (issue4110)
Chris Jerdonek <chris.jerdonek@gmail.com>
parents:
20166
diff
changeset
|
131 stdout=subprocess.PIPE, stderr=subprocess.STDOUT) |
3681de20b0a7
parsers: fail fast if Python has wrong minor version (issue4110)
Chris Jerdonek <chris.jerdonek@gmail.com>
parents:
20166
diff
changeset
|
132 return p.communicate() # returns stdout, stderr |
3681de20b0a7
parsers: fail fast if Python has wrong minor version (issue4110)
Chris Jerdonek <chris.jerdonek@gmail.com>
parents:
20166
diff
changeset
|
133 |
39045
88b04bd2cbb4
tests: port remaining bits of test-parseindex2 to unittest asserts
Augie Fackler <augie@google.com>
parents:
38993
diff
changeset
|
134 def hexfailmsg(testnumber, hexversion, stdout, expected): |
20742
3681de20b0a7
parsers: fail fast if Python has wrong minor version (issue4110)
Chris Jerdonek <chris.jerdonek@gmail.com>
parents:
20166
diff
changeset
|
135 try: |
3681de20b0a7
parsers: fail fast if Python has wrong minor version (issue4110)
Chris Jerdonek <chris.jerdonek@gmail.com>
parents:
20166
diff
changeset
|
136 hexstring = hex(hexversion) |
3681de20b0a7
parsers: fail fast if Python has wrong minor version (issue4110)
Chris Jerdonek <chris.jerdonek@gmail.com>
parents:
20166
diff
changeset
|
137 except TypeError: |
3681de20b0a7
parsers: fail fast if Python has wrong minor version (issue4110)
Chris Jerdonek <chris.jerdonek@gmail.com>
parents:
20166
diff
changeset
|
138 hexstring = None |
39045
88b04bd2cbb4
tests: port remaining bits of test-parseindex2 to unittest asserts
Augie Fackler <augie@google.com>
parents:
38993
diff
changeset
|
139 return ("FAILED: version test #%s with Python %s and patched " |
88b04bd2cbb4
tests: port remaining bits of test-parseindex2 to unittest asserts
Augie Fackler <augie@google.com>
parents:
38993
diff
changeset
|
140 "sys.hexversion %r (%r):\n Expected %s but got:\n-->'%s'\n" % |
88b04bd2cbb4
tests: port remaining bits of test-parseindex2 to unittest asserts
Augie Fackler <augie@google.com>
parents:
38993
diff
changeset
|
141 (testnumber, sys.version_info, hexversion, hexstring, expected, |
88b04bd2cbb4
tests: port remaining bits of test-parseindex2 to unittest asserts
Augie Fackler <augie@google.com>
parents:
38993
diff
changeset
|
142 stdout)) |
20742
3681de20b0a7
parsers: fail fast if Python has wrong minor version (issue4110)
Chris Jerdonek <chris.jerdonek@gmail.com>
parents:
20166
diff
changeset
|
143 |
3681de20b0a7
parsers: fail fast if Python has wrong minor version (issue4110)
Chris Jerdonek <chris.jerdonek@gmail.com>
parents:
20166
diff
changeset
|
144 def makehex(major, minor, micro): |
3681de20b0a7
parsers: fail fast if Python has wrong minor version (issue4110)
Chris Jerdonek <chris.jerdonek@gmail.com>
parents:
20166
diff
changeset
|
145 return int("%x%02x%02x00" % (major, minor, micro), 16) |
3681de20b0a7
parsers: fail fast if Python has wrong minor version (issue4110)
Chris Jerdonek <chris.jerdonek@gmail.com>
parents:
20166
diff
changeset
|
146 |
38989
01966d45b45e
tests: start moving test-parseindex2.py to a unittest
Augie Fackler <augie@google.com>
parents:
38852
diff
changeset
|
147 class parseindex2tests(unittest.TestCase): |
39045
88b04bd2cbb4
tests: port remaining bits of test-parseindex2 to unittest asserts
Augie Fackler <augie@google.com>
parents:
38993
diff
changeset
|
148 |
88b04bd2cbb4
tests: port remaining bits of test-parseindex2 to unittest asserts
Augie Fackler <augie@google.com>
parents:
38993
diff
changeset
|
149 def assertversionokay(self, testnumber, hexversion): |
88b04bd2cbb4
tests: port remaining bits of test-parseindex2 to unittest asserts
Augie Fackler <augie@google.com>
parents:
38993
diff
changeset
|
150 stdout, stderr = importparsers(hexversion) |
88b04bd2cbb4
tests: port remaining bits of test-parseindex2 to unittest asserts
Augie Fackler <augie@google.com>
parents:
38993
diff
changeset
|
151 self.assertFalse( |
88b04bd2cbb4
tests: port remaining bits of test-parseindex2 to unittest asserts
Augie Fackler <augie@google.com>
parents:
38993
diff
changeset
|
152 stdout, hexfailmsg(testnumber, hexversion, stdout, 'no stdout')) |
88b04bd2cbb4
tests: port remaining bits of test-parseindex2 to unittest asserts
Augie Fackler <augie@google.com>
parents:
38993
diff
changeset
|
153 |
88b04bd2cbb4
tests: port remaining bits of test-parseindex2 to unittest asserts
Augie Fackler <augie@google.com>
parents:
38993
diff
changeset
|
154 def assertversionfail(self, testnumber, hexversion): |
88b04bd2cbb4
tests: port remaining bits of test-parseindex2 to unittest asserts
Augie Fackler <augie@google.com>
parents:
38993
diff
changeset
|
155 stdout, stderr = importparsers(hexversion) |
88b04bd2cbb4
tests: port remaining bits of test-parseindex2 to unittest asserts
Augie Fackler <augie@google.com>
parents:
38993
diff
changeset
|
156 # We include versionerrortext to distinguish from other ImportErrors. |
88b04bd2cbb4
tests: port remaining bits of test-parseindex2 to unittest asserts
Augie Fackler <augie@google.com>
parents:
38993
diff
changeset
|
157 errtext = b"ImportError: %s" % pycompat.sysbytes( |
88b04bd2cbb4
tests: port remaining bits of test-parseindex2 to unittest asserts
Augie Fackler <augie@google.com>
parents:
38993
diff
changeset
|
158 parsers.versionerrortext) |
88b04bd2cbb4
tests: port remaining bits of test-parseindex2 to unittest asserts
Augie Fackler <augie@google.com>
parents:
38993
diff
changeset
|
159 self.assertIn(errtext, stdout, |
88b04bd2cbb4
tests: port remaining bits of test-parseindex2 to unittest asserts
Augie Fackler <augie@google.com>
parents:
38993
diff
changeset
|
160 hexfailmsg(testnumber, hexversion, stdout, |
88b04bd2cbb4
tests: port remaining bits of test-parseindex2 to unittest asserts
Augie Fackler <augie@google.com>
parents:
38993
diff
changeset
|
161 expected="stdout to contain %r" % errtext)) |
88b04bd2cbb4
tests: port remaining bits of test-parseindex2 to unittest asserts
Augie Fackler <augie@google.com>
parents:
38993
diff
changeset
|
162 |
38990
087a755310c3
tests: fix up indent width in test-parseindex2.py
Augie Fackler <augie@google.com>
parents:
38989
diff
changeset
|
163 def testversiondetection(self): |
087a755310c3
tests: fix up indent width in test-parseindex2.py
Augie Fackler <augie@google.com>
parents:
38989
diff
changeset
|
164 """Check the version-detection logic when importing parsers.""" |
087a755310c3
tests: fix up indent width in test-parseindex2.py
Augie Fackler <augie@google.com>
parents:
38989
diff
changeset
|
165 # Only test the version-detection logic if it is present. |
087a755310c3
tests: fix up indent width in test-parseindex2.py
Augie Fackler <augie@google.com>
parents:
38989
diff
changeset
|
166 try: |
087a755310c3
tests: fix up indent width in test-parseindex2.py
Augie Fackler <augie@google.com>
parents:
38989
diff
changeset
|
167 parsers.versionerrortext |
087a755310c3
tests: fix up indent width in test-parseindex2.py
Augie Fackler <augie@google.com>
parents:
38989
diff
changeset
|
168 except AttributeError: |
087a755310c3
tests: fix up indent width in test-parseindex2.py
Augie Fackler <augie@google.com>
parents:
38989
diff
changeset
|
169 return |
087a755310c3
tests: fix up indent width in test-parseindex2.py
Augie Fackler <augie@google.com>
parents:
38989
diff
changeset
|
170 info = sys.version_info |
087a755310c3
tests: fix up indent width in test-parseindex2.py
Augie Fackler <augie@google.com>
parents:
38989
diff
changeset
|
171 major, minor, micro = info[0], info[1], info[2] |
087a755310c3
tests: fix up indent width in test-parseindex2.py
Augie Fackler <augie@google.com>
parents:
38989
diff
changeset
|
172 # Test same major-minor versions. |
39045
88b04bd2cbb4
tests: port remaining bits of test-parseindex2 to unittest asserts
Augie Fackler <augie@google.com>
parents:
38993
diff
changeset
|
173 self.assertversionokay(1, makehex(major, minor, micro)) |
88b04bd2cbb4
tests: port remaining bits of test-parseindex2 to unittest asserts
Augie Fackler <augie@google.com>
parents:
38993
diff
changeset
|
174 self.assertversionokay(2, makehex(major, minor, micro + 1)) |
38990
087a755310c3
tests: fix up indent width in test-parseindex2.py
Augie Fackler <augie@google.com>
parents:
38989
diff
changeset
|
175 # Test different major-minor versions. |
39045
88b04bd2cbb4
tests: port remaining bits of test-parseindex2 to unittest asserts
Augie Fackler <augie@google.com>
parents:
38993
diff
changeset
|
176 self.assertversionfail(3, makehex(major + 1, minor, micro)) |
88b04bd2cbb4
tests: port remaining bits of test-parseindex2 to unittest asserts
Augie Fackler <augie@google.com>
parents:
38993
diff
changeset
|
177 self.assertversionfail(4, makehex(major, minor + 1, micro)) |
88b04bd2cbb4
tests: port remaining bits of test-parseindex2 to unittest asserts
Augie Fackler <augie@google.com>
parents:
38993
diff
changeset
|
178 self.assertversionfail(5, "'foo'") |
20742
3681de20b0a7
parsers: fail fast if Python has wrong minor version (issue4110)
Chris Jerdonek <chris.jerdonek@gmail.com>
parents:
20166
diff
changeset
|
179 |
38990
087a755310c3
tests: fix up indent width in test-parseindex2.py
Augie Fackler <augie@google.com>
parents:
38989
diff
changeset
|
180 def testbadargs(self): |
087a755310c3
tests: fix up indent width in test-parseindex2.py
Augie Fackler <augie@google.com>
parents:
38989
diff
changeset
|
181 # Check that parse_index2() raises TypeError on bad arguments. |
38991
22216c4607bb
tests: move chunks of test-parseindex2.py to use unittest properly
Augie Fackler <augie@google.com>
parents:
38990
diff
changeset
|
182 with self.assertRaises(TypeError): |
38990
087a755310c3
tests: fix up indent width in test-parseindex2.py
Augie Fackler <augie@google.com>
parents:
38989
diff
changeset
|
183 parse_index2(0, True) |
20109
e57c532c3835
parse_index2: fix crash on bad argument type (issue4110)
Chris Jerdonek <chris.jerdonek@gmail.com>
parents:
16620
diff
changeset
|
184 |
38990
087a755310c3
tests: fix up indent width in test-parseindex2.py
Augie Fackler <augie@google.com>
parents:
38989
diff
changeset
|
185 def testparseindexfile(self): |
087a755310c3
tests: fix up indent width in test-parseindex2.py
Augie Fackler <augie@google.com>
parents:
38989
diff
changeset
|
186 # Check parsers.parse_index2() on an index file against the |
087a755310c3
tests: fix up indent width in test-parseindex2.py
Augie Fackler <augie@google.com>
parents:
38989
diff
changeset
|
187 # original Python implementation of parseindex, both with and |
087a755310c3
tests: fix up indent width in test-parseindex2.py
Augie Fackler <augie@google.com>
parents:
38989
diff
changeset
|
188 # without inlined data. |
20166
7eda5bb9ec8f
parsers: clarify documentation of test-parseindex2.py
Chris Jerdonek <chris.jerdonek@gmail.com>
parents:
20159
diff
changeset
|
189 |
38993
ee0720e82257
tests: rename variables in revlog index parse test for clarity
Augie Fackler <augie@google.com>
parents:
38992
diff
changeset
|
190 want = py_parseindex(data_inlined, True) |
ee0720e82257
tests: rename variables in revlog index parse test for clarity
Augie Fackler <augie@google.com>
parents:
38992
diff
changeset
|
191 got = parse_index2(data_inlined, True) |
ee0720e82257
tests: rename variables in revlog index parse test for clarity
Augie Fackler <augie@google.com>
parents:
38992
diff
changeset
|
192 self.assertEqual(want, got) # inline data |
7110
75fdc39b6172
Add parseindex2.py test case
Bernhard Leiner <bleiner@gmail.com>
parents:
diff
changeset
|
193 |
38993
ee0720e82257
tests: rename variables in revlog index parse test for clarity
Augie Fackler <augie@google.com>
parents:
38992
diff
changeset
|
194 want = py_parseindex(data_non_inlined, False) |
ee0720e82257
tests: rename variables in revlog index parse test for clarity
Augie Fackler <augie@google.com>
parents:
38992
diff
changeset
|
195 got = parse_index2(data_non_inlined, False) |
ee0720e82257
tests: rename variables in revlog index parse test for clarity
Augie Fackler <augie@google.com>
parents:
38992
diff
changeset
|
196 self.assertEqual(want, got) # no inline data |
7110
75fdc39b6172
Add parseindex2.py test case
Bernhard Leiner <bleiner@gmail.com>
parents:
diff
changeset
|
197 |
38990
087a755310c3
tests: fix up indent width in test-parseindex2.py
Augie Fackler <augie@google.com>
parents:
38989
diff
changeset
|
198 ix = parsers.parse_index2(data_inlined, True)[0] |
087a755310c3
tests: fix up indent width in test-parseindex2.py
Augie Fackler <augie@google.com>
parents:
38989
diff
changeset
|
199 for i, r in enumerate(ix): |
087a755310c3
tests: fix up indent width in test-parseindex2.py
Augie Fackler <augie@google.com>
parents:
38989
diff
changeset
|
200 if r[7] == nullid: |
087a755310c3
tests: fix up indent width in test-parseindex2.py
Augie Fackler <augie@google.com>
parents:
38989
diff
changeset
|
201 i = -1 |
087a755310c3
tests: fix up indent width in test-parseindex2.py
Augie Fackler <augie@google.com>
parents:
38989
diff
changeset
|
202 try: |
38991
22216c4607bb
tests: move chunks of test-parseindex2.py to use unittest properly
Augie Fackler <augie@google.com>
parents:
38990
diff
changeset
|
203 self.assertEqual( |
22216c4607bb
tests: move chunks of test-parseindex2.py to use unittest properly
Augie Fackler <augie@google.com>
parents:
38990
diff
changeset
|
204 ix[r[7]], i, |
39046
a450d460774e
tests: restore Python 3 compat in test-parseindex2.py
Augie Fackler <augie@google.com>
parents:
39045
diff
changeset
|
205 'Reverse lookup inconsistent for %r' % nodemod.hex(r[7])) |
38990
087a755310c3
tests: fix up indent width in test-parseindex2.py
Augie Fackler <augie@google.com>
parents:
38989
diff
changeset
|
206 except TypeError: |
087a755310c3
tests: fix up indent width in test-parseindex2.py
Augie Fackler <augie@google.com>
parents:
38989
diff
changeset
|
207 # pure version doesn't support this |
087a755310c3
tests: fix up indent width in test-parseindex2.py
Augie Fackler <augie@google.com>
parents:
38989
diff
changeset
|
208 break |
16414
e8d37b78acfb
parsers: use base-16 trie for faster node->rev mapping
Bryan O'Sullivan <bryano@fb.com>
parents:
16363
diff
changeset
|
209 |
39067
daedb70fd467
tests: add test coverage for revlogindex[-1] which was previously missing
Augie Fackler <augie@google.com>
parents:
39048
diff
changeset
|
210 def testminusone(self): |
daedb70fd467
tests: add test coverage for revlogindex[-1] which was previously missing
Augie Fackler <augie@google.com>
parents:
39048
diff
changeset
|
211 want = (0, 0, 0, -1, -1, -1, -1, nullid) |
daedb70fd467
tests: add test coverage for revlogindex[-1] which was previously missing
Augie Fackler <augie@google.com>
parents:
39048
diff
changeset
|
212 index, junk = parsers.parse_index2(data_inlined, True) |
daedb70fd467
tests: add test coverage for revlogindex[-1] which was previously missing
Augie Fackler <augie@google.com>
parents:
39048
diff
changeset
|
213 got = index[-1] |
daedb70fd467
tests: add test coverage for revlogindex[-1] which was previously missing
Augie Fackler <augie@google.com>
parents:
39048
diff
changeset
|
214 self.assertEqual(want, got) # inline data |
daedb70fd467
tests: add test coverage for revlogindex[-1] which was previously missing
Augie Fackler <augie@google.com>
parents:
39048
diff
changeset
|
215 |
daedb70fd467
tests: add test coverage for revlogindex[-1] which was previously missing
Augie Fackler <augie@google.com>
parents:
39048
diff
changeset
|
216 index, junk = parsers.parse_index2(data_non_inlined, False) |
daedb70fd467
tests: add test coverage for revlogindex[-1] which was previously missing
Augie Fackler <augie@google.com>
parents:
39048
diff
changeset
|
217 got = index[-1] |
daedb70fd467
tests: add test coverage for revlogindex[-1] which was previously missing
Augie Fackler <augie@google.com>
parents:
39048
diff
changeset
|
218 self.assertEqual(want, got) # no inline data |
daedb70fd467
tests: add test coverage for revlogindex[-1] which was previously missing
Augie Fackler <augie@google.com>
parents:
39048
diff
changeset
|
219 |
38989
01966d45b45e
tests: start moving test-parseindex2.py to a unittest
Augie Fackler <augie@google.com>
parents:
38852
diff
changeset
|
220 if __name__ == '__main__': |
01966d45b45e
tests: start moving test-parseindex2.py to a unittest
Augie Fackler <augie@google.com>
parents:
38852
diff
changeset
|
221 import silenttestrunner |
01966d45b45e
tests: start moving test-parseindex2.py to a unittest
Augie Fackler <augie@google.com>
parents:
38852
diff
changeset
|
222 silenttestrunner.main(__name__) |