annotate tests/test-parseindex2.py @ 20306:fe8e254c7ad6 stable

merge default into stable for 2.9 code freeze
author Matt Mackall <mpm@selenic.com>
date Tue, 21 Jan 2014 14:30:06 -0600
parents 7eda5bb9ec8f
children 3681de20b0a7
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
20166
7eda5bb9ec8f parsers: clarify documentation of test-parseindex2.py
Chris Jerdonek <chris.jerdonek@gmail.com>
parents: 20159
diff changeset
1 """This unit test tests parsers.parse_index2()."""
7eda5bb9ec8f parsers: clarify documentation of test-parseindex2.py
Chris Jerdonek <chris.jerdonek@gmail.com>
parents: 20159
diff changeset
2
7110
75fdc39b6172 Add parseindex2.py test case
Bernhard Leiner <bleiner@gmail.com>
parents:
diff changeset
3 from mercurial import parsers
75fdc39b6172 Add parseindex2.py test case
Bernhard Leiner <bleiner@gmail.com>
parents:
diff changeset
4 from mercurial.node import nullid, nullrev
75fdc39b6172 Add parseindex2.py test case
Bernhard Leiner <bleiner@gmail.com>
parents:
diff changeset
5 import struct
75fdc39b6172 Add parseindex2.py test case
Bernhard Leiner <bleiner@gmail.com>
parents:
diff changeset
6
75fdc39b6172 Add parseindex2.py test case
Bernhard Leiner <bleiner@gmail.com>
parents:
diff changeset
7 # original python implementation
75fdc39b6172 Add parseindex2.py test case
Bernhard Leiner <bleiner@gmail.com>
parents:
diff changeset
8 def gettype(q):
75fdc39b6172 Add parseindex2.py test case
Bernhard Leiner <bleiner@gmail.com>
parents:
diff changeset
9 return int(q & 0xFFFF)
75fdc39b6172 Add parseindex2.py test case
Bernhard Leiner <bleiner@gmail.com>
parents:
diff changeset
10
75fdc39b6172 Add parseindex2.py test case
Bernhard Leiner <bleiner@gmail.com>
parents:
diff changeset
11 def offset_type(offset, type):
75fdc39b6172 Add parseindex2.py test case
Bernhard Leiner <bleiner@gmail.com>
parents:
diff changeset
12 return long(long(offset) << 16 | type)
75fdc39b6172 Add parseindex2.py test case
Bernhard Leiner <bleiner@gmail.com>
parents:
diff changeset
13
75fdc39b6172 Add parseindex2.py test case
Bernhard Leiner <bleiner@gmail.com>
parents:
diff changeset
14 indexformatng = ">Qiiiiii20s12x"
75fdc39b6172 Add parseindex2.py test case
Bernhard Leiner <bleiner@gmail.com>
parents:
diff changeset
15
75fdc39b6172 Add parseindex2.py test case
Bernhard Leiner <bleiner@gmail.com>
parents:
diff changeset
16 def py_parseindex(data, inline) :
75fdc39b6172 Add parseindex2.py test case
Bernhard Leiner <bleiner@gmail.com>
parents:
diff changeset
17 s = 64
75fdc39b6172 Add parseindex2.py test case
Bernhard Leiner <bleiner@gmail.com>
parents:
diff changeset
18 cache = None
75fdc39b6172 Add parseindex2.py test case
Bernhard Leiner <bleiner@gmail.com>
parents:
diff changeset
19 index = []
75fdc39b6172 Add parseindex2.py test case
Bernhard Leiner <bleiner@gmail.com>
parents:
diff changeset
20 nodemap = {nullid: nullrev}
75fdc39b6172 Add parseindex2.py test case
Bernhard Leiner <bleiner@gmail.com>
parents:
diff changeset
21 n = off = 0
13253
61c9bc3da402 revlog: remove lazy index
Matt Mackall <mpm@selenic.com>
parents: 8117
diff changeset
22
7110
75fdc39b6172 Add parseindex2.py test case
Bernhard Leiner <bleiner@gmail.com>
parents:
diff changeset
23 l = len(data) - s
75fdc39b6172 Add parseindex2.py test case
Bernhard Leiner <bleiner@gmail.com>
parents:
diff changeset
24 append = index.append
75fdc39b6172 Add parseindex2.py test case
Bernhard Leiner <bleiner@gmail.com>
parents:
diff changeset
25 if inline:
75fdc39b6172 Add parseindex2.py test case
Bernhard Leiner <bleiner@gmail.com>
parents:
diff changeset
26 cache = (0, data)
75fdc39b6172 Add parseindex2.py test case
Bernhard Leiner <bleiner@gmail.com>
parents:
diff changeset
27 while off <= l:
75fdc39b6172 Add parseindex2.py test case
Bernhard Leiner <bleiner@gmail.com>
parents:
diff changeset
28 e = struct.unpack(indexformatng, data[off:off + s])
75fdc39b6172 Add parseindex2.py test case
Bernhard Leiner <bleiner@gmail.com>
parents:
diff changeset
29 nodemap[e[7]] = n
75fdc39b6172 Add parseindex2.py test case
Bernhard Leiner <bleiner@gmail.com>
parents:
diff changeset
30 append(e)
75fdc39b6172 Add parseindex2.py test case
Bernhard Leiner <bleiner@gmail.com>
parents:
diff changeset
31 n += 1
75fdc39b6172 Add parseindex2.py test case
Bernhard Leiner <bleiner@gmail.com>
parents:
diff changeset
32 if e[1] < 0:
75fdc39b6172 Add parseindex2.py test case
Bernhard Leiner <bleiner@gmail.com>
parents:
diff changeset
33 break
75fdc39b6172 Add parseindex2.py test case
Bernhard Leiner <bleiner@gmail.com>
parents:
diff changeset
34 off += e[1] + s
75fdc39b6172 Add parseindex2.py test case
Bernhard Leiner <bleiner@gmail.com>
parents:
diff changeset
35 else:
75fdc39b6172 Add parseindex2.py test case
Bernhard Leiner <bleiner@gmail.com>
parents:
diff changeset
36 while off <= l:
75fdc39b6172 Add parseindex2.py test case
Bernhard Leiner <bleiner@gmail.com>
parents:
diff changeset
37 e = struct.unpack(indexformatng, data[off:off + s])
75fdc39b6172 Add parseindex2.py test case
Bernhard Leiner <bleiner@gmail.com>
parents:
diff changeset
38 nodemap[e[7]] = n
75fdc39b6172 Add parseindex2.py test case
Bernhard Leiner <bleiner@gmail.com>
parents:
diff changeset
39 append(e)
75fdc39b6172 Add parseindex2.py test case
Bernhard Leiner <bleiner@gmail.com>
parents:
diff changeset
40 n += 1
75fdc39b6172 Add parseindex2.py test case
Bernhard Leiner <bleiner@gmail.com>
parents:
diff changeset
41 off += s
75fdc39b6172 Add parseindex2.py test case
Bernhard Leiner <bleiner@gmail.com>
parents:
diff changeset
42
75fdc39b6172 Add parseindex2.py test case
Bernhard Leiner <bleiner@gmail.com>
parents:
diff changeset
43 e = list(index[0])
75fdc39b6172 Add parseindex2.py test case
Bernhard Leiner <bleiner@gmail.com>
parents:
diff changeset
44 type = gettype(e[0])
75fdc39b6172 Add parseindex2.py test case
Bernhard Leiner <bleiner@gmail.com>
parents:
diff changeset
45 e[0] = offset_type(0, type)
75fdc39b6172 Add parseindex2.py test case
Bernhard Leiner <bleiner@gmail.com>
parents:
diff changeset
46 index[0] = tuple(e)
75fdc39b6172 Add parseindex2.py test case
Bernhard Leiner <bleiner@gmail.com>
parents:
diff changeset
47
75fdc39b6172 Add parseindex2.py test case
Bernhard Leiner <bleiner@gmail.com>
parents:
diff changeset
48 # add the magic null revision at -1
75fdc39b6172 Add parseindex2.py test case
Bernhard Leiner <bleiner@gmail.com>
parents:
diff changeset
49 index.append((0, 0, 0, -1, -1, -1, -1, nullid))
75fdc39b6172 Add parseindex2.py test case
Bernhard Leiner <bleiner@gmail.com>
parents:
diff changeset
50
13254
5ef5eb1f3515 revlog: only build the nodemap on demand
Matt Mackall <mpm@selenic.com>
parents: 13253
diff changeset
51 return index, cache
7110
75fdc39b6172 Add parseindex2.py test case
Bernhard Leiner <bleiner@gmail.com>
parents:
diff changeset
52
75fdc39b6172 Add parseindex2.py test case
Bernhard Leiner <bleiner@gmail.com>
parents:
diff changeset
53 data_inlined = '\x00\x01\x00\x01\x00\x00\x00\x00\x00\x00\x01\x8c' \
75fdc39b6172 Add parseindex2.py test case
Bernhard Leiner <bleiner@gmail.com>
parents:
diff changeset
54 '\x00\x00\x04\x07\x00\x00\x00\x00\x00\x00\x15\x15\xff\xff\xff' \
75fdc39b6172 Add parseindex2.py test case
Bernhard Leiner <bleiner@gmail.com>
parents:
diff changeset
55 '\xff\xff\xff\xff\xff\xebG\x97\xb7\x1fB\x04\xcf\x13V\x81\tw\x1b' \
75fdc39b6172 Add parseindex2.py test case
Bernhard Leiner <bleiner@gmail.com>
parents:
diff changeset
56 'w\xdduR\xda\xc6\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' \
75fdc39b6172 Add parseindex2.py test case
Bernhard Leiner <bleiner@gmail.com>
parents:
diff changeset
57 'x\x9c\x9d\x93?O\xc30\x10\xc5\xf7|\x8a\xdb\x9a\xa8m\x06\xd8*\x95' \
75fdc39b6172 Add parseindex2.py test case
Bernhard Leiner <bleiner@gmail.com>
parents:
diff changeset
58 '\x81B\xa1\xa2\xa2R\xcb\x86Pd\x9a\x0b5$vd_\x04\xfd\xf6\x9c\xff@' \
75fdc39b6172 Add parseindex2.py test case
Bernhard Leiner <bleiner@gmail.com>
parents:
diff changeset
59 '\x11!\x0b\xd9\xec\xf7\xbbw\xe7gG6\xad6\x04\xdaN\xc0\x92\xa0$)' \
75fdc39b6172 Add parseindex2.py test case
Bernhard Leiner <bleiner@gmail.com>
parents:
diff changeset
60 '\xb1\x82\xa2\xd1%\x16\xa4\x8b7\xa9\xca\xd4-\xb2Y\x02\xfc\xc9' \
75fdc39b6172 Add parseindex2.py test case
Bernhard Leiner <bleiner@gmail.com>
parents:
diff changeset
61 '\xcaS\xf9\xaeX\xed\xb6\xd77Q\x02\x83\xd4\x19\xf5--Y\xea\xe1W' \
75fdc39b6172 Add parseindex2.py test case
Bernhard Leiner <bleiner@gmail.com>
parents:
diff changeset
62 '\xab\xed\x10\xceR\x0f_\xdf\xdf\r\xe1,\xf5\xf0\xcb\xf5 \xceR\x0f' \
75fdc39b6172 Add parseindex2.py test case
Bernhard Leiner <bleiner@gmail.com>
parents:
diff changeset
63 '_\xdc\x0e\x0e\xc3R\x0f_\xae\x96\x9b!\x9e\xa5\x1e\xbf\xdb,\x06' \
75fdc39b6172 Add parseindex2.py test case
Bernhard Leiner <bleiner@gmail.com>
parents:
diff changeset
64 '\xc7q\x9a/\x88\x82\xc3B\xea\xb5\xb4TJ\x93\xb6\x82\x0e\xe16\xe6' \
75fdc39b6172 Add parseindex2.py test case
Bernhard Leiner <bleiner@gmail.com>
parents:
diff changeset
65 'KQ\xdb\xaf\xecG\xa3\xd1 \x01\xd3\x0b_^\xe8\xaa\xa0\xae\xad\xd1' \
75fdc39b6172 Add parseindex2.py test case
Bernhard Leiner <bleiner@gmail.com>
parents:
diff changeset
66 '&\xbef\x1bz\x08\xb0|\xc9Xz\x06\xf6Z\x91\x90J\xaa\x17\x90\xaa' \
75fdc39b6172 Add parseindex2.py test case
Bernhard Leiner <bleiner@gmail.com>
parents:
diff changeset
67 '\xd2\xa6\x11$5C\xcf\xba#\xa0\x03\x02*2\x92-\xfc\xb1\x94\xdf\xe2' \
75fdc39b6172 Add parseindex2.py test case
Bernhard Leiner <bleiner@gmail.com>
parents:
diff changeset
68 '\xae\xb8\'m\x8ey0^\x85\xd3\x82\xb4\xf0`:\x9c\x00\x8a\xfd\x01' \
75fdc39b6172 Add parseindex2.py test case
Bernhard Leiner <bleiner@gmail.com>
parents:
diff changeset
69 '\xb0\xc6\x86\x8b\xdd\xae\x80\xf3\xa9\x9fd\x16\n\x00R%\x1a\x06' \
75fdc39b6172 Add parseindex2.py test case
Bernhard Leiner <bleiner@gmail.com>
parents:
diff changeset
70 '\xe9\xd8b\x98\x1d\xf4\xf3+\x9bf\x01\xd8p\x1b\xf3.\xed\x9f^g\xc3' \
75fdc39b6172 Add parseindex2.py test case
Bernhard Leiner <bleiner@gmail.com>
parents:
diff changeset
71 '^\xd9W81T\xdb\xd5\x04sx|\xf2\xeb\xd6`%?x\xed"\x831\xbf\xf3\xdc' \
75fdc39b6172 Add parseindex2.py test case
Bernhard Leiner <bleiner@gmail.com>
parents:
diff changeset
72 'b\xeb%gaY\xe1\xad\x9f\xb9f\'1w\xa9\xa5a\x83s\x82J\xb98\xbc4\x8b' \
75fdc39b6172 Add parseindex2.py test case
Bernhard Leiner <bleiner@gmail.com>
parents:
diff changeset
73 '\x83\x00\x9f$z\xb8#\xa5\xb1\xdf\x98\xd9\xec\x1b\x89O\xe3Ts\x9a4' \
75fdc39b6172 Add parseindex2.py test case
Bernhard Leiner <bleiner@gmail.com>
parents:
diff changeset
74 '\x17m\x8b\xfc\x8f\xa5\x95\x9a\xfc\xfa\xed,\xe5|\xa1\xfe\x15\xb9' \
75fdc39b6172 Add parseindex2.py test case
Bernhard Leiner <bleiner@gmail.com>
parents:
diff changeset
75 '\xbc\xb2\x93\x1f\xf2\x95\xff\xdf,\x1a\xc5\xe7\x17*\x93Oz:>\x0e'
75fdc39b6172 Add parseindex2.py test case
Bernhard Leiner <bleiner@gmail.com>
parents:
diff changeset
76
75fdc39b6172 Add parseindex2.py test case
Bernhard Leiner <bleiner@gmail.com>
parents:
diff changeset
77 data_non_inlined = '\x00\x00\x00\x01\x00\x00\x00\x00\x00\x01D\x19' \
75fdc39b6172 Add parseindex2.py test case
Bernhard Leiner <bleiner@gmail.com>
parents:
diff changeset
78 '\x00\x07e\x12\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\xff\xff' \
75fdc39b6172 Add parseindex2.py test case
Bernhard Leiner <bleiner@gmail.com>
parents:
diff changeset
79 '\xff\xff\xff\xff\xd1\xf4\xbb\xb0\xbe\xfc\x13\xbd\x8c\xd3\x9d' \
75fdc39b6172 Add parseindex2.py test case
Bernhard Leiner <bleiner@gmail.com>
parents:
diff changeset
80 '\x0f\xcd\xd9;\x8c\x07\x8cJ/\x00\x00\x00\x00\x00\x00\x00\x00\x00' \
75fdc39b6172 Add parseindex2.py test case
Bernhard Leiner <bleiner@gmail.com>
parents:
diff changeset
81 '\x00\x00\x00\x00\x00\x00\x01D\x19\x00\x00\x00\x00\x00\xdf\x00' \
75fdc39b6172 Add parseindex2.py test case
Bernhard Leiner <bleiner@gmail.com>
parents:
diff changeset
82 '\x00\x01q\x00\x00\x00\x01\x00\x00\x00\x01\x00\x00\x00\x00\xff' \
75fdc39b6172 Add parseindex2.py test case
Bernhard Leiner <bleiner@gmail.com>
parents:
diff changeset
83 '\xff\xff\xff\xc1\x12\xb9\x04\x96\xa4Z1t\x91\xdfsJ\x90\xf0\x9bh' \
75fdc39b6172 Add parseindex2.py test case
Bernhard Leiner <bleiner@gmail.com>
parents:
diff changeset
84 '\x07l&\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' \
75fdc39b6172 Add parseindex2.py test case
Bernhard Leiner <bleiner@gmail.com>
parents:
diff changeset
85 '\x00\x01D\xf8\x00\x00\x00\x00\x01\x1b\x00\x00\x01\xb8\x00\x00' \
75fdc39b6172 Add parseindex2.py test case
Bernhard Leiner <bleiner@gmail.com>
parents:
diff changeset
86 '\x00\x01\x00\x00\x00\x02\x00\x00\x00\x01\xff\xff\xff\xff\x02\n' \
75fdc39b6172 Add parseindex2.py test case
Bernhard Leiner <bleiner@gmail.com>
parents:
diff changeset
87 '\x0e\xc6&\xa1\x92\xae6\x0b\x02i\xfe-\xe5\xbao\x05\xd1\xe7\x00' \
75fdc39b6172 Add parseindex2.py test case
Bernhard Leiner <bleiner@gmail.com>
parents:
diff changeset
88 '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01F' \
75fdc39b6172 Add parseindex2.py test case
Bernhard Leiner <bleiner@gmail.com>
parents:
diff changeset
89 '\x13\x00\x00\x00\x00\x01\xec\x00\x00\x03\x06\x00\x00\x00\x01' \
75fdc39b6172 Add parseindex2.py test case
Bernhard Leiner <bleiner@gmail.com>
parents:
diff changeset
90 '\x00\x00\x00\x03\x00\x00\x00\x02\xff\xff\xff\xff\x12\xcb\xeby1' \
75fdc39b6172 Add parseindex2.py test case
Bernhard Leiner <bleiner@gmail.com>
parents:
diff changeset
91 '\xb6\r\x98B\xcb\x07\xbd`\x8f\x92\xd9\xc4\x84\xbdK\x00\x00\x00' \
75fdc39b6172 Add parseindex2.py test case
Bernhard Leiner <bleiner@gmail.com>
parents:
diff changeset
92 '\x00\x00\x00\x00\x00\x00\x00\x00\x00'
75fdc39b6172 Add parseindex2.py test case
Bernhard Leiner <bleiner@gmail.com>
parents:
diff changeset
93
16363
2cdd7e63211b parsers: incrementally parse the revlog index in C
Bryan O'Sullivan <bryano@fb.com>
parents: 13254
diff changeset
94 def parse_index2(data, inline):
2cdd7e63211b parsers: incrementally parse the revlog index in C
Bryan O'Sullivan <bryano@fb.com>
parents: 13254
diff changeset
95 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
96 return list(index), chunkcache
7110
75fdc39b6172 Add parseindex2.py test case
Bernhard Leiner <bleiner@gmail.com>
parents:
diff changeset
97
16363
2cdd7e63211b parsers: incrementally parse the revlog index in C
Bryan O'Sullivan <bryano@fb.com>
parents: 13254
diff changeset
98 def runtest() :
20109
e57c532c3835 parse_index2: fix crash on bad argument type (issue4110)
Chris Jerdonek <chris.jerdonek@gmail.com>
parents: 16620
diff changeset
99 # Check that parse_index2() raises TypeError on bad arguments.
e57c532c3835 parse_index2: fix crash on bad argument type (issue4110)
Chris Jerdonek <chris.jerdonek@gmail.com>
parents: 16620
diff changeset
100 try:
e57c532c3835 parse_index2: fix crash on bad argument type (issue4110)
Chris Jerdonek <chris.jerdonek@gmail.com>
parents: 16620
diff changeset
101 parse_index2(0, True)
e57c532c3835 parse_index2: fix crash on bad argument type (issue4110)
Chris Jerdonek <chris.jerdonek@gmail.com>
parents: 16620
diff changeset
102 except TypeError:
e57c532c3835 parse_index2: fix crash on bad argument type (issue4110)
Chris Jerdonek <chris.jerdonek@gmail.com>
parents: 16620
diff changeset
103 pass
e57c532c3835 parse_index2: fix crash on bad argument type (issue4110)
Chris Jerdonek <chris.jerdonek@gmail.com>
parents: 16620
diff changeset
104 else:
e57c532c3835 parse_index2: fix crash on bad argument type (issue4110)
Chris Jerdonek <chris.jerdonek@gmail.com>
parents: 16620
diff changeset
105 print "Expected to get TypeError."
e57c532c3835 parse_index2: fix crash on bad argument type (issue4110)
Chris Jerdonek <chris.jerdonek@gmail.com>
parents: 16620
diff changeset
106
20166
7eda5bb9ec8f parsers: clarify documentation of test-parseindex2.py
Chris Jerdonek <chris.jerdonek@gmail.com>
parents: 20159
diff changeset
107 # Check parsers.parse_index2() on an index file against the original
7eda5bb9ec8f parsers: clarify documentation of test-parseindex2.py
Chris Jerdonek <chris.jerdonek@gmail.com>
parents: 20159
diff changeset
108 # Python implementation of parseindex, both with and without inlined data.
7eda5bb9ec8f parsers: clarify documentation of test-parseindex2.py
Chris Jerdonek <chris.jerdonek@gmail.com>
parents: 20159
diff changeset
109
7110
75fdc39b6172 Add parseindex2.py test case
Bernhard Leiner <bleiner@gmail.com>
parents:
diff changeset
110 py_res_1 = py_parseindex(data_inlined, True)
16363
2cdd7e63211b parsers: incrementally parse the revlog index in C
Bryan O'Sullivan <bryano@fb.com>
parents: 13254
diff changeset
111 c_res_1 = parse_index2(data_inlined, True)
7110
75fdc39b6172 Add parseindex2.py test case
Bernhard Leiner <bleiner@gmail.com>
parents:
diff changeset
112
75fdc39b6172 Add parseindex2.py test case
Bernhard Leiner <bleiner@gmail.com>
parents:
diff changeset
113 py_res_2 = py_parseindex(data_non_inlined, False)
16363
2cdd7e63211b parsers: incrementally parse the revlog index in C
Bryan O'Sullivan <bryano@fb.com>
parents: 13254
diff changeset
114 c_res_2 = parse_index2(data_non_inlined, False)
7110
75fdc39b6172 Add parseindex2.py test case
Bernhard Leiner <bleiner@gmail.com>
parents:
diff changeset
115
8117
2b30d8488819 remove unnecessary outer parenthesis in if-statements
Martin Geisler <mg@lazybytes.net>
parents: 7110
diff changeset
116 if py_res_1 != c_res_1:
7110
75fdc39b6172 Add parseindex2.py test case
Bernhard Leiner <bleiner@gmail.com>
parents:
diff changeset
117 print "Parse index result (with inlined data) differs!"
75fdc39b6172 Add parseindex2.py test case
Bernhard Leiner <bleiner@gmail.com>
parents:
diff changeset
118
8117
2b30d8488819 remove unnecessary outer parenthesis in if-statements
Martin Geisler <mg@lazybytes.net>
parents: 7110
diff changeset
119 if py_res_2 != c_res_2:
7110
75fdc39b6172 Add parseindex2.py test case
Bernhard Leiner <bleiner@gmail.com>
parents:
diff changeset
120 print "Parse index result (no inlined data) differs!"
75fdc39b6172 Add parseindex2.py test case
Bernhard Leiner <bleiner@gmail.com>
parents:
diff changeset
121
16414
e8d37b78acfb parsers: use base-16 trie for faster node->rev mapping
Bryan O'Sullivan <bryano@fb.com>
parents: 16363
diff changeset
122 ix = parsers.parse_index2(data_inlined, True)[0]
e8d37b78acfb parsers: use base-16 trie for faster node->rev mapping
Bryan O'Sullivan <bryano@fb.com>
parents: 16363
diff changeset
123 for i, r in enumerate(ix):
e8d37b78acfb parsers: use base-16 trie for faster node->rev mapping
Bryan O'Sullivan <bryano@fb.com>
parents: 16363
diff changeset
124 if r[7] == nullid:
e8d37b78acfb parsers: use base-16 trie for faster node->rev mapping
Bryan O'Sullivan <bryano@fb.com>
parents: 16363
diff changeset
125 i = -1
16620
e22d6b1dec1d tests: fix test-parseindex2.py when run with --pure
Bryan O'Sullivan <bryano@fb.com>
parents: 16414
diff changeset
126 try:
e22d6b1dec1d tests: fix test-parseindex2.py when run with --pure
Bryan O'Sullivan <bryano@fb.com>
parents: 16414
diff changeset
127 if ix[r[7]] != i:
e22d6b1dec1d tests: fix test-parseindex2.py when run with --pure
Bryan O'Sullivan <bryano@fb.com>
parents: 16414
diff changeset
128 print 'Reverse lookup inconsistent for %r' % r[7].encode('hex')
e22d6b1dec1d tests: fix test-parseindex2.py when run with --pure
Bryan O'Sullivan <bryano@fb.com>
parents: 16414
diff changeset
129 except TypeError:
e22d6b1dec1d tests: fix test-parseindex2.py when run with --pure
Bryan O'Sullivan <bryano@fb.com>
parents: 16414
diff changeset
130 # pure version doesn't support this
e22d6b1dec1d tests: fix test-parseindex2.py when run with --pure
Bryan O'Sullivan <bryano@fb.com>
parents: 16414
diff changeset
131 break
16414
e8d37b78acfb parsers: use base-16 trie for faster node->rev mapping
Bryan O'Sullivan <bryano@fb.com>
parents: 16363
diff changeset
132
7110
75fdc39b6172 Add parseindex2.py test case
Bernhard Leiner <bleiner@gmail.com>
parents:
diff changeset
133 print "done"
75fdc39b6172 Add parseindex2.py test case
Bernhard Leiner <bleiner@gmail.com>
parents:
diff changeset
134
75fdc39b6172 Add parseindex2.py test case
Bernhard Leiner <bleiner@gmail.com>
parents:
diff changeset
135 runtest()