tests/test-parseindex.t
changeset 33262 8e6f4939a69a
parent 32940 75be14993fda
child 35965 c839bbee1e13
equal deleted inserted replaced
33261:be49f3fdcd10 33262:8e6f4939a69a
    64 
    64 
    65 Test SEGV caused by bad revision passed to reachableroots() (issue4775):
    65 Test SEGV caused by bad revision passed to reachableroots() (issue4775):
    66 
    66 
    67   $ cd a
    67   $ cd a
    68 
    68 
    69   $ python <<EOF
    69   $ $PYTHON <<EOF
    70   > from mercurial import changelog, vfs
    70   > from mercurial import changelog, vfs
    71   > cl = changelog.changelog(vfs.vfs('.hg/store'))
    71   > cl = changelog.changelog(vfs.vfs('.hg/store'))
    72   > print 'good heads:'
    72   > print 'good heads:'
    73   > for head in [0, len(cl) - 1, -1]:
    73   > for head in [0, len(cl) - 1, -1]:
    74   >     print'%s: %r' % (head, cl.reachableroots(0, [head], [0]))
    74   >     print'%s: %r' % (head, cl.reachableroots(0, [head], [0]))
   126 
   126 
   127   $ hg clone --pull -q --config phases.publish=False ../a limit
   127   $ hg clone --pull -q --config phases.publish=False ../a limit
   128   $ hg clone --pull -q --config phases.publish=False ../a segv
   128   $ hg clone --pull -q --config phases.publish=False ../a segv
   129   $ rm -R limit/.hg/cache segv/.hg/cache
   129   $ rm -R limit/.hg/cache segv/.hg/cache
   130 
   130 
   131   $ python <<EOF
   131   $ $PYTHON <<EOF
   132   > data = open("limit/.hg/store/00changelog.i", "rb").read()
   132   > data = open("limit/.hg/store/00changelog.i", "rb").read()
   133   > for n, p in [('limit', '\0\0\0\x02'), ('segv', '\0\x01\0\0')]:
   133   > for n, p in [('limit', '\0\0\0\x02'), ('segv', '\0\x01\0\0')]:
   134   >     # corrupt p1 at rev0 and p2 at rev1
   134   >     # corrupt p1 at rev0 and p2 at rev1
   135   >     d = data[:24] + p + data[28:127 + 28] + p + data[127 + 32:]
   135   >     d = data[:24] + p + data[28:127 + 28] + p + data[127 + 32:]
   136   >     open(n + "/.hg/store/00changelog.i", "wb").write(d)
   136   >     open(n + "/.hg/store/00changelog.i", "wb").write(d)