Details
Details
- Reviewers
pulkit - Group Reviewers
hg-reviewers - Commits
- rHG07ade2dc41db: py3: port test-parseindex.t to Python 3
Diff Detail
Diff Detail
- Repository
- rHG Mercurial
- Lint
Lint Skipped - Unit
Unit Tests Skipped
( )
pulkit |
hg-reviewers |
Lint Skipped |
Unit Tests Skipped |
Path | Packages | |||
---|---|---|---|---|
M | contrib/python3-whitelist (1 line) | |||
M | tests/test-parseindex.t (16 lines) |
Commit | Parents | Author | Summary | Date |
---|---|---|---|---|
Augie Fackler | Jan 24 2019, 3:23 PM |
test-obsolete-divergent.t | test-obsolete-divergent.t | ||||
test-obsolete-tag-cache.t | test-obsolete-tag-cache.t | ||||
test-obsolete.t | test-obsolete.t | ||||
test-origbackup-conflict.t | test-origbackup-conflict.t | ||||
test-pager-legacy.t | test-pager-legacy.t | ||||
test-pager.t | test-pager.t | ||||
test-parents.t | test-parents.t | ||||
test-parse-date.t | test-parse-date.t | ||||
test-parseindex.t | |||||
test-parseindex2.py | test-parseindex2.py | ||||
test-patch-offset.t | test-patch-offset.t | ||||
test-patch.t | test-patch.t | ||||
test-patchbomb-bookmark.t | test-patchbomb-bookmark.t | ||||
test-patchbomb-tls.t | test-patchbomb-tls.t | ||||
test-patchbomb.t | test-patchbomb.t | ||||
test-pathconflicts-basic.t | test-pathconflicts-basic.t | ||||
test-pathconflicts-merge.t | test-pathconflicts-merge.t |
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 __future__ import print_function | ||||
> from mercurial import changelog, node, vfs | > from mercurial import changelog, node, pycompat, vfs | ||||
> | > | ||||
> 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): | ||||
> if size == 65536: | > if size == 65536: | ||||
> size = 1 | > 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(b'.hg/store')) | ||||
> print(len(cl), 'revisions:') | > print(len(cl), 'revisions:') | ||||
> for r in cl: | > for r in cl: | ||||
> print(node.short(cl.node(r))) | > print(pycompat.sysstr(node.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 __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(b'.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, end=' ') | > print('%s:' % head, end=' ') | ||||
> try: | > try: | ||||
> cl.reachableroots(0, [head], [0]) | > cl.reachableroots(0, [head], [0]) | ||||
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 | ||||
-2: head out of range | -2: head out of range | ||||
-10000: head out of range | -10000: head out of range | ||||
None: an integer is required | None: an integer is required( .got type NoneType.) (re) | ||||
good roots: | good roots: | ||||
0: [0] | 0: [0] | ||||
1: [1] | 1: [1] | ||||
-1: [-1] | -1: [-1] | ||||
out-of-range roots are ignored: | out-of-range roots are ignored: | ||||
2: [] | 2: [] | ||||
10000: [] | 10000: [] | ||||
-2: [] | -2: [] | ||||
-10000: [] | -10000: [] | ||||
bad roots: | bad roots: | ||||
None: an integer is required | None: an integer is required( .got type NoneType.) (re) | ||||
$ cd .. | $ cd .. | ||||
Test corrupted p1/p2 fields that could cause SEGV at parsers.c: | Test corrupted p1/p2 fields that could cause SEGV at parsers.c: | ||||
$ mkdir invalidparent | $ mkdir invalidparent | ||||
$ cd invalidparent | $ cd invalidparent | ||||
$ 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 | > from __future__ import print_function | ||||
> import sys | > import sys | ||||
> from mercurial import changelog, vfs | > from mercurial import changelog, pycompat, vfs | ||||
> cl = changelog.changelog(vfs.vfs(sys.argv[1])) | > cl = changelog.changelog(vfs.vfs(pycompat.fsencode(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)), |