Mercurial > hg
annotate contrib/fuzz/revlog_corpus.py @ 42070:675775c33ab6
zstandard: vendor python-zstandard 0.11
The upstream source distribution from PyPI was extracted. Unwanted
files were removed.
The clang-format ignore list was updated to reflect the new source
of files.
The project contains a vendored copy of zstandard 1.3.8. The old
version was 1.3.6. This should result in some minor performance wins.
test-check-py3-compat.t was updated to reflect now-passing tests on
Python 3.8.
Some HTTP tests were updated to reflect new zstd compression output.
# no-check-commit because 3rd party code has different style guidelines
Differential Revision: https://phab.mercurial-scm.org/D6199
author | Gregory Szorc <gregory.szorc@gmail.com> |
---|---|
date | Thu, 04 Apr 2019 17:34:43 -0700 |
parents | c06f0ef9a5ba |
children | 2372284d9457 |
rev | line source |
---|---|
41014
c06f0ef9a5ba
fuzz: new fuzzer for revlog's parse_index2 method
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
1 from __future__ import absolute_import, print_function |
c06f0ef9a5ba
fuzz: new fuzzer for revlog's parse_index2 method
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
2 |
c06f0ef9a5ba
fuzz: new fuzzer for revlog's parse_index2 method
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
3 import argparse |
c06f0ef9a5ba
fuzz: new fuzzer for revlog's parse_index2 method
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
4 import os |
c06f0ef9a5ba
fuzz: new fuzzer for revlog's parse_index2 method
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
5 import zipfile |
c06f0ef9a5ba
fuzz: new fuzzer for revlog's parse_index2 method
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
6 |
c06f0ef9a5ba
fuzz: new fuzzer for revlog's parse_index2 method
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
7 ap = argparse.ArgumentParser() |
c06f0ef9a5ba
fuzz: new fuzzer for revlog's parse_index2 method
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
8 ap.add_argument("out", metavar="some.zip", type=str, nargs=1) |
c06f0ef9a5ba
fuzz: new fuzzer for revlog's parse_index2 method
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
9 args = ap.parse_args() |
c06f0ef9a5ba
fuzz: new fuzzer for revlog's parse_index2 method
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
10 |
c06f0ef9a5ba
fuzz: new fuzzer for revlog's parse_index2 method
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
11 reporoot = os.path.normpath(os.path.join(os.path.dirname(__file__), |
c06f0ef9a5ba
fuzz: new fuzzer for revlog's parse_index2 method
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
12 '..', '..')) |
c06f0ef9a5ba
fuzz: new fuzzer for revlog's parse_index2 method
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
13 # typically a standalone index |
c06f0ef9a5ba
fuzz: new fuzzer for revlog's parse_index2 method
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
14 changelog = os.path.join(reporoot, '.hg', 'store', '00changelog.i') |
c06f0ef9a5ba
fuzz: new fuzzer for revlog's parse_index2 method
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
15 # an inline revlog with only a few revisions |
c06f0ef9a5ba
fuzz: new fuzzer for revlog's parse_index2 method
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
16 contributing = os.path.join( |
c06f0ef9a5ba
fuzz: new fuzzer for revlog's parse_index2 method
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
17 reporoot, '.hg', 'store', 'data', 'contrib', 'fuzz', 'mpatch.cc.i') |
c06f0ef9a5ba
fuzz: new fuzzer for revlog's parse_index2 method
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
18 |
c06f0ef9a5ba
fuzz: new fuzzer for revlog's parse_index2 method
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
19 print(changelog, os.path.exists(changelog)) |
c06f0ef9a5ba
fuzz: new fuzzer for revlog's parse_index2 method
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
20 print(contributing, os.path.exists(contributing)) |
c06f0ef9a5ba
fuzz: new fuzzer for revlog's parse_index2 method
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
21 |
c06f0ef9a5ba
fuzz: new fuzzer for revlog's parse_index2 method
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
22 with zipfile.ZipFile(args.out[0], "w", zipfile.ZIP_STORED) as zf: |
c06f0ef9a5ba
fuzz: new fuzzer for revlog's parse_index2 method
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
23 if os.path.exists(changelog): |
c06f0ef9a5ba
fuzz: new fuzzer for revlog's parse_index2 method
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
24 with open(changelog) as f: |
c06f0ef9a5ba
fuzz: new fuzzer for revlog's parse_index2 method
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
25 zf.writestr("00changelog.i", f.read()) |
c06f0ef9a5ba
fuzz: new fuzzer for revlog's parse_index2 method
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
26 if os.path.exists(contributing): |
c06f0ef9a5ba
fuzz: new fuzzer for revlog's parse_index2 method
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
27 with open(contributing) as f: |
c06f0ef9a5ba
fuzz: new fuzzer for revlog's parse_index2 method
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
28 zf.writestr("contributing.i", f.read()) |