contrib/fuzz/dirstate_corpus.py
author Gregory Szorc <gregory.szorc@gmail.com>
Sat, 03 Aug 2019 16:47:49 -0700
changeset 42697 3e3fb15bfeea
parent 41015 b444407f635b
child 43076 2372284d9457
permissions -rw-r--r--
automation: increase root volume size on Linux It is close to full in the AMI. I actually ran out of space running tests without increasing the volume size! Differential Revision: https://phab.mercurial-scm.org/D6716

from __future__ import absolute_import, print_function

import argparse
import os
import zipfile

ap = argparse.ArgumentParser()
ap.add_argument("out", metavar="some.zip", type=str, nargs=1)
args = ap.parse_args()

reporoot = os.path.normpath(os.path.join(os.path.dirname(__file__),
                                         '..', '..'))
dirstate = os.path.join(reporoot, '.hg', 'dirstate')

with zipfile.ZipFile(args.out[0], "w", zipfile.ZIP_STORED) as zf:
    if os.path.exists(dirstate):
        with open(dirstate) as f:
            zf.writestr("dirstate", f.read())