contrib/fuzz/revlog_corpus.py
author Valentin Gatien-Baron <valentin.gatienbaron@gmail.com>
Tue, 25 Feb 2020 20:27:39 -0500
changeset 44439 edc8504bc26b
parent 43854 ba84a1ae4ae5
child 48966 6000f5b25c9b
permissions -rw-r--r--
exchange: turn on option that makes concurrent pushes work better The motivation is simply to make hg work better out of the box. This is a slight backwards compatibility break, because client extensions could have assumed that the list of heads the client sees during discovery will be the list of heads during the entirety of the push. It seems unlikely to matter, and not worth mentioning. There's a fair amount of diff in tests, but this is just due to sending a few more bytes on the wire, except for test-acl.t. The extra "invalid branch cache" lines in test-acl.t don't seem to indicate a problem: the branchcache now get computed during the bundle application (because of the check:updated-heads bundle part), but doesn't get rolled back when transactions rollback, thus causing a message in the next operation computing the branch cache. Before this change, I assume the branchcache was only computed on transaction commit, so not computed at all when the transactions roll back, thus no messages. Differential Revision: https://phab.mercurial-scm.org/D8202
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
43826
54a6846ba96f fuzz: remove debug prints from revlog_corpus.py
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
     1
from __future__ import absolute_import
41024
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
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 41024
diff changeset
    11
reporoot = os.path.normpath(os.path.join(os.path.dirname(__file__), '..', '..'))
41024
c06f0ef9a5ba fuzz: new fuzzer for revlog's parse_index2 method
Augie Fackler <augie@google.com>
parents:
diff changeset
    12
# typically a standalone index
c06f0ef9a5ba fuzz: new fuzzer for revlog's parse_index2 method
Augie Fackler <augie@google.com>
parents:
diff changeset
    13
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
    14
# 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
    15
contributing = os.path.join(
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 41024
diff changeset
    16
    reporoot, '.hg', 'store', 'data', 'contrib', 'fuzz', 'mpatch.cc.i'
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 41024
diff changeset
    17
)
41024
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
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
    20
    if os.path.exists(changelog):
43854
ba84a1ae4ae5 fuzz: fix test-fuzz-targets.t to run with python3
Kyle Lippincott <spectral@google.com>
parents: 43826
diff changeset
    21
        with open(changelog, 'rb') as f:
41024
c06f0ef9a5ba fuzz: new fuzzer for revlog's parse_index2 method
Augie Fackler <augie@google.com>
parents:
diff changeset
    22
            zf.writestr("00changelog.i", f.read())
c06f0ef9a5ba fuzz: new fuzzer for revlog's parse_index2 method
Augie Fackler <augie@google.com>
parents:
diff changeset
    23
    if os.path.exists(contributing):
43854
ba84a1ae4ae5 fuzz: fix test-fuzz-targets.t to run with python3
Kyle Lippincott <spectral@google.com>
parents: 43826
diff changeset
    24
        with open(contributing, 'rb') as f:
41024
c06f0ef9a5ba fuzz: new fuzzer for revlog's parse_index2 method
Augie Fackler <augie@google.com>
parents:
diff changeset
    25
            zf.writestr("contributing.i", f.read())