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