Show More
@@ -26,6 +26,7 We approximate that by reducing the read | |||
|
26 | 26 | summary: change foo |
|
27 | 27 | |
|
28 | 28 | $ cat >> test.py << EOF |
|
29 | > from __future__ import print_function | |
|
29 | 30 | > from mercurial import changelog, vfs |
|
30 | 31 | > from mercurial.node import * |
|
31 | 32 | > |
@@ -56,9 +57,9 We approximate that by reducing the read | |||
|
56 | 57 | > return wrapper |
|
57 | 58 | > |
|
58 | 59 | > cl = changelog.changelog(opener('.hg/store')) |
|
59 |
> print |
|
|
60 | > print(len(cl), 'revisions:') | |
|
60 | 61 | > for r in cl: |
|
61 |
> print |
|
|
62 | > print(short(cl.node(r))) | |
|
62 | 63 | > EOF |
|
63 | 64 | $ $PYTHON test.py |
|
64 | 65 | 2 revisions: |
@@ -74,33 +75,34 Test SEGV caused by bad revision passed | |||
|
74 | 75 | $ cd a |
|
75 | 76 | |
|
76 | 77 | $ $PYTHON <<EOF |
|
78 | > from __future__ import print_function | |
|
77 | 79 | > from mercurial import changelog, vfs |
|
78 | 80 | > cl = changelog.changelog(vfs.vfs('.hg/store')) |
|
79 |
> print |
|
|
81 | > print('good heads:') | |
|
80 | 82 | > for head in [0, len(cl) - 1, -1]: |
|
81 | > print'%s: %r' % (head, cl.reachableroots(0, [head], [0])) | |
|
82 |
> print |
|
|
83 | > print('%s: %r' % (head, cl.reachableroots(0, [head], [0]))) | |
|
84 | > print('bad heads:') | |
|
83 | 85 | > for head in [len(cl), 10000, -2, -10000, None]: |
|
84 |
> print |
|
|
86 | > print('%s:' % head, end=' ') | |
|
85 | 87 | > try: |
|
86 | 88 | > cl.reachableroots(0, [head], [0]) |
|
87 |
> print |
|
|
89 | > print('uncaught buffer overflow?') | |
|
88 | 90 | > except (IndexError, TypeError) as inst: |
|
89 |
> print |
|
|
90 |
> print |
|
|
91 | > print(inst) | |
|
92 | > print('good roots:') | |
|
91 | 93 | > for root in [0, len(cl) - 1, -1]: |
|
92 |
> print |
|
|
93 |
> print |
|
|
94 | > print('%s: %r' % (root, cl.reachableroots(root, [len(cl) - 1], [root]))) | |
|
95 | > print('out-of-range roots are ignored:') | |
|
94 | 96 | > for root in [len(cl), 10000, -2, -10000]: |
|
95 |
> print |
|
|
96 |
> print |
|
|
97 | > print('%s: %r' % (root, cl.reachableroots(root, [len(cl) - 1], [root]))) | |
|
98 | > print('bad roots:') | |
|
97 | 99 | > for root in [None]: |
|
98 |
> print |
|
|
100 | > print('%s:' % root, end=' ') | |
|
99 | 101 | > try: |
|
100 | 102 | > cl.reachableroots(root, [len(cl) - 1], [root]) |
|
101 |
> print |
|
|
103 | > print('uncaught error?') | |
|
102 | 104 | > except TypeError as inst: |
|
103 |
> print |
|
|
105 | > print(inst) | |
|
104 | 106 | > EOF |
|
105 | 107 | good heads: |
|
106 | 108 | 0: [0] |
@@ -164,6 +166,7 Test corrupted p1/p2 fields that could c | |||
|
164 | 166 | 1 2 1 -1 base 66 65 66 1.01538 66 0 0.00000 |
|
165 | 167 | |
|
166 | 168 | $ cat <<EOF > test.py |
|
169 | > from __future__ import print_function | |
|
167 | 170 | > import sys |
|
168 | 171 | > from mercurial import changelog, vfs |
|
169 | 172 | > cl = changelog.changelog(vfs.vfs(sys.argv[1])) |
@@ -177,12 +180,12 Test corrupted p1/p2 fields that could c | |||
|
177 | 180 | > ('find_deepest', lambda: cl.ancestor(n0, n1)), |
|
178 | 181 | > ] |
|
179 | 182 | > for l, f in ops: |
|
180 |
> print |
|
|
183 | > print(l + ':', end=' ') | |
|
181 | 184 | > try: |
|
182 | 185 | > f() |
|
183 |
> print |
|
|
186 | > print('uncaught buffer overflow?') | |
|
184 | 187 | > except ValueError, inst: |
|
185 |
> print |
|
|
188 | > print(inst) | |
|
186 | 189 | > EOF |
|
187 | 190 | |
|
188 | 191 | $ $PYTHON test.py limit/.hg/store |
General Comments 0
You need to be logged in to leave comments.
Login now