comparison contrib/fuzz/dirstate_corpus.py @ 41015:b444407f635b

fuzz: new fuzzer for dirstate parser Differential Revision: https://phab.mercurial-scm.org/D5463
author Augie Fackler <augie@google.com>
date Wed, 19 Dec 2018 23:48:35 -0500
parents
children 2372284d9457
comparison
equal deleted inserted replaced
41014:c06f0ef9a5ba 41015:b444407f635b
1 from __future__ import absolute_import, print_function
2
3 import argparse
4 import os
5 import zipfile
6
7 ap = argparse.ArgumentParser()
8 ap.add_argument("out", metavar="some.zip", type=str, nargs=1)
9 args = ap.parse_args()
10
11 reporoot = os.path.normpath(os.path.join(os.path.dirname(__file__),
12 '..', '..'))
13 dirstate = os.path.join(reporoot, '.hg', 'dirstate')
14
15 with zipfile.ZipFile(args.out[0], "w", zipfile.ZIP_STORED) as zf:
16 if os.path.exists(dirstate):
17 with open(dirstate) as f:
18 zf.writestr("dirstate", f.read())