contrib/fuzz/dirstate_corpus.py
raw| 1 | import argparse |
| 2 | import os |
| 3 | import zipfile |
| 4 | |
| 5 | ap = argparse.ArgumentParser() |
| 6 | ap.add_argument("out", metavar="some.zip", type=str, nargs=1) |
| 7 | args = ap.parse_args() |
| 8 | |
| 9 | reporoot = os.path.normpath(os.path.join(os.path.dirname(__file__), '..', '..')) |
| 10 | dirstate = os.path.join(reporoot, '.hg', 'dirstate') |
| 11 | |
| 12 | with zipfile.ZipFile(args.out[0], "w", zipfile.ZIP_STORED) as zf: |
| 13 | if os.path.exists(dirstate): |
| 14 | with open(dirstate, 'rb') as f: |
| 15 | zf.writestr("dirstate", f.read()) |