Details
Details
- Reviewers
- None
- Group Reviewers
hg-reviewers - Commits
- rHGce307af030a2: py3: use print as a function in tests/test-parseindex.t
Diff Detail
Diff Detail
- Repository
- rHG Mercurial
- Lint
Lint Skipped - Unit
Unit Tests Skipped
hg-reviewers |
Lint Skipped |
Unit Tests Skipped |
Path | Packages | |||
---|---|---|---|---|
M | tests/test-parseindex.t (41 lines) |
Commit | Parents | Author | Summary | Date |
---|---|---|---|---|
Pulkit Goyal | May 19 2018, 9:12 AM |
Status | Author | Revision | |
---|---|---|---|
Closed | pulkit | ||
Closed | pulkit | ||
Closed | pulkit | ||
Closed | pulkit | ||
Closed | pulkit | ||
Closed | pulkit | ||
Closed | pulkit | ||
Closed | pulkit | ||
Closed | pulkit | ||
Closed | pulkit | ||
Closed | pulkit | ||
Closed | pulkit | ||
Closed | pulkit | ||
Closed | pulkit | ||
Closed | pulkit | ||
Closed | pulkit | ||
Closed | pulkit | ||
Closed | pulkit | ||
Closed | pulkit | ||
Closed | pulkit | ||
Closed | pulkit | ||
Closed | pulkit | ||
Closed | pulkit | ||
Closed | pulkit | ||
Closed | pulkit | ||
Closed | pulkit |
changeset: 1:26333235a41c | changeset: 1:26333235a41c | ||||
tag: tip | tag: tip | ||||
user: test | user: test | ||||
date: Thu Jan 01 00:00:00 1970 +0000 | date: Thu Jan 01 00:00:00 1970 +0000 | ||||
summary: change foo | summary: change foo | ||||
$ cat >> test.py << EOF | $ cat >> test.py << EOF | ||||
> from __future__ import print_function | |||||
> from mercurial import changelog, vfs | > from mercurial import changelog, vfs | ||||
> from mercurial.node import * | > from mercurial.node import * | ||||
> | > | ||||
> class singlebyteread(object): | > class singlebyteread(object): | ||||
> def __init__(self, real): | > def __init__(self, real): | ||||
> self.real = real | > self.real = real | ||||
> | > | ||||
> def read(self, size=-1): | > def read(self, size=-1): | ||||
> def opener(*args): | > def opener(*args): | ||||
> o = vfs.vfs(*args) | > o = vfs.vfs(*args) | ||||
> def wrapper(*a, **kwargs): | > def wrapper(*a, **kwargs): | ||||
> f = o(*a, **kwargs) | > f = o(*a, **kwargs) | ||||
> return singlebyteread(f) | > return singlebyteread(f) | ||||
> return wrapper | > return wrapper | ||||
> | > | ||||
> cl = changelog.changelog(opener('.hg/store')) | > cl = changelog.changelog(opener('.hg/store')) | ||||
> print len(cl), 'revisions:' | > print(len(cl), 'revisions:') | ||||
> for r in cl: | > for r in cl: | ||||
> print short(cl.node(r)) | > print(short(cl.node(r))) | ||||
> EOF | > EOF | ||||
$ $PYTHON test.py | $ $PYTHON test.py | ||||
2 revisions: | 2 revisions: | ||||
7c31755bf9b5 | 7c31755bf9b5 | ||||
26333235a41c | 26333235a41c | ||||
$ cd .. | $ cd .. | ||||
#if no-pure | #if no-pure | ||||
Test SEGV caused by bad revision passed to reachableroots() (issue4775): | Test SEGV caused by bad revision passed to reachableroots() (issue4775): | ||||
$ cd a | $ cd a | ||||
$ $PYTHON <<EOF | $ $PYTHON <<EOF | ||||
> from __future__ import print_function | |||||
> from mercurial import changelog, vfs | > from mercurial import changelog, vfs | ||||
> cl = changelog.changelog(vfs.vfs('.hg/store')) | > cl = changelog.changelog(vfs.vfs('.hg/store')) | ||||
> print 'good heads:' | > print('good heads:') | ||||
> for head in [0, len(cl) - 1, -1]: | > for head in [0, len(cl) - 1, -1]: | ||||
> print'%s: %r' % (head, cl.reachableroots(0, [head], [0])) | > print('%s: %r' % (head, cl.reachableroots(0, [head], [0]))) | ||||
> print 'bad heads:' | > print('bad heads:') | ||||
> for head in [len(cl), 10000, -2, -10000, None]: | > for head in [len(cl), 10000, -2, -10000, None]: | ||||
> print '%s:' % head, | > print('%s:' % head, end=' ') | ||||
> try: | > try: | ||||
> cl.reachableroots(0, [head], [0]) | > cl.reachableroots(0, [head], [0]) | ||||
> print 'uncaught buffer overflow?' | > print('uncaught buffer overflow?') | ||||
> except (IndexError, TypeError) as inst: | > except (IndexError, TypeError) as inst: | ||||
> print inst | > print(inst) | ||||
> print 'good roots:' | > print('good roots:') | ||||
> for root in [0, len(cl) - 1, -1]: | > for root in [0, len(cl) - 1, -1]: | ||||
> print '%s: %r' % (root, cl.reachableroots(root, [len(cl) - 1], [root])) | > print('%s: %r' % (root, cl.reachableroots(root, [len(cl) - 1], [root]))) | ||||
> print 'out-of-range roots are ignored:' | > print('out-of-range roots are ignored:') | ||||
> for root in [len(cl), 10000, -2, -10000]: | > for root in [len(cl), 10000, -2, -10000]: | ||||
> print '%s: %r' % (root, cl.reachableroots(root, [len(cl) - 1], [root])) | > print('%s: %r' % (root, cl.reachableroots(root, [len(cl) - 1], [root]))) | ||||
> print 'bad roots:' | > print('bad roots:') | ||||
> for root in [None]: | > for root in [None]: | ||||
> print '%s:' % root, | > print('%s:' % root, end=' ') | ||||
> try: | > try: | ||||
> cl.reachableroots(root, [len(cl) - 1], [root]) | > cl.reachableroots(root, [len(cl) - 1], [root]) | ||||
> print 'uncaught error?' | > print('uncaught error?') | ||||
> except TypeError as inst: | > except TypeError as inst: | ||||
> print inst | > print(inst) | ||||
> EOF | > EOF | ||||
good heads: | good heads: | ||||
0: [0] | 0: [0] | ||||
1: [0] | 1: [0] | ||||
-1: [] | -1: [] | ||||
bad heads: | bad heads: | ||||
2: head out of range | 2: head out of range | ||||
10000: head out of range | 10000: head out of range | ||||
1 0000 65 1 0 65536 26333235a41c | 1 0000 65 1 0 65536 26333235a41c | ||||
$ hg -R segv debugdeltachain -c | $ hg -R segv debugdeltachain -c | ||||
rev chain# chainlen prev delta size rawsize chainsize ratio lindist extradist extraratio | rev chain# chainlen prev delta size rawsize chainsize ratio lindist extradist extraratio | ||||
0 1 1 -1 base 63 62 63 1.01613 63 0 0.00000 | 0 1 1 -1 base 63 62 63 1.01613 63 0 0.00000 | ||||
1 2 1 -1 base 66 65 66 1.01538 66 0 0.00000 | 1 2 1 -1 base 66 65 66 1.01538 66 0 0.00000 | ||||
$ cat <<EOF > test.py | $ cat <<EOF > test.py | ||||
> from __future__ import print_function | |||||
> import sys | > import sys | ||||
> from mercurial import changelog, vfs | > from mercurial import changelog, vfs | ||||
> cl = changelog.changelog(vfs.vfs(sys.argv[1])) | > cl = changelog.changelog(vfs.vfs(sys.argv[1])) | ||||
> n0, n1 = cl.node(0), cl.node(1) | > n0, n1 = cl.node(0), cl.node(1) | ||||
> ops = [ | > ops = [ | ||||
> ('reachableroots', | > ('reachableroots', | ||||
> lambda: cl.index.reachableroots2(0, [1], [0], False)), | > lambda: cl.index.reachableroots2(0, [1], [0], False)), | ||||
> ('compute_phases_map_sets', lambda: cl.computephases([[0], []])), | > ('compute_phases_map_sets', lambda: cl.computephases([[0], []])), | ||||
> ('index_headrevs', lambda: cl.headrevs()), | > ('index_headrevs', lambda: cl.headrevs()), | ||||
> ('find_gca_candidates', lambda: cl.commonancestorsheads(n0, n1)), | > ('find_gca_candidates', lambda: cl.commonancestorsheads(n0, n1)), | ||||
> ('find_deepest', lambda: cl.ancestor(n0, n1)), | > ('find_deepest', lambda: cl.ancestor(n0, n1)), | ||||
> ] | > ] | ||||
> for l, f in ops: | > for l, f in ops: | ||||
> print l + ':', | > print(l + ':', end=' ') | ||||
> try: | > try: | ||||
> f() | > f() | ||||
> print 'uncaught buffer overflow?' | > print('uncaught buffer overflow?') | ||||
> except ValueError, inst: | > except ValueError, inst: | ||||
> print inst | > print(inst) | ||||
> EOF | > EOF | ||||
$ $PYTHON test.py limit/.hg/store | $ $PYTHON test.py limit/.hg/store | ||||
reachableroots: parent out of range | reachableroots: parent out of range | ||||
compute_phases_map_sets: parent out of range | compute_phases_map_sets: parent out of range | ||||
index_headrevs: parent out of range | index_headrevs: parent out of range | ||||
find_gca_candidates: parent out of range | find_gca_candidates: parent out of range | ||||
find_deepest: parent out of range | find_deepest: parent out of range |